Search in sources :

Example 1 with ModifyTechnologyResult

use of com.qcadoo.mes.technologies.dto.ModifyTechnologyResult in project mes by qcadoo.

the class ModifyTechnologyListeners method createTechnologies.

public void createTechnologies(final ViewDefinitionState view, final ComponentState componentState, final String[] args) {
    componentState.performEvent(view, L_SAVE, args);
    CheckBoxComponent generated = (CheckBoxComponent) view.getComponentByReference(L_GENERATED);
    FormComponent formComponent = (FormComponent) view.getComponentByReference(QcadooViewConstants.L_FORM);
    if (!formComponent.isValid()) {
        return;
    }
    Entity mt = formComponent.getEntity().getDataDefinition().get(formComponent.getEntityId());
    ModifyTechnologyResult modifyTechnologyResult = new ModifyTechnologyResult();
    createModifiedTechnology(view, componentState, mt, modifyTechnologyResult);
    if (!modifyTechnologyResult.getCreatedTechnologies().isEmpty()) {
        view.addMessage("technologies.modifyTechnology.createdTechnologies", ComponentState.MessageType.SUCCESS, String.join(",", modifyTechnologyResult.getCreatedTechnologies()));
    }
    if (!modifyTechnologyResult.getNotCreatedTechnologies().isEmpty()) {
        view.addMessage("technologies.modifyTechnology.notCreatedTechnologies", ComponentState.MessageType.FAILURE, String.join(",", modifyTechnologyResult.getNotCreatedTechnologies()));
    }
    generated.setChecked(true);
}
Also used : FormComponent(com.qcadoo.view.api.components.FormComponent) Entity(com.qcadoo.model.api.Entity) ModifyTechnologyResult(com.qcadoo.mes.technologies.dto.ModifyTechnologyResult) CheckBoxComponent(com.qcadoo.view.api.components.CheckBoxComponent)

Aggregations

ModifyTechnologyResult (com.qcadoo.mes.technologies.dto.ModifyTechnologyResult)1 Entity (com.qcadoo.model.api.Entity)1 CheckBoxComponent (com.qcadoo.view.api.components.CheckBoxComponent)1 FormComponent (com.qcadoo.view.api.components.FormComponent)1