Example usage for org.apache.commons.lang StringUtils lowerCase

List of usage examples for org.apache.commons.lang StringUtils lowerCase

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils lowerCase.

Prototype

public static String lowerCase(String str) 

Source Link

Document

Converts a String to lower case as per String#toLowerCase() .

Usage

From source file:de.knowwe.defi.usermanager.XMLUserDatabase.java

/**
 * Private method that returns the first {@link org.apache.wiki.auth.user.UserProfile}matching a
 * <user> element's supplied attribute. This method will also
 * set the UID if it has not yet been set.
 * @param matchAttribute//  w  w w  . j a  v a  2s.  co m
 * @param index
 * @return the profile, or <code>null</code> if not found
 */
private UserProfile findByAttribute(String matchAttribute, String index) {
    if (c_dom == null) {
        throw new IllegalStateException("FATAL: database does not exist");
    }

    checkForRefresh();

    NodeList users = c_dom.getElementsByTagName(USER_TAG);

    if (users == null)
        return null;

    // check if we have to do a case insensitive compare
    boolean caseSensitiveCompare = true;
    if (matchAttribute.equals(EMAIL)) {
        caseSensitiveCompare = false;
    }

    for (int i = 0; i < users.getLength(); i++) {
        Element user = (Element) users.item(i);
        String userAttribute = user.getAttribute(matchAttribute);
        if (!caseSensitiveCompare) {
            userAttribute = StringUtils.lowerCase(userAttribute);
            index = StringUtils.lowerCase(index);
        }
        if (userAttribute.equals(index)) {
            UserProfile profile = newProfile();

            // Parse basic attributes
            profile.setUid(user.getAttribute(UID));
            if (profile.getUid() == null || profile.getUid().isEmpty()) {
                profile.setUid(generateUid(this));
            }
            profile.setLoginName(user.getAttribute(LOGIN_NAME));
            profile.setFullname(user.getAttribute(FULL_NAME));
            profile.setPassword(user.getAttribute(PASSWORD));
            profile.setEmail(user.getAttribute(EMAIL));

            // Get created/modified timestamps
            String created = user.getAttribute(CREATED);
            String modified = user.getAttribute(LAST_MODIFIED);
            profile.setCreated(parseDate(profile, created));
            profile.setLastModified(parseDate(profile, modified));

            // Is the profile locked?
            String lockExpiry = user.getAttribute(LOCK_EXPIRY);
            if (lockExpiry == null || lockExpiry.isEmpty()) {
                profile.setLockExpiry(null);
            } else {
                profile.setLockExpiry(parseDate(profile, lockExpiry));
            }

            // Extract all of the user's attributes (should only be one attributes tag, but you never know!)
            NodeList attributes = user.getElementsByTagName(ATTRIBUTES_TAG);
            for (int j = 0; j < attributes.getLength(); j++) {
                Element attribute = (Element) attributes.item(j);
                String serializedMap = extractText(attribute);
                try {
                    Map<String, ? extends Serializable> map = Serializer.deserializeFromBase64(serializedMap);
                    profile.getAttributes().putAll(map);
                } catch (IOException e) {
                    Log.severe("Could not parse user profile attributes!", e);
                }
            }

            return profile;
        }
    }
    return null;
}

From source file:net.sourceforge.fenixedu.domain.CurricularCourse.java

private String constructUniqueEnrollmentKey(String code, String name, DegreeType degreeType) {
    StringBuilder stringBuffer = new StringBuilder(50);
    stringBuffer.append(code);/*from ww w .  ja va  2 s.com*/
    stringBuffer.append(name);
    if (degreeType != null) {
        stringBuffer.append(degreeType.toString());
    }
    return StringUtils.lowerCase(stringBuffer.toString());
}

From source file:adalid.core.programmers.AbstractSqlProgrammer.java

private String getArtifactFixedCaseName(Artifact artifact) {
    String name = artifact.getName();
    String NAME = StringUtils.upperCase(name);
    return StringUtils.equals(name, NAME) ? StringUtils.lowerCase(name) : name;
}

From source file:com.evolveum.icf.dummy.resource.DummyResource.java

private String normalize(String id) {
    if (caseIgnoreId) {
        return StringUtils.lowerCase(id);
    } else {//w  w  w.ja va  2  s .  com
        return id;
    }
}

