public boolean containsKey(final Entity operationProductComponent) { Preconditions.checkNotNull(operationProductComponent, L_MISSING_OPERATION_PRODUCT_COMPONENT_ENTITY); OperationProductComponentHolder operationProductComponentHolder = new OperationProductComponentHolder( operationProductComponent); return containsKey(operationProductComponentHolder); }
public BigDecimal get(final Entity operationProductComponent) { Preconditions.checkNotNull(operationProductComponent, L_MISSING_OPERATION_PRODUCT_COMPONENT_ENTITY); OperationProductComponentHolder operationProductComponentHolder = new OperationProductComponentHolder( operationProductComponent); return get(operationProductComponentHolder); }
public void remove(final Entity operationProductComponent) { Preconditions.checkNotNull(operationProductComponent, L_MISSING_OPERATION_PRODUCT_COMPONENT_ENTITY); OperationProductComponentHolder operationProductComponentHolder = new OperationProductComponentHolder( operationProductComponent); remove(operationProductComponentHolder); }
public void put(final Entity operationProductComponent, final BigDecimal quantity) { Preconditions.checkNotNull(operationProductComponent, L_MISSING_OPERATION_PRODUCT_COMPONENT_ENTITY); OperationProductComponentHolder operationProductComponentHolder = new OperationProductComponentHolder( operationProductComponent); put(operationProductComponentHolder, quantity); }
private void fillNonComponents(final Set<OperationProductComponentHolder> nonComponents, final Entity order) { List<Entity> productionCountingQuantities = dataDefinitionService .get(BasicProductionCountingConstants.PLUGIN_IDENTIFIER, BasicProductionCountingConstants.MODEL_PRODUCTION_COUNTING_QUANTITY).find() .add(SearchRestrictions.belongsTo(ProductionCountingQuantityFields.ORDER, order)) .add(SearchRestrictions.eq(ProductionCountingQuantityFields.IS_NON_COMPONENT, true)).list().getEntities(); for (Entity productionCountingQuantity : productionCountingQuantities) { Entity technologyOperationComponent = productionCountingQuantity .getBelongsToField(ProductionCountingQuantityFields.TECHNOLOGY_OPERATION_COMPONENT); Entity product = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.PRODUCT); String role = productionCountingQuantity.getStringField(ProductionCountingQuantityFields.ROLE); OperationProductComponentEntityType entityType = getEntityType(role); ProductMaterialType productMaterialType = ProductMaterialType.parseString( productionCountingQuantity.getStringField(ProductionCountingQuantityFields.TYPE_OF_MATERIAL)); OperationProductComponentHolder operationProductComponentHolder = new OperationProductComponentHolder(product, technologyOperationComponent, productionCountingQuantity, entityType, productMaterialType); nonComponents.add(operationProductComponentHolder); } }
nonComponents.add(new OperationProductComponentHolder(operationProductInComponent));
nonComponents.add(new OperationProductComponentHolder(operationProductInComponent));
private OperationProductComponentWithQuantityContainer getProductComponentWithQuantities(final Entity order) { OperationProductComponentWithQuantityContainer productComponentWithQuantities = new OperationProductComponentWithQuantityContainer(); List<Entity> productionCountingQuantities = dataDefinitionService .get(BasicProductionCountingConstants.PLUGIN_IDENTIFIER, BasicProductionCountingConstants.MODEL_PRODUCTION_COUNTING_QUANTITY).find() .add(SearchRestrictions.belongsTo(ProductionCountingQuantityFields.ORDER, order)).list().getEntities(); for (Entity productionCountingQuantity : productionCountingQuantities) { Entity technologyOperationComponent = productionCountingQuantity .getBelongsToField(ProductionCountingQuantityFields.TECHNOLOGY_OPERATION_COMPONENT); Entity product = productionCountingQuantity.getBelongsToField(ProductionCountingQuantityFields.PRODUCT); String role = productionCountingQuantity.getStringField(ProductionCountingQuantityFields.ROLE); BigDecimal plannedQuantity = productionCountingQuantity .getDecimalField(ProductionCountingQuantityFields.PLANNED_QUANTITY); OperationProductComponentEntityType entityType = getEntityType(role); ProductMaterialType productMaterialType = ProductMaterialType.parseString(productionCountingQuantity.getStringField(ProductionCountingQuantityFields.TYPE_OF_MATERIAL)); OperationProductComponentHolder operationProductComponentHolder = new OperationProductComponentHolder(product, technologyOperationComponent, productionCountingQuantity, entityType, productMaterialType); productComponentWithQuantities.put(operationProductComponentHolder, plannedQuantity); } return productComponentWithQuantities; }