Example usage for java.lang String CASE_INSENSITIVE_ORDER

List of usage examples for java.lang String CASE_INSENSITIVE_ORDER

Introduction

In this page you can find the example usage for java.lang String CASE_INSENSITIVE_ORDER.

Prototype

Comparator CASE_INSENSITIVE_ORDER

To view the source code for java.lang String CASE_INSENSITIVE_ORDER.

Click Source Link

Document

A Comparator that orders String objects as by compareToIgnoreCase .

Usage

From source file:API.amazon.mws.orders.MarketplaceWebServiceOrdersClient.java

/**
 * Calculate String to Sign for SignatureVersion 1
 * @param parameters request parameters/*  w  w w. ja v a  2  s .  c  o  m*/
 * @return String to Sign
 * @throws java.security.SignatureException
 */
private String calculateStringToSignV1(Map<String, String> parameters) {
    StringBuilder data = new StringBuilder();
    Map<String, String> sorted = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
    sorted.putAll(parameters);
    Iterator pairs = sorted.entrySet().iterator();
    while (pairs.hasNext()) {
        Map.Entry pair = (Map.Entry) pairs.next();
        data.append(pair.getKey());
        data.append(pair.getValue());
    }
    return data.toString();
}

From source file:ch.elexis.core.ui.views.FallDetailBlatt2.java

/**
 * disposes of required and optional fields on the bottom of the page.<br>
 * re-reads the contents for this case for the upper part<br>
 * recreates the required and optional fields on the bottom of the page (call to
 * setExtendedFields)//from w w  w. j  a  va  2s.com
 * 
 * @param f
 *            caseID
 */