From source file:nc.noumea.mairie.organigramme.viewmodel.EditEntiteDtoViewModel.java

/**
 * Cre une feuille unitaire//from w ww  .ja  v a 2 s .com
 * 
 * @param ul
 *            : le {@link Ul} parent
 * @param node
 *            : le node de la FDP
 * @return le composant {@link Li} reprsentant l'entit
 */
public Li creeLiEntite(Ul ul, final FichePosteTreeNodeDto node) {

    Li li = new Li();
    String numFichePoste = OrganigrammeUtil.splitByNumberAndSeparator(node.getNumero(), 8, "\n");

    Div divNumFichePoste = new Div();
    divNumFichePoste.appendChild(new Label(numFichePoste));

    // #17877 les FDP gele
    if (null != node.getIdStatutFDP() && node.getIdStatutFDP().equals(EnumStatutFichePoste.GELEE.getStatut())) {

        Label labelGelee = new Label(" GELEE");
        labelGelee.setStyle("font-weight: bold; color:red;");
        divNumFichePoste.appendChild(labelGelee);
    }

    li.appendChild(divNumFichePoste);
    Div divTitreFichePoste = new Div();

    // #18575 Si le titre de la FDP est trop long, alors pour ne pas que a
    // sorte de la case, on raccourcis le nom de l'agent
    String suffixeSigleSiEnfant = CollectionUtils.isEmpty(node.getFichePostesEnfant()) ? ""
            : " (" + node.sigle + ")";

    String libelleTitreEtSigle = node.getTitre() + suffixeSigleSiEnfant;
    String libelleAgent = node.getAgent();

    String libelleAgentAbbreviate = libelleTitreEtSigle.length() > 50 ? StringUtils.abbreviate(libelleAgent, 27)
            : libelleAgent;
    String libelleTitreEtSigleAbbreviate = StringUtils.abbreviate(libelleTitreEtSigle, 80);

    divTitreFichePoste.appendChild(new Label(libelleTitreEtSigleAbbreviate));

    li.appendChild(divTitreFichePoste);
    if (isAfficheAgentFdp()) {
        Div divAgent = new Div();
        divAgent.appendChild(new Label(libelleAgentAbbreviate));
        li.appendChild(divAgent);
    }
    li.setParent(ul);

    // #28374 : la demande serait d'avoir le chef d'entit de la mme
    // couleur que l'entit
    // retourne l entite seulement si la fiche de poste est la superieure
    // hierarchique de ce service
    CouleurTypeEntite couleurTypeEntite = null;
    if (!node.getServiceAffichageExportYed().equals("")) {
        EntiteDto entitePourFichePosteChef = EntityUtils.getBackgroundColorOfFichePoste(node, entity,
                mapFichesPosteSuperieureByService);
        if (null != entitePourFichePosteChef) {
            couleurTypeEntite = couleurTypeEntiteService
                    .findByIdTypeEntite(entitePourFichePosteChef.getTypeEntite().getId());
            if (couleurTypeEntite != null) {
                entitePourFichePosteChef.getTypeEntite().setCouleurEntite(couleurTypeEntite.getCouleurEntite());
                entitePourFichePosteChef.getTypeEntite().setCouleurTexte(couleurTypeEntite.getCouleurTexte());
            }
        }
    }

    // #28374 : la demande serait d'avoir le chef d'entit de la mme
    // couleur que l'entit
    // CouleurTypeEntite couleurTypeEntite = null;
    // if(!node.getServiceAffichageExportYed().equals("")
    // && null != node.getIdServiceADS()) {
    // try {
    // couleurTypeEntite =
    // couleurTypeEntiteService.findByIdTypeEntite(EntityUtils.getEntiteByIdServiceAds(
    // node.getIdServiceADS(), entity).getTypeEntite().getId());
    // } catch(Exception e) {
    // couleurTypeEntite = null;
    // }
    // }

    // #17875 Affichage en rouge des FDP non rglementaires
    if (null != node.getReglementaire() && "Non".equals(node.getReglementaire().trim())) {
        li.setStyle("background-color:red; color:white;");
    } else if (null != couleurTypeEntite) {
        // #28374 : la demande serait d'avoir le chef d'entit de la mme
        // couleur que l'entit
        li.setStyle("background-color:" + couleurTypeEntite.getCouleurEntite() + "; color: "
                + couleurTypeEntite.getCouleurTexte() + ";");
    } else {
        li.setStyle("background-color:#FFFFCF; color:#000000;");
    }

    li.setSclass("statut-" + StringUtils.lowerCase(node.getStatutCss()) + " fichePoste");

    li.setId(node.getIdLi());
    li.setDynamicProperty("title", creeTooltipEntite(node, libelleTitreEtSigle, libelleAgent));

    // On maintient une map permettant d'aller plus vite lors d'un click
    // event pour retrouver FichePosteTreeNodeDto correspondant  l'id du Li
    mapIdLiFichePosteTreeNodeDto.put(li.getId(), node);

    return li;
}

