Package org.apache.oodt.profile

Examples of org.apache.oodt.profile.RangedProfileElement


    return p;
  }
 
  private ProfileElement makeProfileElementFromTreeNode(Profile theProfile,DefaultMutableTreeNode tn){
   
    ProfileElement theProfileElement = new RangedProfileElement(theProfile);
   
    DefaultMutableTreeNode commentRoot = (DefaultMutableTreeNode)tn.getChildAt(0);
    DefaultMutableTreeNode descRoot = (DefaultMutableTreeNode)tn.getChildAt(1);
    DefaultMutableTreeNode idRoot = (DefaultMutableTreeNode)tn.getChildAt(2);
    DefaultMutableTreeNode moRoot = (DefaultMutableTreeNode)tn.getChildAt(3);
    DefaultMutableTreeNode synRoot = (DefaultMutableTreeNode)tn.getChildAt(4);
    DefaultMutableTreeNode typeRoot = (DefaultMutableTreeNode)tn.getChildAt(5);
    DefaultMutableTreeNode unitRoot = (DefaultMutableTreeNode)tn.getChildAt(6);
   
    DefaultMutableTreeNode pe_Comments = (DefaultMutableTreeNode)commentRoot.getChildAt(0);
    DefaultMutableTreeNode pe_desc = (DefaultMutableTreeNode)descRoot.getChildAt(0);
    DefaultMutableTreeNode pe_id = (DefaultMutableTreeNode)idRoot.getChildAt(0);
    DefaultMutableTreeNode pe_mo = (DefaultMutableTreeNode)moRoot.getChildAt(0);
    DefaultMutableTreeNode pe_type = (DefaultMutableTreeNode)typeRoot.getChildAt(0);
    DefaultMutableTreeNode pe_unit = (DefaultMutableTreeNode)unitRoot.getChildAt(0);
   
    addElementsFromTreeNode(synRoot,theProfileElement.getSynonyms());
   
    theProfileElement.setName((String)tn.getUserObject());
    theProfileElement.setComments((String)pe_Comments.getUserObject());
    theProfileElement.setDescription((String)pe_desc.getUserObject());
    theProfileElement.setID((String)pe_id.getUserObject());
    theProfileElement.setMaxOccurrence(Integer.parseInt((String)pe_mo.getUserObject()));
    theProfileElement.setType((String)pe_type.getUserObject());
    theProfileElement.setUnit((String)pe_unit.getUserObject());
   
    return theProfileElement;
   
    //return new RangedProfileElement(new Profile());
  }
