use of com.qcadoo.mes.technologiesGenerator.view.GeneratorView in project mes by qcadoo.
the class GeneratorViewListeners method generateTechnologies.
public void generateTechnologies(final ViewDefinitionState view, final ComponentState eventPerformer, final String[] args) {
GeneratorView generatorView = GeneratorView.from(view);
Entity context = generatorView.getFormEntity().getDataDefinition().get(generatorView.getFormEntity().getId());
context.setField(GeneratorContextFields.GENERATION_IN_PROGRSS, true);
context = context.getDataDefinition().save(context);
generatorView.setFormEntity(context);
view.addMessage("generator.technology.generationTechnologyStart", ComponentState.MessageType.INFO, false);
technologiesGeneratorForProductsService.performGeneration(generatorView);
}
use of com.qcadoo.mes.technologiesGenerator.view.GeneratorView in project mes by qcadoo.
the class GeneratorViewHooks method onBeforeRender.
public void onBeforeRender(final ViewDefinitionState view) {
GeneratorView generatorView = GeneratorView.from(view);
generateProductNumber(view);
showRibbonButtons(generatorView, view);
GridComponent grid = (GridComponent) view.getComponentByReference("generatorTechnologiesForProducts");
FilterValueHolder gridHolder = grid.getFilterValue();
gridHolder.put(TechnologiesForProductsCM.PARAMETER, generatorView.getFormEntity().getId());
grid.setFilterValue(gridHolder);
}
use of com.qcadoo.mes.technologiesGenerator.view.GeneratorView in project mes by qcadoo.
the class GeneratorViewListeners method tryPerformCustomization.
private Optional<Either<String, TechnologyId>> tryPerformCustomization(final GeneratorView generatorView, final Entity context) {
try {
Optional<Either<String, TechnologyId>> customizedTechId = Optional.ofNullable(context.getBelongsToField(GeneratorContextFields.PRODUCT)).flatMap(mainProduct -> generatorView.getSelectedNodeId().flatMap(nodeId -> technologyCustomizer.customize(nodeId, mainProduct, GeneratorSettings.from(context, parameterService.getParameter()), false)));
customizedTechId.ifPresent(cti -> {
if (cti.isRight()) {
TechnologyId technologyId = cti.getRight();
technologyCustomizer.addCustomizedProductToQualityCard(technologyId);
}
});
return customizedTechId;
} catch (Exception e) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("Cannot perform technology customization due to unexpected error", e);
}
return Optional.of(Either.left("Cannot perform technology customization due to unexpected error"));
}
}
use of com.qcadoo.mes.technologiesGenerator.view.GeneratorView in project mes by qcadoo.
the class GeneratorViewListeners method generateTree.
public void generateTree(final ViewDefinitionState view, final ComponentState eventPerformer, final String[] args) {
GeneratorView generatorView = GeneratorView.from(view);
Either<String, ContextId> generationResults = generate(generatorView, false);
if (generationResults.isRight()) {
generatorView.showStructureTreeTab();
}
}
Aggregations