Пример #1
0
  public boolean doValidation(String key, Map parameters) {
    String value = (String) parameters.get(key);
    if (value == null || value.length() == 0) return false;

    try {
      fieldManager.getCustomField(value);
    } catch (IllegalArgumentException ex) {
      return false;
    }
    return true;
  }
Пример #2
0
 /**
  * Get user specified by the Custom Field
  *
  * @param ctx permission context
  * @param customFieldId eg. 'customfield_10000'
  * @return the set of users stored in the given custom field in the given context; an empty set is
  *     returned if the context could not provide values (i.e. there was no issue specified).
  */
 @Override
 public Set<User> getUsers(PermissionContext ctx, String customFieldId) {
   // JRA-15063: just return EMPTY SET (like GroupCF does) because throwing an
   // IllegalArgumentException is unnecessary.
   if (ctx.getIssue() == null) {
     log.debug(
         "Could not retrieve users for UserCF '"
             + customFieldId
             + "' since provided PermissionContext has no issue.");
     return Collections.emptySet();
   }
   Issue issue = ctx.getIssue();
   FieldManager fieldManager = getFieldManager();
   CustomField field = fieldManager.getCustomField(customFieldId);
   return convertToUserSet(getValuesFromIssue(field, issue));
 }
Пример #3
0
 public String getArgumentDisplay(String argument) {
   CustomField field = fieldManager.getCustomField(argument);
   return field.getName();
 }