User approver = _cycle.getActor(ValidationStep.APPROVAL); // May be null if not approvable
ProgressState mystate = _operand.value().getProgressState();
- if (mystate == ProgressState.inDRAFT) {
- if (publisher == null) {
- if ((!_isauthor) && (!_user.equals(manager))
- && (!_user.equals(reviewer))) {
- return false;
- }
- } else if ((!_user.equals(publisher)) && (!_user.equals(reviewer))) {
- return false;
- }
- } else if (mystate == ProgressState.inCHECK) {
- if (!_user.equals(approver)) {
- return false;
- }
- } else {
- return false;
- }
+ boolean res = (((mystate != ProgressState.inDRAFT || publisher != null
+ || _isauthor || _user.equals(manager))
+ && (publisher == null || _user.equals(publisher)) || _user
+ .equals(reviewer))
- List<Relation> use = _operand.value()
- .getRelations(UsedByRelation.class);
- for (Iterator<Relation> i = use.iterator(); i.hasNext();) {
- Document depend = (Document) i.next().getTo();
- ProgressState state = depend.getProgressState();
- if (mystate == ProgressState.inDRAFT
- && state != ProgressState.inWORK) {
- return false;
- }
- if (mystate == ProgressState.inCHECK
- && (state != ProgressState.inDRAFT && state != ProgressState.inWORK)) {
- return false;
+ && (mystate != ProgressState.inCHECK
+
+ || ((approver == null || _user.equals(approver) || _user
+ .equals(reviewer))
+
+ && (approver != null || _user.equals(publisher) || (reviewer == null || _user
+ .equals(reviewer))
+ && (reviewer != null || _user.equals(manager)))))
+
+ && (mystate == ProgressState.inCHECK || mystate == ProgressState.inDRAFT));
+
+ if (res) {
+ List<Relation> use = _operand.value().getRelations(
+ UsedByRelation.class);
+ for (Relation rel : use) {
+ Document depend = (Document) rel.getTo();
+ ProgressState state = depend.getProgressState();
+ if (((mystate == ProgressState.inDRAFT) || (mystate == ProgressState.inCHECK && (state != ProgressState.inDRAFT)))
+ && state != ProgressState.inWORK) {
+ res = false;
+ break;
+ }
}
}
- return true;
+ return res;
}
/**
User approver = _cycle.getActor(ValidationStep.APPROVAL); // May be null if not approvable
ProgressState mystate = _operand.getProgressState();
- if (mystate == ProgressState.inDRAFT) {
- if (publisher == null) {
- if ((!_isauthor) && (!_user.equals(manager))
- && (!_user.equals(reviewer))) {
- return false;
- }
- } else if ((!_user.equals(publisher)) && (!_user.equals(reviewer))) {
- return false;
- }
- } else if (mystate == ProgressState.inCHECK) {
- if (!_user.equals(approver)) {
- return false;
- }
- } else {
- return false;
- }
+ boolean res = (((mystate != ProgressState.inDRAFT || publisher != null
+ || _isauthor || _user.equals(manager))
+ && (publisher == null || _user.equals(publisher)) || _user
+ .equals(reviewer))
+
+ && (mystate != ProgressState.inCHECK
+
+ || ((approver == null || _user.equals(approver) || _user
+ .equals(reviewer))
- return true;
+ && (approver != null || _user.equals(publisher) || (reviewer == null || _user
+ .equals(reviewer))
+ && (reviewer != null || _user.equals(manager)))))
+
+ && (mystate == ProgressState.inCHECK || mystate == ProgressState.inDRAFT));
+
+ return res;
}
/**