use of com.qcadoo.mes.technologiesGenerator.domain.ContextId in project mes by qcadoo.
the class GeneratorViewListeners method performGeneration.
private Either<String, ContextId> performGeneration(final GeneratorView generatorView, final Entity savedContext, boolean applyCustomized) {
Either<String, ContextId> generationRes = treeGenerator.generate(savedContext, GeneratorSettings.from(savedContext, parameterService.getParameter()), applyCustomized);
if (generationRes.isRight()) {
Entity updatedContext = savedContext.getDataDefinition().get(savedContext.getId());
generatorView.setFormEntity(updatedContext);
generatorView.showGenerationSuccessMsg();
} else {
generatorView.showErrorMsg("technologiesGenerator.generate.error.problemDuringStructureGeneration");
}
return generationRes;
}
use of com.qcadoo.mes.technologiesGenerator.domain.ContextId in project mes by qcadoo.
the class TechnologyStructureTreeDataProvider method findExistingCustomizedNodes.
public Map<TechnologyId, Entity> findExistingCustomizedNodes(final ContextId contextId) {
if (Objects.isNull(contextId)) {
return ImmutableMap.of();
}
SearchCriteriaBuilder scb = prepareExistingNodeSearchCriteria(contextId);
List<Entity> existingNodes = scb.list().getEntities();
return ImmutableMap.copyOf(Maps.uniqueIndex(existingNodes, n -> new TechnologyId(n.getBelongsToField(GeneratorTreeNodeFields.ORIGINAL_TECHNOLOGY).getId())));
}
use of com.qcadoo.mes.technologiesGenerator.domain.ContextId 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();
}
}
use of com.qcadoo.mes.technologiesGenerator.domain.ContextId in project mes by qcadoo.
the class TreeGenerator method performGeneration.
private Either<String, ContextId> performGeneration(final Entity context, final GeneratorSettings settings, boolean applyCustomized) {
Entity technology = context.getBelongsToField(GeneratorContextFields.TECHNOLOGY);
TechnologyId technologyId = new TechnologyId(technology.getId());
ContextId contextId = new ContextId(context.getId());
Map<OperationProductKey, Long> customizedOperationProductTechnologies = getCustomizedTechnologies(context, applyCustomized);
Either<String, TechnologyStructureNode> mRoot = tryBuildStructure(settings, technologyId, contextId);
Either<String, Entity> generationResults = mRoot.flatMap(root -> regenerateNodes(context, root).flatMap(x -> markContextAsGenerated(contextId)));
if (applyCustomized) {
updateNodesToCustomized(context, customizedOperationProductTechnologies);
}
logResults(generationResults);
return generationResults.map(Entity::getId).map(ContextId::new);
}
Aggregations