use of com.qcadoo.mes.states.service.client.util.ViewContextHolder in project mes by qcadoo.
the class MaintenanceEventReasonViewListeners method continueStateChange.
public void continueStateChange(final ViewDefinitionState view, final ComponentState component, final String[] args) {
final FormComponent form = (FormComponent) component;
Entity eventStateChange = form.getPersistedEntityWithIncludedFormValues();
maintenanceEventStateChangeValidators.validate(eventStateChange.getDataDefinition(), eventStateChange);
form.setEntity(eventStateChange);
if (!eventStateChange.getErrors().isEmpty()) {
return;
}
form.performEvent(view, "save");
if (!form.isValid()) {
return;
}
final Entity stateChangeEntity = ((FormComponent) form).getEntity();
final StateChangeContext stateContext = stateChangeContextBuilder.build(maintenanceEventStateChangeAspect.getChangeEntityDescriber(), stateChangeEntity);
stateContext.setStatus(StateChangeStatus.IN_PROGRESS);
maintenanceEventStateChangeAspect.changeState(stateContext);
maintenanceEventStateChangeViewClient.showMessages(new ViewContextHolder(view, form), stateContext);
}
use of com.qcadoo.mes.states.service.client.util.ViewContextHolder in project mes by qcadoo.
the class MaintenanceEventReasonViewListeners method cancelStateChange.
public void cancelStateChange(final ViewDefinitionState view, final ComponentState form, final String[] args) {
final Entity stateChangeEntity = ((FormComponent) form).getEntity();
final StateChangeContext stateContext = stateChangeContextBuilder.build(maintenanceEventStateChangeAspect.getChangeEntityDescriber(), stateChangeEntity);
stateContext.setStatus(StateChangeStatus.CANCELED);
stateContext.save();
maintenanceEventStateChangeViewClient.showMessages(new ViewContextHolder(view, form), stateContext);
}
use of com.qcadoo.mes.states.service.client.util.ViewContextHolder in project mes by qcadoo.
the class CopyOfTechnologyDetailsListeners method checkTechnology.
public void checkTechnology(final ViewDefinitionState view, final ComponentState state, final String[] args) {
final FormComponent technologyForm = (FormComponent) state;
Long technologyId = (Long) state.getFieldValue();
if (technologyId != null) {
Entity technology1 = technologyServiceO.getTechnologyDD().get(technologyId);
Entity order = getOrderWithTechnology(view);
order = technologyServiceO.createTechnologyIfPktDisabled(order.getDataDefinition(), order);
Entity technology2 = order.getBelongsToField(OrderFields.TECHNOLOGY);
if (!Objects.equal(technology1.getId(), technology2.getId())) {
Map<String, Object> parameters = Maps.newHashMap();
parameters.put("form.id", technology2.getId());
parameters.put("form.orderId", order.getId());
String url = "../page/orders/copyOfTechnologyDetails.html";
view.redirectTo(url, false, false, parameters);
} else {
copyOfTechnologyStateChangeVC.changeState(new ViewContextHolder(view, technologyForm), args[0], technology2);
}
}
}
use of com.qcadoo.mes.states.service.client.util.ViewContextHolder in project mes by qcadoo.
the class OrderStateReasonViewListeners method cancelStateChange.
public void cancelStateChange(final ViewDefinitionState view, final ComponentState form, final String[] args) {
final Entity stateChangeEntity = ((FormComponent) form).getEntity();
stateChangeEntity.setField(REASON_REQUIRED, false);
final StateChangeContext stateContext = stateChangeContextBuilder.build(orderStateChangeService.getChangeEntityDescriber(), stateChangeEntity);
stateContext.setStatus(StateChangeStatus.CANCELED);
stateContext.save();
orderStateChangeViewClient.showMessages(new ViewContextHolder(view, form), stateContext);
}
use of com.qcadoo.mes.states.service.client.util.ViewContextHolder in project mes by qcadoo.
the class MaintenanceEventToPlannedEventListeners method cancelStateChange.
public void cancelStateChange(final ViewDefinitionState view, final ComponentState form, final String[] args) {
final Entity stateChangeEntity = ((FormComponent) form).getEntity();
final StateChangeContext stateContext = stateChangeContextBuilder.build(maintenanceEventStateChangeAspect.getChangeEntityDescriber(), stateChangeEntity);
stateContext.setStatus(StateChangeStatus.CANCELED);
stateContext.save();
maintenanceEventStateChangeViewClient.showMessages(new ViewContextHolder(view, form), stateContext);
}
Aggregations