コード例 #1
0
ファイル: StringTupel.java プロジェクト: gsautter/idaho-core
 /**
  * Convert the data in this StringTupel to a line for a CSV file.
  *
  * @param separator the value separator character
  * @param valueDelimiter the character to use as the value delimiter (will be escaped with itself
  *     if occuring in value)
  * @param keys a StringVector containing the keys whose values to include
  * @return a String concatenated from the values of the specified keys, in the order of the keys
  */
 public String toCsvString(char separator, char valueDelimiter, StringVector keys) {
   String delimiter = ("" + valueDelimiter);
   StringVector values = new StringVector();
   for (int k = 0; k < keys.size(); k++)
     values.addElement(
         delimiter
             + StringUtils.replaceAll(
                 this.getValue(keys.get(k), ""), delimiter, (delimiter + delimiter))
             + delimiter);
   return values.concatStrings("" + separator);
 }
コード例 #2
0
ファイル: StringTupel.java プロジェクト: gsautter/idaho-core
 /** @see java.lang.Object#toString() */
 public String toString() {
   StringVector keys = this.getKeys();
   StringVector values = new StringVector();
   for (int k = 0; k < keys.size(); k++) values.addElement(this.getValue(keys.get(k), ""));
   return values.concatStrings("; ");
 }
コード例 #3
0
  /* (non-Javadoc)
   * @see de.uka.ipd.idaho.goldenGateScf.uaa.webClient.AuthenticatedWebClientModul#handleRequest(de.uka.ipd.idaho.goldenGateScf.uaa.client.AuthenticatedClient, javax.servlet.http.HttpServletRequest)
   */
  public String[] handleRequest(AuthenticatedClient authClient, HttpServletRequest request)
      throws IOException {
    GoldenGateUpsClient upsc = this.getUpsClient(authClient);
    StringVector messageCollector = new StringVector();

    String command = request.getParameter(COMMAND_PARAMETER);

    //	create role
    if (CREATE_ROLE.equals(command)) {

      //	get parameters
      String roleName = request.getParameter(ROLE_NAME_PARAMETER);

      //	create role
      upsc.createRole(roleName);
      messageCollector.addElement("Role '" + roleName + "' created successfully.");
    }

    //	delete role
    else if (DELETE_ROLE.equals(command)) {

      //	get parameters
      String roleName = request.getParameter(ROLE_NAME_PARAMETER);

      //	delete role
      upsc.deleteRole(roleName);
      messageCollector.addElement("Role '" + roleName + "' deleted successfully.");
    }

    //	edit a user's roles and permissions
    else if (EDIT_USER.equals(command)) {

      //	get parameters
      String userName = request.getParameter(USER_NAME_PARAMETER);
      String[] roles = request.getParameterValues(ROLE_PARAMETER);

      //	set roles
      upsc.setUserRoles(userName, roles);
      messageCollector.addElement("Roles of user '" + userName + "' changed successfully.");
    }

    //	edit a role's roles and permissions
    else if (EDIT_ROLE.equals(command)) {

      //	get parameters
      String roleName = request.getParameter(ROLE_NAME_PARAMETER);
      String[] roles = request.getParameterValues(ROLE_PARAMETER);
      String[] permissions = request.getParameterValues(PERMISSION_PARAMETER);

      //	set roles
      upsc.setRoleRoles(roleName, roles);
      messageCollector.addElement(
          "Inherited roles of role '" + roleName + "' changed successfully.");

      //	set permissions
      upsc.setRolePermissions(roleName, permissions);
      messageCollector.addElement("Permissions of role '" + roleName + "' changed successfully.");
    }

    return messageCollector.toStringArray();
  }