Example #1
0
  public static IdentifierValueKey convert(String key, KeyData kd) {

    IdentifierValueKey ivk = new IdentifierValueKey();
    ivk.setKey(key);

    if (kd != null) {
      ivk.setPolicyIdentifier(kd.getPolicyIdentifier());
      ivk.setValues(kd.getValues());
    }

    return ivk;
  }
Example #2
0
  public static IdentifierData convert(Collection<IdentifierValueKey> valueCollection) {
    IdentifierData result = null;

    if (valueCollection != null && valueCollection.size() > 0) {
      result = new IdentifierData();
      Map<String, KeyData> values = new HashMap<String, KeyData>();
      result.setValues(values);

      for (IdentifierValueKey vk : valueCollection) {
        values.put(vk.getKey(), convert(vk));
      }
    }

    return result;
  }
Example #3
0
  // Returns list of values associated with the key
  // Returns null if the key does not exist in values
  // Returns an empty list if they key exists but have no values
  public static List<String> getKeyValues(IdentifierMetadata values, String keyName) {

    if (values == null) {
      return null;
    }

    Collection<IdentifierValueKey> cvalues = values.getValues();
    if (cvalues == null) {
      return null;
    }

    for (IdentifierValueKey ivk : cvalues) {
      if (ivk.getKey().equals(keyName)) {
        if (ivk.getValues() == null) {
          return new ArrayList<String>();
        }
        return ivk.getValues();
      }
    }

    return null;
  }
Example #4
0
 public static KeyData convert(IdentifierValueKey ivk) {
   return new KeyData(ivk.getPolicyIdentifier(), ivk.getValues());
 }