use of com.qcadoo.mes.technologies.tree.domain.TechnologyOperationId in project mes by qcadoo.
the class TechnologyStructureTreeDataProvider method buildProductInfo.
private ProductInfo buildProductInfo(final Entity projection, final Map<ProductId, TechnologyId> defaultTechnologies) {
Optional<OperationProductInComponentId> opicId = Optional.ofNullable((Long) projection.getField("opicId")).map(OperationProductInComponentId::new);
TechnologyOperationId tocId = new TechnologyOperationId((Long) projection.getField("tocId"));
Optional<TechnologyOperationId> parentId = Optional.ofNullable((Long) projection.getField("parentId")).map(TechnologyOperationId::new);
ProductId productId = buildProduct(projection);
Optional<TechnologyId> prodTechnology = Optional.ofNullable(defaultTechnologies.get(productId));
Optional<TechnologyInputProductTypeId> technologyInputProductType = Optional.ofNullable((Long) projection.getField("technologyInputProductTypeId")).map(TechnologyInputProductTypeId::new);
boolean differentProductsInDifferentSizes = projection.getBooleanField("differentProductsInDifferentSizes");
boolean variousQuantitiesInProductsBySize = projection.getBooleanField("variousQuantitiesInProductsBySize");
OperationId operation = buildOperation(projection);
BigDecimal quantity = projection.getDecimalField("quantity");
boolean isIntermediate = projection.getBooleanField("isIntermediate");
String givenUnit = projection.getStringField("givenUnit");
Optional<SizeGroupId> sizeGroup = Optional.ofNullable((Long) projection.getField("sizeGroupId")).map(SizeGroupId::new);
return new ProductInfo(opicId, tocId, parentId, productId, quantity, prodTechnology, prodTechnology, technologyInputProductType, differentProductsInDifferentSizes, variousQuantitiesInProductsBySize, operation, isIntermediate, givenUnit, sizeGroup);
}
use of com.qcadoo.mes.technologies.tree.domain.TechnologyOperationId in project mes by qcadoo.
the class TreeGenerator method setUpTechnologyGeneratorAndPerformance.
private void setUpTechnologyGeneratorAndPerformance(final Entity entity, final ProductInfo productInfo) {
TechnologyOperationId tocId = productInfo.getTocId();
if (Objects.nonNull(tocId)) {
Entity tech = dataDefinitionService.get(TechnologiesConstants.PLUGIN_IDENTIFIER, TechnologiesConstants.MODEL_TECHNOLOGY_OPERATION_COMPONENT).get(tocId.get()).getBelongsToField(TechnologyOperationComponentFields.TECHNOLOGY);
if (Objects.nonNull(tech)) {
setBelongsToField(entity, GeneratorTreeNodeFields.TECHNOLOGY_GROUP, tech.getBelongsToField(TechnologyFields.TECHNOLOGY_GROUP));
entity.setField(GeneratorTreeNodeFields.STANDARD_PERFORMANCE, technologyService.getStandardPerformance(tech).orElse(null));
}
}
}
Aggregations