use of com.qcadoo.mes.technologiesGenerator.domain.TechnologyStructureNode 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