@SuppressWarnings("unchecked")
public void setFall(final IFall f) {
    if (actFall != null) {
        save();
    }
    // *** dispose of currently displayed fields
    actFall = f;
    for (Control c : lReqs) {
        c.dispose();
    }
    lReqs.clear();
    keepEditable.clear();

    // *** fill billing systems into combo, set current system
    cAbrechnung.setItems(Abrechnungstypen);
    if (f == null) {
        form.setText(Messages.FallDetailBlatt2_NoCaseSelected); //$NON-NLS-1$
        tBezeichnung.setText("");
        tBezeichnung.setMessage(Messages.FallDetailBlatt2_29);
        cReason.select(0);
        return;
    }

    String billingSystem = f.getAbrechnungsSystem();
    // auto select accident if uvg is selected
    if ("UVG".equals(billingSystem)) {
        int idx = ArrayUtils.indexOf(Reasons, FallConstants.TYPE_ACCIDENT);
        if (idx > -1) {
            f.setGrund(Reasons[idx]);
        }
    }

    form.setText(f.getLabel());

    // *** set Fallbezeichnung
    tBezeichnung.setText(f.getBezeichnung());

    // *** set Grund (Krankheit/Unfall/...)
    String grund = f.getGrund();
    int ix = cReason.indexOf(grund);
    if (ix == -1) {
        ix = 0;
    }
    cReason.select(ix);

    cAbrechnung.setText(billingSystem);

    // *** set startDate/EndDate
    TimeTool tt = new TimeTool();
    if (tt.set(f.getBeginnDatum()) == true) {
        dpVon.setDate(tt.getTime());
    } else {
        dpVon.setDate(null);
    }
    if (tt.set(f.getEndDatum()) == true) {
        dpBis.setDate(tt.getTime());
    } else {
        dpBis.setDate(null);
    }

    // *** set copy for patient
    btnCopyForPatient.setSelection(f.getCopyForPatient());

    // *** set Garant
    tGarant.setBackground(null);
    tGarant.setToolTipText(null);
    Kontakt garant = f.getGarant();
    String garantLabel = garant.getLabel();
    if (garant.isDeleted()) {
        tGarant.setBackground(UiDesk.getColor(UiDesk.COL_RED));
        garantLabel = "*** " + garantLabel;
        tGarant.setToolTipText(Messages.Contact_is_marked_deleted);
    }
    tGarant.setText(garantLabel);

    // *** set cost bearer (if enabled for billing system)
    boolean costBearerDisabled = BillingSystem.isCostBearerDisabled(billingSystem);
    tCostBearer.setVisible(!costBearerDisabled);
    hlCostBearer.setVisible(!costBearerDisabled);

    tCostBearer.setBackground(null);
    tCostBearer.setToolTipText(null);
    if (!costBearerDisabled) {
        Kontakt costBearer = f.getCostBearer();
        String label = (costBearer != null) ? costBearer.getLabel() : f.getPatient().getLabel();
        if (costBearer != null && costBearer.isDeleted()) {
            tCostBearer.setBackground(UiDesk.getColor(UiDesk.COL_RED));
            label = "*** " + label;
            tCostBearer.setToolTipText(Messages.Contact_is_marked_deleted);
        }
        tCostBearer.setText(label);
    } else {
        tCostBearer.setText(StringConstants.EMPTY);
    }

    // *** adding required fields defined in prefs
    String reqs = BillingSystem.getRequirementsBySystem(billingSystem);
    if ((reqs != null) && (reqs.length() > 0)) {
        // *** do not display a title bar since this is already displayed
        // above Rechnungsempfnger!
        setExtendedFields(f, reqs, StringTool.leer, false, false, false);
    }
    // *** adding optional fields defined in prefs
    String optionals = f.getOptionals();
    if ((optionals != null) && (optionals.length() > 0)) {
        setExtendedFields(f, optionals, Messages.FallDetailBlatt2_optionalData, false, false, true); //$NON-NLS-1$
    }

    // ****** show any other fields from extinfo - ONLY FOR ADMINS, NOT
    // INTENDED FOR NORMAL USERS !!!
    // first part fields with definition, second part without definition

    // *** display all unused field having a display specification
    String[] reqsArray = BillingSystem.getRequirementsBySystem(billingSystem).split(DEFINITIONSDELIMITER);
    for (int reqI = 0; reqI < reqsArray.length; reqI++) {
        reqsArray[reqI] = reqsArray[reqI].split(ARGUMENTSSDELIMITER)[0];
    }
    String[] optsArray = f.getOptionals().split(DEFINITIONSDELIMITER);
    for (int reqI = 0; reqI < optsArray.length; reqI++) {
        optsArray[reqI] = optsArray[reqI].split(ARGUMENTSSDELIMITER)[0];
    }
    // *** read field definitions for unused fields (previously required or
    // optional)
    List<String> unused = new ArrayList<String>();
    LinkedHashMap<String, String> unusedHash = new LinkedHashMap<String, String>();
    String strUnused = f.getUnused();
    if ((strUnused != null) && (!strUnused.isEmpty())) {
        String[] allUnused = strUnused.split(DEFINITIONSDELIMITER); //$NON-NLS-1$
        Arrays.sort(allUnused, String.CASE_INSENSITIVE_ORDER); // *** sort
        // alphabetically
        for (String unusedPart : allUnused) {
            int posColon = unusedPart.indexOf(ARGUMENTSSDELIMITER);
            String key = unusedPart.substring(0, posColon);
            // *** do not show if already displayed in required or optional
            // fields
            boolean alreadyDisplayed = false;
            for (int reqI = 0; reqI < reqsArray.length; reqI++) {
                if (key.equalsIgnoreCase(reqsArray[reqI])) {
                    alreadyDisplayed = true;
                }
            }
            for (int reqI = 0; reqI < optsArray.length; reqI++) {
                if (key.equalsIgnoreCase(optsArray[reqI])) {
                    alreadyDisplayed = true;
                }
            }
            if (!alreadyDisplayed) {
                String value = unusedPart.substring(posColon + 1);
                unusedHash.put(key, value);
                unused.add(unusedPart);
            }
        }
    }

    Map<String, String> httmp = getSelectedFall().getMap(PersistentObject.FLD_EXTINFO);

    HashMap<String, String> ht = new HashMap<String, String>(httmp);

    String[] unusedHashStringArray = {};
    if (unusedHash.size() > 0) {
        String unusedHashString = unusedHash.toString();
        unusedHashString = unusedHashString.substring(1);
        unusedHashString = unusedHashString.substring(0, unusedHashString.length() - 1);
        unusedHashStringArray = unusedHashString.split(", "); //$NON-NLS-1$
    }
    String otherFieldsList_2 = StringTool.leer;
    String delim = StringTool.leer;
    for (int uhi = 0; uhi < unusedHashStringArray.length; uhi++) {
        String unusedItem = unusedHashStringArray[uhi];
        String[] itemParts = unusedItem.split("="); //$NON-NLS-1$
        String controlName = itemParts[0];
        String[] controlDefParts = itemParts[1].split(ARGUMENTSSDELIMITER);
        String controlType = controlDefParts[0];

        String[] itemList = { StringTool.leer };
        if (controlType.equalsIgnoreCase("X")) { //$NON-NLS-1$
            if (controlDefParts.length > 1) {
                itemList = controlDefParts[1].split(ITEMDELIMITER);
            }
        }
        boolean isAdded = false;
        // *** special handling if multiple items
        for (int ili = 0; ili < itemList.length; ili++) {
            String item = itemList[ili];
            if (!item.isEmpty()) {
                item = "_" + item; //$NON-NLS-1$
            }
            String combControlName = controlName + item;
            if (ht.containsKey(combControlName)) {
                ht.remove(combControlName);
                String values = StringTool.leer;
                if (controlDefParts.length > 1) {
                    values = controlDefParts[1];
                }
                if (!isAdded) {
                    otherFieldsList_2 = otherFieldsList_2 + delim + controlName + ARGUMENTSSDELIMITER
                            + controlType + ARGUMENTSSDELIMITER + values;
                }
                delim = DEFINITIONSDELIMITER;
                isAdded = true;
            }
        }
    }
    // *** only for admins!
    if (otherFieldsList_2.length() > 0) {
        if (CoreHub.acl.request(AccessControlDefaults.CASE_MODIFY_SPECIALS) == true) {
            setExtendedFields(f, otherFieldsList_2, Messages.FallDetailBlatt2_unusedFieldsWithDefinition, true,
                    true, false); //$NON-NLS-1$
        }
    }

    // *** collect all other fields that are not yet shown anywhere else,
    // display as text
    String otherFieldsList = otherFieldsList_2;
    otherFieldsList = StringTool.leer;
    Set<String> keySet = ht.keySet();
    Object[] arr = keySet.toArray();
    for (int i = 0; i < arr.length; i++) {
        String subkey = (String) arr[i];
        String abrSystem = getSelectedFall().getAbrechnungsSystem();
        String key = Preferences.LEISTUNGSCODES_CFG_KEY + "/" + abrSystem; //$NON-NLS-1$
        String bed = CoreHub.globalCfg.get(key + "/bedingungen", StringTool.leer); //$NON-NLS-1$
        boolean isAlreadyShown = false;
        if (subkey.equalsIgnoreCase(FallConstants.FLD_EXTINFO_BILLING))
            isAlreadyShown = true;
        // if (subkey.equalsIgnoreCase("payment")) isAlreadyShown = true;
        // if (subkey.equalsIgnoreCase("Fallnummer")) isAlreadyShown = true;
        // if (subkey.equalsIgnoreCase("Gesetz")) isAlreadyShown = true;
        String[] bedArr = bed.split(DEFINITIONSDELIMITER);
        if (!bed.isEmpty()) {
            for (int ii = 0; ii < bedArr.length; ii++) {
                String fldParts = bedArr[ii];
                String[] flds = fldParts.split(ARGUMENTSSDELIMITER);
                String fld = flds[0];
                if ((flds[1].equalsIgnoreCase("X")) && ((flds.length > 2)) //$NON-NLS-1$
                        && (!flds[2].isEmpty())) {
                    String checkBoxes = flds[2];
                    String[] checkBoxArray = checkBoxes.split(ITEMDELIMITER);
                    for (int cb_i = 0; cb_i < checkBoxArray.length; cb_i++) {
                        if ((fld + "_" + checkBoxArray[cb_i]).equalsIgnoreCase(subkey)) { //$NON-NLS-1$
                            isAlreadyShown = true;
                            break;
                        }
                    }
                } else {
                    if (fld.equalsIgnoreCase(subkey)) {
                        isAlreadyShown = true;
                        break;
                    }
                }
            }
        }
        String opt = CoreHub.globalCfg.get(key + "/fakultativ", StringTool.leer); //$NON-NLS-1$
        if (!isAlreadyShown) {
            String[] optArr = opt.split(DEFINITIONSDELIMITER);
            if (!opt.isEmpty()) {
                for (int ii = 0; ii < optArr.length; ii++) {
                    String fld = optArr[ii].split(ARGUMENTSSDELIMITER)[0];
                    if (fld.equalsIgnoreCase(subkey)) {
                        isAlreadyShown = true;
                        break;
                    }
                }
            }
        }
        if (!isAlreadyShown) {
            if (unusedHash.containsKey(subkey)) {
                // *** try to find def
                String theVal = (String) unusedHash.get(subkey);
                String[] vals = theVal.split(ARGUMENTSSDELIMITER);
                otherFieldsList = otherFieldsList + delim + subkey + ARGUMENTSSDELIMITER + vals[0];
                if (vals.length > 1) {
                    otherFieldsList = otherFieldsList + ARGUMENTSSDELIMITER + vals[1];
                }
            } else {
                // *** if no spec found, then show as text
                otherFieldsList = otherFieldsList + delim + subkey + ":T"; //$NON-NLS-1$
            }
            delim = DEFINITIONSDELIMITER;
        }
    }

    if (otherFieldsList.length() > 0) {
        // *** want to sort alphabetically here
        String[] tmpArr = otherFieldsList.split(DEFINITIONSDELIMITER);
        Arrays.sort(tmpArr, String.CASE_INSENSITIVE_ORDER);
        otherFieldsList = StringTool.leer;
        String tmpDel = StringTool.leer;
        for (int i = 0; i < tmpArr.length; i++) {
            otherFieldsList = otherFieldsList + tmpDel + tmpArr[i];
            tmpDel = DEFINITIONSDELIMITER;
        }
        // *** only for admins!
        if (CoreHub.acl.request(AccessControlDefaults.CASE_MODIFY_SPECIALS) == true) {
            setExtendedFields(f, otherFieldsList, Messages.FallDetailBlatt2_unusedFieldsWithoutDefinition, true,
                    true, false); //$NON-NLS-1$
        }
    }

    if (lockUpdate) {
        setUnlocked(CoreHub.getLocalLockService().isLockedLocal(actFall));
    }
}

