use of com.qcadoo.mes.states.annotation.RunForStateTransition in project mes by qcadoo.
the class TechnologyMasterAcceptingAspect method postHookOnAccepting.
@RunForStateTransition(targetState = TechnologyStateStringValues.ACCEPTED)
@After(CHANGE_STATE_EXECUTION_POINTCUT)
public void postHookOnAccepting(final StateChangeContext stateChangeContext) {
Entity parameter = parameterService.getParameter();
if (parameter.getBooleanField(ParameterFieldsT.ACCEPTED_TECHNOLOGY_MARKED_AS_DEFAULT)) {
Entity owner = stateChangeContext.getOwner();
owner.setField(TechnologyFields.MASTER, true);
owner.getDataDefinition().save(owner);
}
}
use of com.qcadoo.mes.states.annotation.RunForStateTransition in project mes by qcadoo.
the class DeliveryStateValidationAspectTest method shouldPreValidationOnReceivedMethodBeCorrectlyAnnotated.
@Test
public final void shouldPreValidationOnReceivedMethodBeCorrectlyAnnotated() throws SecurityException, NoSuchMethodException {
Method preValidationOnReceive = clazz.getMethod("preValidationOnReceived", StateChangeContext.class, int.class);
assertNotNull(preValidationOnReceive);
RunForStateTransitions transitions = preValidationOnReceive.getAnnotation(RunForStateTransitions.class);
assertNotNull(transitions);
assertEquals(2, transitions.value().length);
RunForStateTransition firstTransition = transitions.value()[0];
assertEquals(firstTransition.sourceState(), DeliveryStateStringValues.APPROVED);
assertEquals(firstTransition.targetState(), DeliveryStateStringValues.RECEIVED);
RunForStateTransition secondTransition = transitions.value()[1];
assertEquals(secondTransition.sourceState(), DeliveryStateStringValues.APPROVED);
assertEquals(secondTransition.targetState(), DeliveryStateStringValues.RECEIVE_CONFIRM_WAITING);
RunInPhase runInPhase = preValidationOnReceive.getAnnotation(RunInPhase.class);
assertNotNull(runInPhase);
assertEquals(DeliveryStateChangePhase.PRE_VALIDATION, runInPhase.value()[0]);
Before before = preValidationOnReceive.getAnnotation(Before.class);
assertNotNull(before);
}
use of com.qcadoo.mes.states.annotation.RunForStateTransition in project mes by qcadoo.
the class AssignmentToShiftListenerAspect method onCorrectedAfterAllOtherOpsSuccessfullyDone.
@RunInPhase(AssignmentToShiftStateChangePhase.LAST)
@RunForStateTransition(sourceState = AssignmentToShiftStateStringValues.DURING_CORRECTION, targetState = AssignmentToShiftStateStringValues.CORRECTED)
@After(PHASE_EXECUTION_POINTCUT)
public void onCorrectedAfterAllOtherOpsSuccessfullyDone(final StateChangeContext stateChangeContext, final int phase) {
Entity assignmentToShift = stateChangeContext.getOwner();
assignmentToShift.setField(AssignmentToShiftFields.STAFF_ASSIGNMENT_TO_SHIFTS, assignmentToShiftListenerService.addCorrectedStaffsListToAssignment(assignmentToShift));
assignmentToShiftConfirmationStatusHelper.setShowLastResultsFlag(assignmentToShift, true);
stateChangeContext.setOwner(assignmentToShift);
}
use of com.qcadoo.mes.states.annotation.RunForStateTransition in project mes by qcadoo.
the class AssignmentToShiftListenerAspect method onLeaveDraftStateAfterValidation.
@RunInPhase(AssignmentToShiftStateChangePhase.DEFAULT)
@RunForStateTransition(sourceState = AssignmentToShiftStateStringValues.DRAFT)
@Before(PHASE_EXECUTION_POINTCUT)
public void onLeaveDraftStateAfterValidation(final StateChangeContext stateChangeContext, final int phase) {
Entity assignmentToShift = stateChangeContext.getOwner();
assignmentToShiftConfirmationStatusHelper.clearFailureInfo(assignmentToShift);
stateChangeContext.setOwner(assignmentToShift);
}
use of com.qcadoo.mes.states.annotation.RunForStateTransition in project mes by qcadoo.
the class AssignmentToShiftListenerAspect method onAcceptedAfterAllOtherOpsSuccessfullyDone.
@RunInPhase(AssignmentToShiftStateChangePhase.LAST)
@RunForStateTransition(sourceState = AssignmentToShiftStateStringValues.DRAFT, targetState = AssignmentToShiftStateStringValues.ACCEPTED)
@After(PHASE_EXECUTION_POINTCUT)
public void onAcceptedAfterAllOtherOpsSuccessfullyDone(final StateChangeContext stateChangeContext, final int phase) {
Entity assignmentToShift = stateChangeContext.getOwner();
assignmentToShift.setField(AssignmentToShiftFields.STAFF_ASSIGNMENT_TO_SHIFTS, assignmentToShiftListenerService.addAcceptedStaffsListToAssignment(assignmentToShift));
assignmentToShift.setField(AssignmentToShiftFields.APPROVED_ATTENDANCE_LIST, true);
assignmentToShiftConfirmationStatusHelper.setShowLastResultsFlag(assignmentToShift, true);
stateChangeContext.setOwner(assignmentToShift);
}
Aggregations