From source file:edu.amc.sakai.user.JLDAPDirectoryProvider.java

/**
 * Maps attribites from the specified {@link LdapUserData} onto
 * a {@link org.sakaiproject.user.api.UserEdit}. Implemented to
 * delegate to the currently assigned {@link LdapAttributeMapper}.
 * // w w  w .ja va 2  s  . c o m
 * @see LdapAttributeMapper#mapUserDataOntoUserEdit(LdapUserData, UserEdit)
 * @param userData a non-null user cache entry
 * @param userEdit a non-null user domain object
 */
protected void mapUserDataOntoUserEdit(LdapUserData userData, UserEdit userEdit) {

    if (M_log.isDebugEnabled()) {
        //  std. UserEdit impl has no meaningful toString() impl
        M_log.debug("mapUserDataOntoUserEdit() [userData = " + userData + "]");
    }

    // delegate to the LdapAttributeMapper since it knows the most
    // about how the LdapUserData instance was originally populated
    ldapAttributeMapper.mapUserDataOntoUserEdit(userData, userEdit);

    userEdit.setEid(StringUtils.lowerCase(userData.getEid()));
}

From source file:com.evolveum.midpoint.provisioning.test.impl.TestOpenDJ.java

@Test
public void test120AddAccountWill() throws Exception {
    final String TEST_NAME = "test120AddAccountWill";
    TestUtil.displayTestTile(TEST_NAME);

    OperationResult result = new OperationResult(TestOpenDJ.class.getName() + "." + TEST_NAME);

    ShadowType object = parseObjectType(ACCOUNT_WILL_FILE, ShadowType.class);

    System.out.println(SchemaDebugUtil.prettyPrint(object));
    System.out.println(object.asPrismObject().debugDump());

    Task task = taskManager.createTaskInstance();
    String addedObjectOid = provisioningService.addObject(object.asPrismObject(), null, null, task, result);
    assertEquals(ACCOUNT_WILL_OID, addedObjectOid);

    ShadowType repoShadowType = repositoryService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, result)
            .asObjectable();//w ww.  j av a2  s  .co  m
    PrismAsserts.assertEqualsPolyString("Name not equal (repo)", "uid=will,ou=People,dc=example,dc=com",
            repoShadowType.getName());
    assertAttribute(repoShadowType, getSecondaryIdentifierQName(), StringUtils.lowerCase(ACCOUNT_WILL_DN));

    ShadowType provisioningAccountType = provisioningService
            .getObject(ShadowType.class, ACCOUNT_WILL_OID, null, task, result).asObjectable();
    PrismAsserts.assertEqualsPolyString("Name not equal.", "uid=will,ou=People,dc=example,dc=com",
            provisioningAccountType.getName());

    assertShadows(1);
}

From source file:com.evolveum.midpoint.provisioning.test.impl.TestOpenDJ.java

