@Transactional
public boolean promote(final Study aStudy) {
boolean res = true;
+ ValidationCycle cycle = getValidationCycleOf(aStudy,
+ getStudyResultType(aStudy));
+
if (aStudy.getProgressState() == ProgressState.inWORK
+ && cycle.enables(ValidationStep.REVIEW)
&& canBePromoted(aStudy)) {
aStudy.setProgressState(ProgressState.inDRAFT);
- } else if (aStudy.getProgressState() == ProgressState.inDRAFT
+ } else if (((!cycle.enables(ValidationStep.REVIEW) && ((aStudy
+ .getProgressState() == ProgressState.inWORK) || (aStudy
+ .getProgressState() == ProgressState.inDRAFT))) || (cycle
+ .enables(ValidationStep.REVIEW) && (aStudy.getProgressState() == ProgressState.inDRAFT)))
&& canBeReviewed(aStudy)) {
aStudy.setProgressState(ProgressState.inCHECK);
Revision myvers = new Revision(aStudy.getVersion());
@Transactional
public boolean demote(final Study aStudy) {
boolean res;
+
if (aStudy.getProgressState() == ProgressState.inCHECK
|| aStudy.getProgressState() == ProgressState.inDRAFT) {
aStudy.setProgressState(ProgressState.inWORK);
*/
public boolean canReview() {
User reviewer = _cycle.getActor(ValidationStep.REVIEW); // May be null if not reviewable
+ boolean res = false;
- if (!_user.equals(reviewer)) {
- return false;
- }
- if (_operand.getProgressState() != ProgressState.inDRAFT) {
- return false;
+ if (((reviewer == null) && ((_operand.getProgressState() == ProgressState.inWORK) || (_operand
+ .getProgressState() == ProgressState.inDRAFT)))
+ || (_user.equals(reviewer) && (_operand.getProgressState() == ProgressState.inDRAFT))) {
+ res = getStudyService().canBeReviewed(_operand);
}
- return getStudyService().canBeReviewed(_operand);
+ return res;
}
// ==============================================================================================================================