From source file:weave.utils.SQLUtils.java

/**
 * @param conn An existing SQL Connection
 * @param schemaName A schema name accessible through the given connection
 * @return A List of table names in the given schema
 * @throws SQLException If the query fails.
 *///from w w  w  .  ja v a  2 s  . c  o m
public static List<String> getTables(Connection conn, String schemaName) throws SQLException {
    List<String> tables = new Vector<String>();
    ResultSet rs = null;
    try {
        DatabaseMetaData md = conn.getMetaData();
        String[] types = new String[] { "TABLE", "VIEW" };

        // MySQL uses "catalogs" instead of "schemas"
        if (conn.getMetaData().getDatabaseProductName().equalsIgnoreCase(MYSQL))
            rs = md.getTables(schemaName, null, null, types);
        else if (SQLUtils.isOracleServer(conn))
            rs = md.getTables(null, schemaName.toUpperCase(), null, types);
        else
            rs = md.getTables(null, schemaName, null, types);

        // use column index instead of name because sometimes the names are lower case, sometimes upper.
        // column indices: 1=table_cat,2=table_schem,3=table_name,4=table_type,5=remarks
        while (rs.next())
            tables.add(rs.getString(3)); // table_name

        Collections.sort(tables, String.CASE_INSENSITIVE_ORDER);
    } finally {
        // close everything in reverse order
        cleanup(rs);
    }
    return tables;
}

