Exemplo n.º 1
0
  // Converts a String with no spaces to a singleton list
  private static List<String> toSingletonList(String propertyName, String value) {
    if ((null == value) || (value.length() == 0)) {
      return null;
    }

    if (value.charAt(0) == '@') {
      // These are very common, so we use shared copies
      // of these collections instead of re-creating.
      List<String> list;

      if (ALL.equals(value)) {
        list = ALL_LIST;
      } else if (FORM.equals(value)) {
        list = FORM_LIST;
      } else if (THIS.equals(value)) {
        list = THIS_LIST;
      } else if (NONE.equals(value)) {
        list = NONE_LIST;
      } else {
        // RELEASE_PENDING i18n ;
        throw new FacesException(
            value + " : Invalid id keyword specified for '" + propertyName + "' attribute");
      }

      return list;
    }

    return Collections.singletonList(value);
  }
Exemplo n.º 2
0
 /**
  * Get a ResponseStatus enum from it's representative String. <br>
  * Not cross locale safe.
  *
  * @param statusName
  * @return
  */
 public static final ResponseStatus getStatus(String statusName) {
   if (statusName.equals(OK.name())) {
     return ResponseStatus.OK;
   }
   if (statusName.equals(NONE.name())) {
     return ResponseStatus.NONE;
   } else if (statusName.equals(PRE_REQUEST.name())) {
     return ResponseStatus.PRE_REQUEST;
   } else if (statusName.equals(REQUEST_ERROR.name())) {
     return ResponseStatus.REQUEST_ERROR;
   } else if (statusName.equals(REQUESTING.name())) {
     return ResponseStatus.REQUESTING;
   } else if (statusName.equals(NO_CONNECTION.name())) {
     return ResponseStatus.NO_CONNECTION;
   } else if (statusName.equals(REQUESTED.name())) {
     return ResponseStatus.REQUESTED;
   } else if (statusName.equals(JSON_PARSE_ERROR.name())) {
     return ResponseStatus.JSON_PARSE_ERROR;
   } else if (statusName.equals(INVALID_CALL.name())) {
     return ResponseStatus.INVALID_CALL;
   } else if (statusName.equals(INVALID_URL.name())) {
     return ResponseStatus.INVALID_URL;
   } else {
     return ResponseStatus.UNKNOWN;
   }
 }
Exemplo n.º 3
0
 public void setDestFsGroup(String destFsGroup) {
   if (NONE.equals(destFsGroup)) {
     this.destFsGroup = null;
   } else {
     if (destFsGroup.equals(srcFsGroup)) {
       throw new IllegalArgumentException("Source and Destination must not be the same!");
     }
     this.destFsGroup = destFsGroup;
   }
 }
Exemplo n.º 4
0
 public void setCalledAETs(String calledAET) {
   this.calledAETs = NONE.equals(calledAET) ? null : StringUtils.split(calledAET, '\\');
 }
 @Override
 public boolean hasMaximum() {
   return getMaximum() != null
       && !NONE.equals(getMaximum())
       && !(getMaximum().getUnit() == null || getMaximum().getValue() == null);
 }
 @Override
 public boolean hasError() {
   return (NONE.equals(status) || ERROR.equals(status));
 }
Exemplo n.º 7
0
 /**
  * Retrieve an instance of the enum based on its int value.
  *
  * @param type int type
  * @return enum instance
  */
 public static LineStyle getInstance(int type) {
   if (type < 0 || type >= TYPE_VALUES.length) {
     type = NONE.getValue();
   }
   return (TYPE_VALUES[type]);
 }
Exemplo n.º 8
0
 public final void setHSMModulServicename(String name) throws MalformedObjectNameException {
   this.hsmModuleServicename = NONE.equals(name) ? null : ObjectName.getInstance(name);
 }
Exemplo n.º 9
0
 public void setSrcFsGroup(String srcFsGroup) {
   this.srcFsGroup = NONE.equals(srcFsGroup) ? null : srcFsGroup;
 }