Search in sources :

Example 1 with StateChangeService

use of com.qcadoo.mes.states.service.StateChangeService in project mes by qcadoo.

the class StateChangeSamplesClientImpl method resumeStateChange.

@Override
public void resumeStateChange(final Entity entity, final Entity stateChangeEntity) {
    entity.getDataDefinition().save(entity);
    final StateChangeService stateChangeService = stateChangeServiceResolver.get(entity.getDataDefinition());
    if (stateChangeService != null) {
        final StateChangeEntityDescriber describer = stateChangeService.getChangeEntityDescriber();
        final StateChangeContext stateChangeContext = stateChangeContextBuilder.build(describer, stateChangeEntity);
        stateChangeContext.setStatus(StateChangeStatus.IN_PROGRESS);
        stateChangeService.changeState(stateChangeContext);
        checkResults(stateChangeContext);
    }
}
Also used : StateChangeEntityDescriber(com.qcadoo.mes.states.StateChangeEntityDescriber) StateChangeService(com.qcadoo.mes.states.service.StateChangeService) StateChangeContext(com.qcadoo.mes.states.StateChangeContext)

Example 2 with StateChangeService

use of com.qcadoo.mes.states.service.StateChangeService in project mes by qcadoo.

the class StateChangeSamplesClientImpl method changeState.

@Override
public Entity changeState(final Entity entity, final String targetState) {
    Entity resultEntity = null;
    final StateChangeService stateChangeService = stateChangeServiceResolver.get(entity.getDataDefinition());
    if (stateChangeService == null) {
        resultEntity = performDummyChange(entity, targetState);
    } else {
        resultEntity = performChange(stateChangeService, entity, targetState);
    }
    return resultEntity;
}
Also used : Entity(com.qcadoo.model.api.Entity) StateChangeService(com.qcadoo.mes.states.service.StateChangeService)

Aggregations

StateChangeService (com.qcadoo.mes.states.service.StateChangeService)2 StateChangeContext (com.qcadoo.mes.states.StateChangeContext)1 StateChangeEntityDescriber (com.qcadoo.mes.states.StateChangeEntityDescriber)1 Entity (com.qcadoo.model.api.Entity)1