View Full Code Here


    this.conf = conf;
  }

  public RangedProfileElement extractRangedProfileElement(String elemName, String varname,
      Profile profile, DAS das) throws NoSuchAttributeException {
    RangedProfileElement elem = new RangedProfileElement(profile);
    elem.setName(elemName);
    AttributeTable attTable = null;
    try {
      attTable = das.getAttributeTable(varname);
     
      // make variable names case insensitive
      if(attTable == null) attTable = das.getAttributeTable(varname.toLowerCase());
      if(attTable == null) attTable = das.getAttributeTable(varname.toUpperCase());
      if(attTable == null) throw new NoSuchAttributeException("Att table for ["+varname+"] is null!");
    } catch (NoSuchAttributeException e) {
      e.printStackTrace();
      LOG.log(Level.WARNING, "Error extracting attribute table for element: ["
          + elemName + "]: Message: " + e.getMessage());
      throw e;

    }

    Enumeration attributeNames = attTable.getNames();

    while (attributeNames.hasMoreElements()) {
      String attrName = (String) attributeNames.nextElement();
      Attribute attr = attTable.getAttribute(attrName);
    
      if (!attr.isContainer()) {
         Enumeration attrValues = null;
       
          try {
            attrValues = attr.getValues();
          } catch (NoSuchAttributeException e) {
            e.printStackTrace();
            LOG.log(Level.WARNING, "Attempt to resolve attribute: [" + attrName
                + "] failed: Message: " + e.getMessage());
            continue;
         }
 
        while (attrValues.hasMoreElements()) {
          String attrValue = (String) attrValues.nextElement();
          if (attrName.equals(ACTUAL_RANGE)) {
            elem.setMinValue(attrValue);
            if (attrValues.hasMoreElements()) {
              elem.setMaxValue((String) attrValues.nextElement());
            }
          } else if (attrName.equals(UNITS)) {
            elem.setUnit(attrValue);
          } else if (attrName.equals(START)) {
            elem.setMinValue(attrValue);
          } else if (attrName.equals(END)) {
            elem.setMaxValue(attrValue);
          }
        }
      }
     
    } // not a container attribute
View Full Code Here

    this.conf = conf;
  }

  public RangedProfileElement extractRangedProfileElement(String elemName, String varname,
      Profile profile, DAS das) throws NoSuchAttributeException {
    RangedProfileElement elem = new RangedProfileElement(profile);
    elem.setName(elemName);
    AttributeTable attTable = null;
    try {
      attTable = das.getAttributeTable(varname);
     
      // make variable names case insensitive
      if(attTable == null) attTable = das.getAttributeTable(varname.toLowerCase());
      if(attTable == null) attTable = das.getAttributeTable(varname.toUpperCase());
      if(attTable == null) throw new NoSuchAttributeException("Att table for ["+varname+"] is null!");
    } catch (NoSuchAttributeException e) {
      e.printStackTrace();
      LOG.log(Level.WARNING, "Error extracting attribute table for element: ["
          + elemName + "]: Message: " + e.getMessage());
      throw e;

    }

    Enumeration attributeNames = attTable.getNames();

    while (attributeNames.hasMoreElements()) {
      String attrName = (String) attributeNames.nextElement();
      Attribute attr = attTable.getAttribute(attrName);
      Enumeration attrValues = null;
      try {
        attrValues = attr.getValues();
      } catch (NoSuchAttributeException e) {
        e.printStackTrace();
        LOG.log(Level.WARNING, "Attempt to resolve attribute: [" + attrName
            + "] failed: Message: " + e.getMessage());
        continue;
      }

      while (attrValues.hasMoreElements()) {
        String attrValue = (String) attrValues.nextElement();
        if (attrName.equals(ACTUAL_RANGE)) {
          elem.setMinValue(attrValue);
          if (attrValues.hasMoreElements()) {
            elem.setMaxValue((String) attrValues.nextElement());
          }
        } else if (attrName.equals(UNITS)) {
          elem.setUnit(attrValue);
        } else if (attrName.equals(START)) {
          elem.setMinValue(attrValue);
        } else if (attrName.equals(END)) {
          elem.setMaxValue(attrValue);
        }
      }
    }
    return elem;
  }
View Full Code Here

    this.conf = conf;
  }

  public RangedProfileElement extractRangedProfileElement(String elemName, String varname,
      Profile profile, DAS das) throws NoSuchAttributeException {
    RangedProfileElement elem = new RangedProfileElement(profile);
    elem.setName(elemName);
    AttributeTable attTable = null;
    try {
      attTable = das.getAttributeTable(varname);
     
      // make variable names case insensitive
      if(attTable == null) attTable = das.getAttributeTable(varname.toLowerCase());
      if(attTable == null) attTable = das.getAttributeTable(varname.toUpperCase());
      if(attTable == null) throw new NoSuchAttributeException("Att table for ["+varname+"] is null!");
    } catch (NoSuchAttributeException e) {
      e.printStackTrace();
      LOG.log(Level.WARNING, "Error extracting attribute table for element: ["
          + elemName + "]: Message: " + e.getMessage());
      throw e;

    }

    Enumeration attributeNames = attTable.getNames();

    while (attributeNames.hasMoreElements()) {
      String attrName = (String) attributeNames.nextElement();
      Attribute attr = attTable.getAttribute(attrName);
    
      if (!attr.isContainer()) {
         Enumeration attrValues = null;
       
          try {
            attrValues = attr.getValues();
          } catch (NoSuchAttributeException e) {
            e.printStackTrace();
            LOG.log(Level.WARNING, "Attempt to resolve attribute: [" + attrName
                + "] failed: Message: " + e.getMessage());
            continue;
         }
 
        while (attrValues.hasMoreElements()) {
          String attrValue = (String) attrValues.nextElement();
          if (attrName.equals(ACTUAL_RANGE)) {
            elem.setMinValue(attrValue);
            if (attrValues.hasMoreElements()) {
              elem.setMaxValue((String) attrValues.nextElement());
            }
          } else if (attrName.equals(UNITS)) {
            elem.setUnit(attrValue);
          } else if (attrName.equals(START)) {
            elem.setMinValue(attrValue);
          } else if (attrName.equals(END)) {
            elem.setMaxValue(attrValue);
          }
        }
      }
     
    } // not a container attribute
View Full Code Here

TOP

Related Classes of org.apache.oodt.profile.RangedProfileElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.