Exemple #1
0
  private void updateMetadata() {
    final Product targetProduct = super.getTargetProduct();
    final MetadataElement root = targetProduct.getMetadataRoot();
    if (root == null) {
      return;
    }
    MetadataElement abstractedMetadata = root.getElement("Abstracted_Metadata");
    if (abstractedMetadata == null) {
      return;
    }
    MetadataElement productElem = abstractedMetadata.getElement("Product_Information");
    if (productElem == null) {
      productElem = new MetadataElement("Product_Information");
      abstractedMetadata.addElement(productElem);
    }
    MetadataElement inputElem = productElem.getElement("InputProducts");
    if (inputElem == null) {
      inputElem = new MetadataElement("InputProducts");
      productElem.addElement(inputElem);
    }

    final MetadataAttribute[] inputProductAttrbList = inputElem.getAttributes();
    boolean found = false;
    for (MetadataAttribute attrib : inputProductAttrbList) {
      if (attrib.getData().getElemString().equals(targetProduct.getName())) found = true;
    }
    if (!found) {
      final MetadataAttribute inputAttrb =
          addAttribute(inputElem, "InputProduct", ProductData.TYPE_ASCII, "", "");
      inputAttrb.getData().setElems(targetProduct.getName());
    }
  }
Exemple #2
0
 public static MetadataAttribute addAttribute(
     final MetadataElement dest,
     final String tag,
     final int dataType,
     final String unit,
     final String desc) {
   final MetadataAttribute attribute = new MetadataAttribute(tag, dataType, 1);
   attribute.setUnit(unit);
   attribute.setDescription(desc);
   attribute.setReadOnly(true);
   dest.addAttribute(attribute);
   return attribute;
 }