private OperationProductComponentWithQuantityContainer getProductComponentWithQuantitiesWithoutNonComponents( final OperationProductComponentWithQuantityContainer productComponentWithQuantities, final Set<OperationProductComponentHolder> nonComponents) { for (OperationProductComponentHolder nonComponent : nonComponents) { productComponentWithQuantities.remove(nonComponent); } return productComponentWithQuantities; }
public void remove(final Entity operationProductComponent) { Preconditions.checkNotNull(operationProductComponent, L_MISSING_OPERATION_PRODUCT_COMPONENT_ENTITY); OperationProductComponentHolder operationProductComponentHolder = new OperationProductComponentHolder( operationProductComponent); remove(operationProductComponentHolder); }
public OperationProductComponentWithQuantityContainer getProductComponentWithQuantitiesWithoutNonComponents( final OperationProductComponentWithQuantityContainer productComponentWithQuantities, final Set<OperationProductComponentHolder> nonComponents) { for (OperationProductComponentHolder nonComponent : nonComponents) { Entity product = nonComponent.getProduct(); Entity technologyOperationComponent = nonComponent.getTechnologyOperationComponent(); if (technologyOperationComponent != null) { List<Entity> children = technologyOperationComponent.getHasManyField(TechnologyOperationComponentFields.CHILDREN) .find().add(SearchRestrictions.eq(TechnologyOperationComponentFieldsTS.IS_SUBCONTRACTING, true)).list() .getEntities(); boolean isSubcontracting = false; for (Entity child : children) { Entity operationProductOutComponent = child .getHasManyField(TechnologyOperationComponentFields.OPERATION_PRODUCT_OUT_COMPONENTS).find() .add(SearchRestrictions.belongsTo(OperationProductOutComponentFields.PRODUCT, product)) .setMaxResults(1).uniqueResult(); if (operationProductOutComponent != null) { isSubcontracting = true; } } if (!isSubcontracting) { productComponentWithQuantities.remove(nonComponent); } } } return productComponentWithQuantities; }