@Test
public void test121RenameAccountWillOnResource() throws Exception {
    String TEST_NAME = "test121RenameAccountWillOnResource";
    TestUtil.displayTestTile(TEST_NAME);
    Task task = taskManager.createTaskInstance(TEST_NAME);
    OperationResult result = task.getResult();

    openDJController.executeRenameChange(TEST_DIR_NAME + "/rename.ldif");

    Entry entry = openDJController.fetchEntry("uid=will123,ou=People,dc=example,dc=com");
    assertNotNull("Entry with dn uid=will123,ou=People,dc=example,dc=com does not exist", entry);

    ShadowType repoShadowType = repositoryService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, result)
            .asObjectable();/*from   w  w  w  .ja  va2  s .com*/
    PrismAsserts.assertEqualsPolyString("Name not equal (repo)", "uid=will,ou=People,dc=example,dc=com",
            repoShadowType.getName());
    assertAttribute(repoShadowType, getSecondaryIdentifierQName(), StringUtils.lowerCase(ACCOUNT_WILL_DN));

    ShadowType provisioningAccountType = provisioningService
            .getObject(ShadowType.class, ACCOUNT_WILL_OID, null, task, result).asObjectable();
    PrismAsserts.assertEqualsPolyString("Name not equal.", "uid=will123,ou=People,dc=example,dc=com",
            provisioningAccountType.getName());
    assertAttribute(provisioningAccountType, getSecondaryIdentifierQName(),
            "uid=will123,ou=people,dc=example,dc=com");

    repoShadowType = repositoryService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, result)
            .asObjectable();
    PrismAsserts.assertEqualsPolyString("Name not equal (repo after provisioning)",
            "uid=will123,ou=People,dc=example,dc=com", repoShadowType.getName());
    assertAttribute(repoShadowType, getSecondaryIdentifierQName(), "uid=will123,ou=people,dc=example,dc=com");

    assertShadows(1);
}

From source file:eu.europa.esig.dss.DSSUtils.java

public static String getFinalFileName(DSSDocument originalFile, SigningOperation operation,
        SignatureLevel level) {//  w w w  .j av a2 s  . c  om
    StringBuffer finalName = new StringBuffer();
    String originalName = originalFile.getName();

    if (StringUtils.isNotEmpty(originalName)) {
        int dotPosition = originalName.lastIndexOf('.');
        if (dotPosition > 0) {
            // remove extension
            finalName.append(originalName.substring(0, dotPosition));
        } else {
            finalName.append(originalName);
        }
    } else {
        finalName.append("document");
    }

    if (SigningOperation.SIGN.equals(operation)) {
        finalName.append("-signed-");
    } else if (SigningOperation.EXTEND.equals(operation)) {
        finalName.append("-extended-");
    }

    finalName.append(StringUtils.lowerCase(level.name().replaceAll("_", "-")));
    finalName.append('.');

    SignatureForm signatureForm = level.getSignatureForm();
    switch (signatureForm) {
    case XAdES:
        finalName.append("xml");
        break;
    case CAdES:
        finalName.append("pkcs7");
        break;
    case PAdES:
        finalName.append("pdf");
        break;
    case ASiC_S:
        finalName.append("asics");
        break;
    case ASiC_E:
        finalName.append("asice");
        break;
    default:
        break;
    }

    return finalName.toString();
}

From source file:com.evolveum.midpoint.provisioning.impl.opendj.TestOpenDj.java

@Test
public void test120AddAccountWill() throws Exception {
    final String TEST_NAME = "test120AddAccountWill";
    TestUtil.displayTestTitle(TEST_NAME);

    Task task = createTask(TEST_NAME);/*from w w w  .ja  v  a 2  s . c o  m*/
    OperationResult result = task.getResult();

    ShadowType object = parseObjectType(ACCOUNT_WILL_FILE, ShadowType.class);

    System.out.println(SchemaDebugUtil.prettyPrint(object));
    System.out.println(object.asPrismObject().debugDump());

    String addedObjectOid = provisioningService.addObject(object.asPrismObject(), null, null, task, result);
    assertEquals(ACCOUNT_WILL_OID, addedObjectOid);

    ShadowType repoShadowType = getShadowRepo(ACCOUNT_WILL_OID).asObjectable();
    PrismAsserts.assertEqualsPolyString("Name not equal (repo)", "uid=will,ou=People,dc=example,dc=com",
            repoShadowType.getName());
    assertAttribute(repoShadowType, getSecondaryIdentifierQName(), StringUtils.lowerCase(ACCOUNT_WILL_DN));

    ShadowType provisioningAccountType = provisioningService
            .getObject(ShadowType.class, ACCOUNT_WILL_OID, null, task, result).asObjectable();
    PrismAsserts.assertEqualsPolyString("Name not equal.", "uid=will,ou=People,dc=example,dc=com",
            provisioningAccountType.getName());

    assertShadows(1 + getNumberOfBaseContextShadows());
}