From source file:com.genentech.application.calcProps.SDFCalcProps.java

private static void printProperties(Set<Calculator> calculators, boolean showHidden) {
    //Print properties by alphabetical order
    TreeMap<String, String> sortedCalcs = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
    for (Calculator calc : calculators) {
        if (calc.isPublic()) {
            sortedCalcs.put(calc.getName(), calc.getHelpText());
        } else if (showHidden == true) {//print non public props as well
            sortedCalcs.put(calc.getName(), calc.getHelpText());
        }// w w  w. j a  va2s.c o m
    }

    for (String key : sortedCalcs.keySet()) {
        System.err.println(key + ":\t" + sortedCalcs.get(key));
    }
}

From source file:com.redhat.satellite.search.index.IndexManager.java

private boolean initDocSummary() {
    /**//from   ww w .  j  a v  a  2s.c  o  m
     * NOTE:  NutchConfiguration is expecting "nutch-default.xml" and "nutch-site.xml"
     * to be available in the CLASSPATH
     */
    try {
        nutchConf = NutchConfiguration.create();
        nutchAnalyzerFactory = new AnalyzerFactory(nutchConf);
        FileSystem fs = FileSystem.get(nutchConf);
        docSegments = new TreeMap<String, FetchedSegments>(String.CASE_INSENSITIVE_ORDER);
        for (String key : docLocaleLookUp.keySet()) {
            String segmentsDir = indexWorkDir + File.separator + getDocIndexPath(key) + File.separator
                    + "segments";
            FetchedSegments segments = new FetchedSegments(fs, segmentsDir, nutchConf);
            if (segments == null) {
                log.info("Unable to create docSegments for language: " + key);
                docSegments.put(key, null);
            }
            String[] segNames = segments.getSegmentNames();
            if (segNames == null || segNames.length == 0) {
                log.info("Unable to find any segments for language: " + key);
                docSegments.put(key, null);
            }
            log.info("Adding Documentation segments for language: " + key);
            docSegments.put(key, segments);
        }
    } catch (Exception e) {
        log.error("ignoring exception - most likely Nutch isn't present, so" + " doc summaries will be empty");
        e.printStackTrace();
    }
    return true;
}

