Esempio n. 1
0
  /**
   * This method looks through the set of keyed reference objects for the one that is specified.
   * Once it finds it, it extracts the keyValue and returns it.
   *
   * @param oaKeys The keys to be searched.
   * @param sDesiredKey The key to look for.
   * @return The values associated with that key.
   */
  protected List<String> findAndGetValueFromKeyedReference(
      List<KeyedReference> oaKeys, String sDesiredKey) {
    List<String> oValues = new ArrayList<String>();

    if ((oaKeys != null) && (oaKeys.size() > 0)) {
      for (KeyedReference oKey : oaKeys) {
        if ((oKey.getTModelKey() != null)
            && (oKey.getTModelKey().equals(sDesiredKey))
            && (oKey.getKeyValue() != null)) {
          // May be multiple declarations of States; add them all
          oValues.add(oKey.getKeyValue());
        }
      }
    }

    return oValues;
  }
Esempio n. 2
0
  /**
   * This method takes in a list of JAXBElements and searches for a KeyedReference where the key is
   * the one specified. If one is found, it will return the value for it.
   *
   * @param oaElement The list of JAXB elements.
   * @param sKey The key to search for.
   * @return The value associated with that key.
   */
  private String findAndGetValueFromJAXBElementKeyedReference(
      List<KeyedReference> oaElement, String sKey) {
    String sValue = "";

    if ((oaElement == null) || (oaElement.size() <= 0)) {
      return "";
    }

    for (KeyedReference oKeyRef : oaElement) {
      if ((oKeyRef != null)
          && (oKeyRef.getTModelKey() != null)
          && (oKeyRef.getTModelKey().equals(sKey))
          && (oKeyRef.getKeyValue() != null)) {
        sValue = oKeyRef.getKeyValue();
      }
    }

    return sValue;
  }
Esempio n. 3
0
  /**
   * parse something like:
   * [keyName=uddi-org:types:wsdl,keyValue=wsdlDeployment,tModelKey=uddi:uddi.org:categorization:types]
   *
   * @param categoryBagStr
   * @return
   */
  protected CategoryBag parseCategoryBag(String categoryBagStr) {

    CategoryBag categoryBag = new CategoryBag();
    log.debug("CategoryBag Annotation=" + categoryBagStr);
    if (!"".equals(categoryBagStr)) {
      String[] sections = categoryBagStr.split(",");
      for (String section : sections) {
        if (section.startsWith(KEYED_REFERENCE)) {
          String keyedReferenceStr = section.substring(KEYED_REFERENCE.length(), section.length());
          log.debug("Found KeyedReference=" + keyedReferenceStr);
          String[] keyedReferences = keyedReferenceStr.split(";");
          KeyedReference keyedReference = new KeyedReference();
          for (String key : keyedReferences) {
            if (key.startsWith(KEY_NAME))
              keyedReference.setKeyName(key.substring(KEY_NAME.length(), key.length()));
            if (key.startsWith(KEY_VALUE))
              keyedReference.setKeyValue(key.substring(KEY_VALUE.length(), key.length()));
            if (key.startsWith(TMODEL_KEY))
              keyedReference.setTModelKey(key.substring(TMODEL_KEY.length(), key.length()));
          }
          log.debug(
              "KeyedReference = "
                  + KEY_NAME
                  + keyedReference.getKeyName()
                  + " "
                  + KEY_VALUE
                  + keyedReference.getKeyValue()
                  + " "
                  + TMODEL_KEY
                  + keyedReference.getTModelKey());
          categoryBag.getKeyedReference().add(keyedReference);
        } else {
          log.warn("Ignoring " + section);
          // TODO add support for KeyedReferenceGroups?
        }
      }
    }
    return categoryBag;
  }