Example usage for org.apache.commons.lang3 StringUtils upperCase

List of usage examples for org.apache.commons.lang3 StringUtils upperCase

Introduction

In this page you can find the example usage for org.apache.commons.lang3 StringUtils upperCase.

Prototype

public static String upperCase(final String str) 

Source Link

Document

Converts a String to upper case as per String#toUpperCase() .

A null input String returns null .

 StringUtils.upperCase(null)  = null StringUtils.upperCase("")    = "" StringUtils.upperCase("aBc") = "ABC" 

Note: As described in the documentation for String#toUpperCase() , the result of this method is affected by the current locale.

Usage

From source file:org.meruvian.yama.web.security.DefaultUserDetailsService.java

@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    User user = userRepository.findByUsername(username);

    if (user != null) {
        boolean enabled = user.getLogInformation().getActiveFlag() == LogInformation.ACTIVE;

        List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
        Page<? extends UserRole> userRoles = userRoleRepository.findByUserId(user.getId(), null);
        for (UserRole userRole : userRoles) {
            Role role = userRole.getRole();
            authorities.add(new SimpleGrantedAuthority(StringUtils.upperCase(role.getName())));
        }//from  www.ja  v  a 2 s  . c om

        DefaultUserDetails details = new DefaultUserDetails(user.getUsername(), user.getPassword(), enabled,
                true, true, true, authorities);
        details.setId(user.getId());
        details.setUser(user);

        return details;
    }

    throw new UsernameNotFoundException(username);
}

From source file:it.volaconnoi.servlet.CheckInServlet.java

/**
 * Handles the HTTP <code>POST</code> method.
 *
 * @param request servlet request//from   www.java 2s.  c  om
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String reserv_id = request.getParameter("reserv_id");

    List<Reservation> reserv = reservationBean.getValidReservation(StringUtils.upperCase(reserv_id));

    if (reserv != null) {
        request.setAttribute("reserv", reserv.get(0));
    } else {
        request.setAttribute("notfoundreserv", "Nessuna prenotazione corrispondete al PNR inserito!");
    }

    request.getRequestDispatcher("/WEB-INF/checkin/checkin.jsp").forward(request, response);
}

From source file:io.wcm.devops.conga.plugins.aem.handlebars.helper.AbstractFilter.java

/**
 * Gets and removes type and casts it to enum.
 * @param map Map//from   www .j a v a2  s .  c  o m
 * @param enumType Type class
 * @return Type value - never null
 */
protected final <T extends Enum<T>> T getFilterType(Map<String, Object> map, Class<T> enumType) {
    String typeValue = getValue(map, "type");
    if (typeValue == null) {
        throw new IllegalArgumentException("Type expression missing.");
    }
    return Enum.valueOf(enumType, StringUtils.upperCase(typeValue));
}

From source file:ch.cyberduck.core.local.FinderLocalTest.java

@Test
public void testNoCaseSensitive() throws Exception {
    final String name = UUID.randomUUID().toString();
    FinderLocal l = new FinderLocal(System.getProperty("java.io.tmpdir"), name);
    new DefaultLocalTouchFeature().touch(l);
    assertTrue(l.exists());//from  w  w  w.j av  a 2s . c o m
    assertTrue(new FinderLocal(System.getProperty("java.io.tmpdir"), StringUtils.upperCase(name)).exists());
    assertTrue(new FinderLocal(System.getProperty("java.io.tmpdir"), StringUtils.lowerCase(name)).exists());
    l.delete();
}

From source file:com.book.identification.task.BookSearch.java

@Override
public void run() {

    List<Volume> volumes = DAOFactory.getInstance().getVolumeDAO().findAll();

    for (Volume volume : volumes) {
        indexedFiles.add(new File(volume.getPath()));
    }//from  ww  w .  java2  s  .  c  o  m
    Collection<File> entries = FileUtils.listFiles(root, new SuffixFileFilter(new String[] { ".pdf", ".chm" }),
            TrueFileFilter.INSTANCE);
    for (File fileToProcces : entries) {

        String fileSHA1 = null;
        try {
            fileSHA1 = DigestUtils.shaHex(FileUtils.openInputStream(fileToProcces));
        } catch (IOException e1) {
            continue;
        }
        logger.info("Accepted file -> " + fileToProcces.getName() + " Hash -> " + fileSHA1);
        FileType fileType = FileType
                .valueOf(StringUtils.upperCase(FilenameUtils.getExtension(fileToProcces.getName())));
        try {
            fileQueue.put(new BookFile(fileToProcces, fileSHA1, fileType));
        } catch (InterruptedException e) {
            logger.info(e);
        }
    }
    nextWorker.notifyEndProducers();
}

