public boolean canContinue() { return this.equals(IN_PROGRESS); }
private void addFinalMessage(final ComponentState component, final StateChangeContext stateChangeContext) { final StateChangeStatus status = stateChangeContext.getStatus(); if (SUCCESSFUL.equals(status)) { component.addMessage("states.messages.change.successful", MessageType.SUCCESS); } else if (PAUSED.equals(status)) { component.addMessage("states.messages.change.paused", MessageType.INFO); } else if (FAILURE.equals(status) && !hasFailureMessages(stateChangeContext.getAllMessages())) { component.addMessage("states.messages.change.failure", MessageType.FAILURE); } else if (CANCELED.equals(status)) { component.addMessage("states.messages.change.canceled", MessageType.INFO); } }
private void checkResults(final StateChangeContext stateChangeContext) { checkValidationErrors(stateChangeContext); if (StateChangeStatus.FAILURE.equals(stateChangeContext.getStatus())) { throw new StateChangeException("State change failed"); } }
public void validationOnAccepted(final StateChangeContext stateChangeContext) { final Entity technology = stateChangeContext.getOwner(); if (technology != null && !stateChangeContext.getStatus().equals(StateChangeStatus.FAILURE)) { checkIfForOneDivisionLocationIsSet(technology, stateChangeContext); checkIfLocationInOperationIsSet(technology, stateChangeContext); checkProductionFlowIsWithinProcess(technology, stateChangeContext); } }
public void validateTypeOfProductionRecordingForTechnology(final StateChangeContext stateChangeContext) { Entity technology = stateChangeContext.getOwner(); if (technology != null && !stateChangeContext.getStatus().equals(StateChangeStatus.FAILURE)) { EntityTree tree = technology.getTreeField(TechnologyFields.OPERATION_COMPONENTS); Entity mainProduct = technologyService.getMainOutputProductComponent(tree.getRoot()); String typeOfProductionRecording = technology.getStringField(TechnologyFieldsPC.TYPE_OF_PRODUCTION_RECORDING); if (mainProduct.getBooleanField(OperationProductOutComponentFields.SET) && typeOfProductionRecording.equals("03forEach")) { stateChangeContext.addValidationError("technologies.technology.technologyState.error.typeOfProductionRecording"); } } }
productionTracking.addGlobalMessage("productionCounting.order.orderClosed", false, false); } else if (StateChangeStatus.PAUSED.equals(orderStateChangeContext.getStatus())) { productionTracking.addGlobalMessage("productionCounting.order.orderWillBeClosedAfterExtSync", false, false);
public void validateTypeOfProductionRecordingForOrder(final StateChangeContext stateChangeContext) { if(parameterService.getParameter().getBooleanField(ParameterFieldsO.CREATE_SET_ELEMENTS_ON_ACCEPT)) { Entity order = stateChangeContext.getOwner(); Entity technology = order.getBelongsToField(OrderFields.TECHNOLOGY); if (technology != null && !stateChangeContext.getStatus().equals(StateChangeStatus.FAILURE)) { EntityTree tree = technology.getTreeField(TechnologyFields.OPERATION_COMPONENTS); Entity mainProduct = technologyService.getMainOutputProductComponent(tree.getRoot()); String typeOfProductionRecording = order.getStringField(OrderFieldsPC.TYPE_OF_PRODUCTION_RECORDING); if (typeOfProductionRecording != null && mainProduct.getBooleanField(OperationProductOutComponentFields.SET) && typeOfProductionRecording.equals("03forEach")) { stateChangeContext .addValidationError("technologies.technology.technologyState.error.typeOfProductionRecording"); } } } } }