From source file:edu.internet2.middleware.psp.ldap.LdapSpmlTarget.java

/**
 * Gets the pso representation of the ldap entry.
 * //from   ww  w . j  a v  a  2  s  .  c om
 * @param entry the ldap entry
 * @param returnData whether or not to include the identifier, data, and references
 * @return the pso representation of the ldap entry
 * @throws Spml2Exception if an spml error occurs
 * @throws PspException if a psp error occurs
 */
protected PSO getPSO(LdapEntry entry, ReturnData returnData) throws Spml2Exception, PspException {

    String msg = "get pso for '" + entry.getDn() + "' target '" + getId() + "'";

    PSO pso = new PSO();

    // determine schema entity, throws PSPException
    Pso psoDefinition = this.getPSODefinition(entry);
    LOG.debug("{} schema entity '{}'", msg, psoDefinition.getId());
    pso.addOpenContentAttr(Pso.ENTITY_NAME_ATTRIBUTE, psoDefinition.getId());

    PSOIdentifier psoID = new PSOIdentifier();
    psoID.setTargetID(getId());

    try {
        psoID.setID(LdapSpmlTarget.canonicalizeDn(entry.getDn()));
    } catch (InvalidNameException e) {
        LOG.error(msg + " Unable to canonicalize entry dn.", e);
        throw new Spml2Exception(e);
    }

    // TODO skipping container id for now
    // String baseId = psoDefinition.getPsoIdentifierDefinition().getBaseId();
    // if (baseId != null) {
    // PSOIdentifier containerID = new PSOIdentifier();
    // containerID.setID(baseId);
    // containerID.setTargetID(getId());
    // psoID.setContainerID(containerID);
    // }

    pso.setPsoID(psoID);

    if (returnData.equals(ReturnData.DATA) || returnData.equals(ReturnData.EVERYTHING)) {

        LdapAttributes ldapAttributes = entry.getLdapAttributes();

        // ldap attribute names are case insensitive
        Map<String, String> attributeNameMap = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
        for (String attributeName : psoDefinition.getAttributeNames()) {
            attributeNameMap.put(attributeName, attributeName);
        }
        Map<String, String> referenceNameMap = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
        if (returnData.equals(ReturnData.EVERYTHING)) {
            for (String referenceName : psoDefinition.getReferenceNames()) {
                referenceNameMap.put(referenceName, referenceName);
            }
        }

        // the order of the attributes and references in the pso should match the psp configuration

        // map psp attribute names to dsml attr
        Map<String, DSMLAttr> nameToAttr = new HashMap<String, DSMLAttr>();
        // map psp reference names to references
        Map<String, List<Reference>> nameToRefs = new HashMap<String, List<Reference>>();

        for (LdapAttribute ldapAttribute : ldapAttributes.getAttributes()) {
            if (attributeNameMap.containsKey(ldapAttribute.getName())) {
                String pspAttributeName = attributeNameMap.get(ldapAttribute.getName());
                nameToAttr.put(pspAttributeName,
                        getDsmlAttr(pspAttributeName, ldapAttribute.getStringValues()));
            } else if (returnData.equals(ReturnData.EVERYTHING)
                    && referenceNameMap.containsKey(ldapAttribute.getName())) {
                String pspReferenceName = referenceNameMap.get(ldapAttribute.getName());
                nameToRefs.put(pspReferenceName,
                        getReferences(pspReferenceName, ldapAttribute.getStringValues()));
            } else {
                LOG.trace("{} ignoring attribute '{}'", msg, ldapAttribute.getName());
            }
        }

        // data, in order defined in psp configuration
        Extensible data = new Extensible();
        for (String attributeName : psoDefinition.getAttributeNames()) {
            if (nameToAttr.containsKey(attributeName)) {
                data.addOpenContentElement(nameToAttr.get(attributeName));
            }
        }
        if (data.getOpenContentElements().length > 0) {
            pso.setData(data);
        }

        // references, in order defined in psp configuration
        if (returnData.equals(ReturnData.EVERYTHING)) {
            List<Reference> references = new ArrayList<Reference>();
            for (String referenceName : psoDefinition.getReferenceNames()) {
                if (nameToRefs.containsKey(referenceName)) {
                    references.addAll(nameToRefs.get(referenceName));
                }
            }
            PSPUtil.setReferences(pso, references);
        }
    }

    return pso;
}

