public boolean isEntityTypeSame(final String operationProductComponentModelName) { return isEntityTypeSame(OperationProductComponentEntityType.parseString(operationProductComponentModelName)); }
private String getRole(final OperationProductComponentHolder operationProductComponentHolder) { if (operationProductComponentHolder.isEntityTypeSame(TechnologiesConstants.MODEL_OPERATION_PRODUCT_IN_COMPONENT)) { return ProductionCountingQuantityRole.USED.getStringValue(); } else if (operationProductComponentHolder .isEntityTypeSame(TechnologiesConstants.MODEL_OPERATION_PRODUCT_OUT_COMPONENT)) { return ProductionCountingQuantityRole.PRODUCED.getStringValue(); } else { return ProductionCountingQuantityRole.USED.getStringValue(); } }
private OperationProductComponentWithQuantityContainer getAllWithSameEntityType( final OperationProductComponentEntityType operationProductComponentEntityType) { OperationProductComponentWithQuantityContainer allWithSameType = new OperationProductComponentWithQuantityContainer(); for (Entry<OperationProductComponentHolder, BigDecimal> operationProductComponentWithQuantity : operationProductComponentWithQuantities .entrySet()) { OperationProductComponentHolder operationProductComponentHolder = operationProductComponentWithQuantity.getKey(); if (operationProductComponentHolder.isEntityTypeSame(operationProductComponentEntityType)) { BigDecimal quantity = operationProductComponentWithQuantity.getValue(); allWithSameType.put(operationProductComponentHolder, quantity); } } return allWithSameType; }
public boolean isOperationProductComponentToRegister(OperationProductComponentHolder operationProductComponentHolder, Entity product, Entity toc) { if (operationProductComponentHolder.isEntityTypeSame(TechnologiesConstants.MODEL_OPERATION_PRODUCT_IN_COMPONENT)) { Entity opic = getOperationComponentForProductAndToc(product, toc, TechnologyOperationComponentFields.OPERATION_PRODUCT_IN_COMPONENTS); if (opic != null && opic.getStringField(OperationProductInComponentFieldsPFTD.PRODUCTION_FLOW).equals( ProductionFlowComponent.WITHIN_THE_PROCESS.getStringValue())) { return false; } else if (opic == null && flowWithinTheProcess(operationProductComponentHolder)) { return false; } } else if (operationProductComponentHolder.isEntityTypeSame(TechnologiesConstants.MODEL_OPERATION_PRODUCT_OUT_COMPONENT)) { Entity opoc = getOperationComponentForProductAndToc(product, toc, TechnologyOperationComponentFields.OPERATION_PRODUCT_OUT_COMPONENTS); if (opoc != null && opoc.getStringField(OperationProductInComponentFieldsPFTD.PRODUCTION_FLOW).equals( ProductionFlowComponent.WITHIN_THE_PROCESS.getStringValue())) { return false; } } return true; }