@Override public void fillWithDimensionItem(Segment segment, DimensionItem dimensionItem) { StorageElementLink storageElementLink = ((SheetDimentionItem) dimensionItem).getStorageElementLink(); Board board = (Board) storageElementLink.getStoreElement(); segment.setMaterialLength(board.getLength()); segment.setMaterialWidth(board.getWidth()); int length = FacadeContext.getCutterFacade() .trim(dimensionItem.getDimension(), board.getBoardDef().getCutter()) .getWidth(); int width = FacadeContext.getCutterFacade() .trim(dimensionItem.getDimension(), board.getBoardDef().getCutter()) .getHeight(); if (storageElementLink.getStripsEntity() instanceof StripsEntity) { length -= board.getBoardDef().getReservedLength().intValue(); width -= board.getBoardDef().getReservedLength().intValue(); } segment.setLength(length); segment.setWidth(width); }
@Override protected Criteria createCriteria(Board template) { Criteria criteria = super.createCriteria(template); if (template.getBoardDef() != null) { criteria .createCriteria(Board.PROPERTY_priceAware) .add(Example.create(template.getBoardDef())); } if (template.getTexture() != null) { criteria.createCriteria(Board.PROPERTY_priced).add(Example.create(template.getTexture())); } return criteria; }