From source file:com.healthmarketscience.jackcess.impl.DatabaseImpl.java

public Set<String> getTableNames() throws IOException {
    if (_tableNames == null) {
        Set<String> tableNames = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
        _tableFinder.getTableNames(tableNames, false);
        _tableNames = tableNames;/*from  w  w w  .ja v  a2 s .com*/
    }
    return _tableNames;
}

From source file:com.healthmarketscience.jackcess.impl.DatabaseImpl.java

public Set<String> getSystemTableNames() throws IOException {
    Set<String> sysTableNames = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
    _tableFinder.getTableNames(sysTableNames, true);
    return sysTableNames;
}

From source file:org.apache.jsp.members_jsp.java

private String listItems(HttpServletRequest request, HttpServletResponse response) {
      StringBuffer people = new StringBuffer();
      Map<String, String> listOfPeople = getListOfCommunityMembers(communityid, request, response);

      if (listOfPeople.size() > 0) {
          people.append("<table class=\"listTable\" cellpadding=\"3\" cellspacing=\"1\" width=\"100%\" >");

          // Sort the sources alphabetically
          List<String> sortedKeys = new ArrayList<String>(listOfPeople.keySet());
          Collections.sort(sortedKeys, String.CASE_INSENSITIVE_ORDER);

          // Filter the list
          List<String> sortedAndFilteredKeys = new ArrayList<String>();
          for (String key : sortedKeys) {
              if (listFilter.length() > 0) {
                  if (key.toLowerCase().contains(listFilter.toLowerCase()))
                      sortedAndFilteredKeys.add(key);
              } else {
                  sortedAndFilteredKeys.add(key);
              }/* w  ww .  jav  a2s. com*/
          }

          // If the user has filtered the list down we might need to adjust our page calculations
          // e.g. 20 total items might = 2 pages but filtered down to 5 items there would only be 1
          // Calculate first item to start with with
          // Page = 1, item = 1
          // Page = X, item = ( ( currentPage - 1 ) * itemsToShowPerPage ) + 1;
          int startItem = 1;
          int endItem = startItem + itemsToShowPerPage - 1;
          if (currentPage > 1) {
              startItem = ((currentPage - 1) * itemsToShowPerPage) + 1;
              endItem = (startItem + itemsToShowPerPage) - 1;
          }

          int currentItem = 1;
          for (String key : sortedAndFilteredKeys) {
              if (currentItem >= startItem && currentItem <= endItem) {
                  String name = key;
                  String id = listOfPeople.get(key).toString();
                  String editLink = "";
                  String deleteLink = "";

                  String listFilterString = "";
                  if (listFilter.length() > 0)
                      listFilterString = "&listFilterStr=" + listFilter;

                  editLink = "<a href=\"members.jsp?communityid=" + communityid + "&action=edit&personid=" + id
                          + "&page=" + currentPage + listFilterString + "\" title=\"Edit Member\">" + name
                          + "</a>";
                  deleteLink = "<a href=\"members.jsp?communityid=" + communityid + "&action=delete&personid="
                          + id + listFilterString + "\" title=\"Remove Member from Community\" "
                          + "onclick='return confirm(\"Do you really wish to remove the member?\");'>"
                          + "<img src=\"image/delete_x_button.png\" border=0></a>";

                  // Create the HTML table row
                  people.append("<tr>");
                  people.append("<td bgcolor=\"white\" width=\"100%\">" + editLink + "</td>");
                  people.append("<td align=\"center\" bgcolor=\"white\">" + deleteLink + "</td>");
                  people.append("</tr>");
              }
              currentItem++;
          }

          // Calculate number of pages, current page, page links...
          people.append("<tr><td colspan=\"2\" align=\"center\" class=\"subTableFooter\">");
          // --------------------------------------------------------------------------------
          // Create base URL for each page
          StringBuffer baseUrl = new StringBuffer();
          baseUrl.append("people.jsp?");
          String actionString = (action.length() > 0) ? "action=" + action : "";
          String personIdString = (personid.length() > 0) ? "personid=" + personid : "";
          if (actionString.length() > 0)
              baseUrl.append(actionString);
          if (actionString.length() > 0 && personIdString.length() > 0)
              baseUrl.append("&");
          if (personIdString.length() > 0)
              baseUrl.append(personIdString);
          if (actionString.length() > 0 || personIdString.length() > 0)
              baseUrl.append("&");
          baseUrl.append("page=");
          people.append(createPageString(sortedAndFilteredKeys.size(), itemsToShowPerPage, currentPage,
                  baseUrl.toString()));
          people.append("</td></tr>");
          // --------------------------------------------------------------------------------
          people.append("</table>");
      } else {
          people.append("No user accounts were retrieved");
      }
      return people.toString();
  }

