コード例 #1
0
  public RemotePermissionScheme[] getPermissionSchemes(JiraConfiguration config) {
    JiraSession session = getJiraSession(config);
    JiraClient client = new JiraClient(session);

    RemotePermissionScheme[] schemes;
    schemes = client.getPermissionSchemes();

    session.close();
    return schemes;
  }
コード例 #2
0
  @JavaScriptMethod
  public RemoteUser[] getExistingUsers(String jiraConfigName, String query) {
    JiraSession session = getJiraSession(getJiraConfig(jiraConfigName));
    JiraClient client = new JiraClient(session);

    RemoteUser[] users = client.searchUser(query);

    session.close();
    return users;
  }
コード例 #3
0
  @JavaScriptMethod
  public RemoteGroupSummary[] getExistingGroups(String jiraConfigName, String query) {
    JiraSession session = getJiraSession(getJiraConfig(jiraConfigName));
    JiraClient client = new JiraClient(session);

    RemoteGroupSummary[] groups;
    groups = client.searchGroups(query);

    session.close();
    return groups;
  }
コード例 #4
0
  @JavaScriptMethod
  public String[] validateUserInput(
      String jiraConfigName, String username, String fullName, String email, String password) {
    JiraSession session = getJiraSession(getJiraConfig(jiraConfigName));
    JiraClient client = new JiraClient(session);

    String[] result =
        new String[] {
          validateNewUsername(client, username),
          validateNewFullName(client, fullName),
          validateNewEmail(client, email),
          validateNewPassword(client, password)
        };

    session.close();

    return result;
  }
コード例 #5
0
  @JavaScriptMethod
  public String isValidJIRAProjectKey(String jiraConfigName, String key) {
    if (GenericValidator.isBlankOrNull(key)) {
      return "Please provide a key";
    } else if (!KEY_PATTERN.matcher(key).matches()) {
      return "The project key is not in the required format (^[A-Z]+$).";
    }

    try {
      JiraSession session = getJiraSession(getJiraConfig(jiraConfigName));
      JiraClient client = new JiraClient(session);

      client.getProject(key);

      session.close();
      return "Project key already used.";
    } catch (AtlassianException ex) {
      if (ex.getMessage().contains("No project could be found")) {
        return null;
      }

      throw ex;
    }
  }