feature_24570 #11
|
@ -127,7 +127,12 @@ public abstract class AbstractLifeCycleManager extends AbstractPlugin implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StepExecutionReport performStep(StepExecutionRequest request) throws StepException, InvalidPluginRequestException, InvalidProfileException, ConfigurationException, InsufficientPrivileges {
|
public StepExecutionReport performStep(StepExecutionRequest request) throws StepException, InvalidPluginRequestException, InvalidProfileException, ConfigurationException, InsufficientPrivileges {
|
||||||
log.info("Serving Request {}",request);
|
log.info("Serving Request - caller {}, ucd id {}, document id {}, step {}",
|
||||||
|
request.getCaller(),
|
||||||
|
request.getUseCaseDescriptor().getId(),
|
||||||
|
request.getDocument().getId(),
|
||||||
|
request.getStep());
|
||||||
|
log.debug("Serving Request full log {}",request);
|
||||||
|
|
||||||
log.debug("Checking is STEP {} is supported by {}",request.getStep(),DESCRIPTOR.getId());
|
log.debug("Checking is STEP {} is supported by {}",request.getStep(),DESCRIPTOR.getId());
|
||||||
if(!registeredSteps.containsKey(request.getStep()))
|
if(!registeredSteps.containsKey(request.getStep()))
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class Default3PhaseManager extends SimpleLifeCycleManager implements Life
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static class STEPS{
|
public static final class STEPS{
|
||||||
public static final OperationDescriptor SUBMIT=new OperationDescriptor("SUBMIT-FOR-REVIEW","Submits the Draft for reviewing");
|
public static final OperationDescriptor SUBMIT=new OperationDescriptor("SUBMIT-FOR-REVIEW","Submits the Draft for reviewing");
|
||||||
public static final OperationDescriptor REJECT=new OperationDescriptor("REJECT-DRAFT","Rejects the submitted Draft");
|
public static final OperationDescriptor REJECT=new OperationDescriptor("REJECT-DRAFT","Rejects the submitted Draft");
|
||||||
public static final OperationDescriptor APPROVE=new OperationDescriptor("APPROVE-SUBMITTED","Approves the submitted Draft");
|
public static final OperationDescriptor APPROVE=new OperationDescriptor("APPROVE-SUBMITTED","Approves the submitted Draft");
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package org.gcube.application.cms.plugins;
|
package org.gcube.application.cms.plugins;
|
||||||
|
|
||||||
|
import org.gcube.application.cms.plugins.faults.StepException;
|
||||||
|
import org.gcube.application.cms.plugins.implementations.Default3PhaseManager;
|
||||||
|
import org.gcube.application.geoportal.common.model.plugins.OperationDescriptor;
|
||||||
|
|
||||||
public class SimpleLifecycleTests {
|
public class SimpleLifecycleTests {
|
||||||
|
|
||||||
// NB cannot use test commons, need to separate modules
|
// NB cannot use test commons, need to separate modules
|
||||||
|
@ -21,4 +25,26 @@ public class SimpleLifecycleTests {
|
||||||
// manager.performStep()
|
// manager.performStep()
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
System.out.println("Check start");
|
||||||
|
OperationDescriptor op = Default3PhaseManager.STEPS.APPROVE;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Check document phase
|
||||||
|
if (op.getAppliableToPhases() != null && !op.getAppliableToPhases().isEmpty()) {
|
||||||
|
String currentPhase = "Pending Approval";
|
||||||
|
if (!op.getAppliableToPhases().contains(currentPhase)) {
|
||||||
|
System.out.println("check KO");
|
||||||
|
throw new StepException(
|
||||||
|
"Document must be in one of the following phases : " + op.getAppliableToPhases());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("check OK");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue