Пример #1
0
 /**
  * @param vs the <VirtualSystem> we work with
  * @param key Key of the Map
  * @param value value of the key
  * @throws RequiredAttributeException if key or vs are null throws this method
  * @throws IdAlreadyExistsException if key already inserted
  */
 public static void addOtherAttributes(VirtualSystemType vs, QName key, String value)
     throws RequiredAttributeException, IdAlreadyExistsException {
   if (vs == null || key == null) {
     throw new RequiredAttributeException("Some values are null!");
   }
   if (vs.getOtherAttributes().get(key) != null) {
     throw new IdAlreadyExistsException("Key already exists");
   }
   vs.getOtherAttributes().put(key, value);
 }
Пример #2
0
  /**
   * Return an OtherAttributes value for a given key into the <VirtualSystem>
   *
   * @param vs
   * @param key
   * @return
   * @throws RequiredAttributeException
   * @throws IdNotFoundException
   */
  public static String getOtherAttribute(VirtualSystemType vs, QName key)
      throws RequiredAttributeException, IdNotFoundException {
    if (vs == null || key == null) {
      throw new RequiredAttributeException("Some values are null!");
    }

    String value = vs.getOtherAttributes().get(key);

    if (value == null) {
      throw new IdNotFoundException("Key doesn't exist");
    }

    return value;
  }