private static void collectMetadataView(ViewRef viewRef, ProductManager productManager, ArrayList<ProductNodeView> views) throws Exception { Product product = productManager.getProductByRefNo(viewRef.productRefNo); if (product != null) { String[] productNodeNames = viewRef.productNodeName.split("\\|"); MetadataElement element = product.getMetadataRoot(); for (int i = productNodeNames.length - 1; i >= 0; i--) { if (element == null) { break; } element = element.getElement(productNodeNames[i]); } if (element != null) { ProductMetadataView metadataView = new ProductMetadataView(element); Rectangle bounds = viewRef.bounds; if (bounds != null && !bounds.isEmpty()) { metadataView.setBounds(bounds); } views.add(metadataView); } } else { throw new Exception("Unknown product reference number: " + viewRef.productRefNo); } }
@Override public final T convertDomToValue(DomElement parentElement, Object value) throws ConversionException, ValidationException { final DomElement refNoElement = parentElement.getChild("refNo"); if (refNoElement == null) { throw new ConversionException(String.format( "In parent element '%s': no child element 'refNo'", parentElement.getName())); } final Integer refNo; try { refNo = Integer.valueOf(refNoElement.getValue()); } catch (NumberFormatException e) { throw new ConversionException(String.format( "In parent element '%s': %s", parentElement.getName(), e.getMessage())); } final Product product = productManager.getProductByRefNo(refNo); if (product == null) { throw new ConversionException(String.format( "In parent element '%s': no product with refNo = %d", parentElement.getName(), refNo)); } return getProductNode(parentElement, product); }
PropertyMap applicationPreferences, ProgressMonitor pm) throws Exception { Product product = productManager.getProductByRefNo(viewRef.productRefNo); if (product == null) { throw new Exception("Unknown product reference number: " + viewRef.productRefNo);