From source file:org.gcaldaemon.gui.config.MainConfig.java

public final String[] getCalendarURLs(AccountInfo account, boolean loadFromGoogle) throws Exception {
    if (account == null || account.username == null) {
        return new String[0];
    }//from   ww  w  .  j av a2s . c om
    HashSet set = new HashSet();
    String[] urls = null;
    int i;
    if (loadFromGoogle) {
        Request request = new Request();
        request.username = account.username;
        request.password = account.password;
        urls = GCalUtilities.getCalendarURLs(request, getWorkDirectory());
        urlMap.put(account.username, urls);
    } else {
        urls = (String[]) urlMap.get(account.username);
    }
    if (urls != null) {
        for (i = 0; i < urls.length; i++) {
            set.add(urls[i]);
        }
    }
    FileSync[] configs = getFileSyncConfigs();
    FileSync config;
    for (i = 0; i < configs.length; i++) {
        config = configs[i];
        if (account.username.equals(config.username)) {
            if (config.privateIcalUrl != null && config.privateIcalUrl.endsWith(".ics")
                    && !containsURL(set, config.privateIcalUrl)) {
                set.add(config.privateIcalUrl);
            }
        }
    }
    String[] array = new String[set.size()];
    set.toArray(array);
    Arrays.sort(array, String.CASE_INSENSITIVE_ORDER);
    return array;
}