From source file:com.example.opendj.ExamplePlugin.java

@Override
public PluginResult.Startup doStartup() {
    // Log the provided message.
    logger.info(NOTE_DO_STARTUP, StringUtils.upperCase(config.getMessage()));
    return PluginResult.Startup.continueStartup();
}

From source file:ca.on.oicr.pde.workflows.GATK3Workflow.java

public void init() {
    for (String s : StringUtils.split(getProperty(ANNOTKEY), ",")) {
        variantCallers.add(VariantCaller.valueOf(StringUtils.upperCase(s)));
    }//from w  w w  . j  av  a  2s .  c  o  m
}

From source file:edu.emory.bmi.aiw.i2b2export.output.VisitDataRowOutputFormatter.java

@Override
protected Collection<Observation> matchingObservations(I2b2ConceptEntity i2b2Concept) throws SQLException {
    switch (StringUtils.upperCase(i2b2Concept.getTableName())) {
    case "CONCEPT_DIMENSION":
        List<Observation> obxs = this.keyToObx.get(i2b2Concept.getI2b2Key());
        if (obxs != null) {
            return Collections.unmodifiableCollection(obxs);
        } else {/*from   w  w  w .  j  a  v a2s.  c  o m*/
            return Collections.emptyList();
        }
    case "PATIENT_DIMENSION":
        Patient patient = this.visit.getPatient();
        if (compareDimensionColumnValue(i2b2Concept, patient)) {
            Observation.Builder b = new Observation.Builder(this.visit).tval(getParam(patient, i2b2Concept));
            Collection<Observation> o = Collections.singleton(b.build());
            return o;
        } else {
            return Collections.emptyList();
        }
    case "VISIT_DIMENSION":
        return null;
    default:
        return Collections.emptyList();
    }

}

From source file:de.jfachwert.bank.GeldbetragFormatter.java

private Geldbetrag parse(String text) throws MonetaryParseException {
    String trimmed = new NullValidator<String>().validate(text).trim();
    String[] parts = StringUtils.splitByCharacterType(StringUtils.upperCase(trimmed));
    if (parts.length == 0) {
        throw new InvalidValueException(text, "money amount");
    }/*from   w ww.j  a v  a  2 s  . c om*/
    Currency cry = Waehrung.DEFAULT_CURRENCY;
    String currencyString = findCurrencyString(parts);
    try {
        if (StringUtils.isNotEmpty(currencyString)) {
            cry = Waehrung.toCurrency(currencyString);
            trimmed = StringUtils.remove(trimmed, currencyString).trim();
        }
        BigDecimal n = new BigDecimal(new NumberValidator().validate(trimmed));
        return Geldbetrag.of(n, cry);
    } catch (IllegalArgumentException ex) {
        throw new LocalizedMonetaryParseException(text, ex);
    }
}

From source file:com.sonicle.webtop.core.dal.AutosaveDAO.java

public OAutosave select(Connection con, String domainId, String userId, String webtopClientId, String serviceId,
        String context, String key) throws DAOException {
    DSLContext dsl = getDSL(con);//from w  w  w  .  j ava  2  s  .  c o m
    return dsl
            .select(AUTOSAVE.DOMAIN_ID, AUTOSAVE.USER_ID, AUTOSAVE.WEBTOP_CLIENT_ID, AUTOSAVE.SERVICE_ID,
                    AUTOSAVE.CONTEXT, AUTOSAVE.KEY, AUTOSAVE.VALUE)
            .from(AUTOSAVE)
            .where(AUTOSAVE.DOMAIN_ID.equal(domainId).and(AUTOSAVE.USER_ID.equal(userId))
                    .and(AUTOSAVE.WEBTOP_CLIENT_ID.equal(webtopClientId))
                    .and(AUTOSAVE.SERVICE_ID.equal(serviceId)).and(AUTOSAVE.CONTEXT.equal(context))
                    .and(AUTOSAVE.KEY.equal(StringUtils.upperCase(key))))
            .fetchOneInto(OAutosave.class);
}