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:com.zb.app.web.controller.manage.ManageController.java

/**
 * //from  w  w  w  .  j  a v a 2s . co m
 * 
 * @param mav
 * @param travelMemberVO
 * @return
 */
@RequestMapping(value = "/company/addUser.htm", produces = "application/json", method = RequestMethod.POST)
@ResponseBody
public JsonResult addUser(ModelAndView mav, TravelMemberVO travelMemberVO, Long cId) {
    TravelMemberDO travelMemberDO = new TravelMemberDO();
    BeanUtils.copyProperties(travelMemberDO, travelMemberVO);
    travelMemberDO.setmPassword(EncryptBuilder.getInstance().encrypt(travelMemberVO.getmPassword()));
    travelMemberDO.setmUserName(StringUtils.lowerCase(travelMemberVO.getmUserName()));

    if (StringUtils.isNotEmpty(travelMemberVO.getmRole())) {
        String role = AuthorityHelper.createRightStr(travelMemberVO.getmRole());
        travelMemberDO.setmRole(role);
    }

    Integer i = memberService.insert(travelMemberDO);
    return i == 0 ? JsonResultUtils.error(travelMemberDO, "!")
            : JsonResultUtils.success(travelMemberDO, "?!");
}

From source file:com.hangum.tadpole.rdb.core.editors.main.utils.ExtMakeContentAssistUtil.java

/**
 * List of assist table column name/*from   ww  w .  j  av a  2 s  . com*/
 * 
 * @param userDB
 * @param tableName
 * @return
 */
public String getAssistColumnList(final UserDBDAO userDB, final String tableName) {
    String strColumnlist = ""; //$NON-NLS-1$

    String strSchemaName = "";
    String strTableName = tableName;
    if (userDB.getDBDefine() != DBDefine.ALTIBASE_DEFAULT) {
        if (StringUtils.contains(tableName, '.')) {
            String[] arrTblInfo = StringUtils.split(tableName, ".");
            strSchemaName = arrTblInfo[0];
            strTableName = arrTblInfo[1];
        }
    }

    // ?     ? ?? ? ?  ?  . 
    TadpoleMetaData tadpoleMetaData = TadpoleSQLManager.getDbMetadata(userDB);
    if (tadpoleMetaData.getSTORE_TYPE() == TadpoleMetaData.STORES_FIELD_TYPE.LOWCASE_BLANK) {
        strSchemaName = StringUtils.upperCase(strSchemaName);
        strTableName = StringUtils.upperCase(strTableName);
    } else if (tadpoleMetaData.getSTORE_TYPE() == TadpoleMetaData.STORES_FIELD_TYPE.UPPERCASE_BLANK) {
        strSchemaName = StringUtils.lowerCase(strSchemaName);
        strTableName = StringUtils.lowerCase(strTableName);
    }

    try {
        TableDAO table = new TableDAO(strTableName, "");
        table.setSysName(strTableName);
        table.setSchema_name(strSchemaName);
        table.setName(strTableName);

        List<TableColumnDAO> showTableColumns = TadpoleObjectQuery.getTableColumns(userDB, table);
        for (TableColumnDAO tableDao : showTableColumns) {
            strColumnlist += tableDao.getSysName() + _PRE_DEFAULT + tableDao.getType() + _PRE_GROUP; //$NON-NLS-1$
        }
        strColumnlist = StringUtils.removeEnd(strColumnlist, _PRE_GROUP); //$NON-NLS-1$
    } catch (Exception e) {
        logger.error("MainEditor get the table column list", e); //$NON-NLS-1$
    }

    return strColumnlist;
}

From source file:br.com.bropenmaps.util.Util.java

/**
 *  Verifica se duas strings so iguais independentemente da caixa e dos acentos
 * @param p1/*from w  w  w.  j a v  a2  s.com*/
 * @param p2
 * @return true se so iguais, false em caso contrrio
 */
public static boolean verificaIgualdadeCaseInsensitiveSemAcento(String p1, String p2) {

    if (p1 == null || p2 == null) {

        return false;

    }

    p1 = regExpPalavrasAcentuadas(StringUtils.lowerCase(p1));

    final Pattern p = Pattern.compile(p1, Pattern.CASE_INSENSITIVE);

    Matcher m = p.matcher(p2);

    if (m.find()) {

        return true;

    } else {

        return false;

    }

}

From source file:edu.upenn.mkse212.pennbook.server.UserServiceImpl.java

private String likeClauses(String term) {
    final String TEMPLATE = "%s LIKE '%s%%'";
    String[] subterms = term.split(" ");
    ArrayList<String> variants = new ArrayList<String>();
    for (int i = 0; i < subterms.length && i < 4; i++) {
        String[] clauses = new String[4];
        //lowercase and capitalized (but not all uppercase) forms for first name and last name
        clauses[0] = String.format(TEMPLATE, LAST_NAME_ATTR, StringUtils.capitalize(subterms[i]));
        clauses[1] = String.format(TEMPLATE, LAST_NAME_ATTR, StringUtils.lowerCase(subterms[i]));
        clauses[2] = String.format(TEMPLATE, FIRST_NAME_ATTR, StringUtils.capitalize(subterms[i]));
        clauses[3] = String.format(TEMPLATE, FIRST_NAME_ATTR, StringUtils.lowerCase(subterms[i]));
        variants.add("(" + StringUtils.join(clauses, " OR ") + ")");
    }//from w ww .  j a va 2  s . c  o m
    return StringUtils.join(variants, " AND ");
}

From source file:br.com.diegosilva.jsfcomponents.util.Utils.java

public static String lower(String value) {
    return WordUtils.capitalize(StringUtils.lowerCase(value));
}

From source file:com.gst.portfolio.loanaccount.rescheduleloan.data.LoanRescheduleRequestDataValidator.java

/**
 * Validates a user request to approve a loan reschedule request
 * //from  w  ww.jav  a 2  s  .  c o  m
 * @param jsonCommand
 *            the JSON command object (instance of the JsonCommand class)
 * @return void
 **/
public void validateForApproveAction(final JsonCommand jsonCommand,
        LoanRescheduleRequest loanRescheduleRequest) {
    final String jsonString = jsonCommand.json();

    if (StringUtils.isBlank(jsonString)) {
        throw new InvalidJsonException();
    }

    final Type typeToken = new TypeToken<Map<String, Object>>() {
    }.getType();
    this.fromJsonHelper.checkForUnsupportedParameters(typeToken, jsonString,
            RescheduleLoansApiConstants.APPROVE_REQUEST_DATA_PARAMETERS);

    final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
    final DataValidatorBuilder dataValidatorBuilder = new DataValidatorBuilder(dataValidationErrors)
            .resource(StringUtils.lowerCase(RescheduleLoansApiConstants.ENTITY_NAME));

    final JsonElement jsonElement = jsonCommand.parsedJson();

    final LocalDate approvedOnDate = this.fromJsonHelper
            .extractLocalDateNamed(RescheduleLoansApiConstants.approvedOnDateParam, jsonElement);
    dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.approvedOnDateParam)
            .value(approvedOnDate).notNull();

    if (approvedOnDate != null && loanRescheduleRequest.getSubmittedOnDate().isAfter(approvedOnDate)) {
        dataValidatorBuilder.reset().parameter(RescheduleLoansApiConstants.approvedOnDateParam).failWithCode(
                "before.submission.date", "Approval date cannot be before the request submission date.");
    }

    LoanRescheduleRequestStatusEnumData loanRescheduleRequestStatusEnumData = LoanRescheduleRequestEnumerations
            .status(loanRescheduleRequest.getStatusEnum());

    if (!loanRescheduleRequestStatusEnumData.isPendingApproval()) {
        dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode(
                "request.is.not.in.submitted.and.pending.state",
                "Loan reschedule request approval is not allowed. "
                        + "Loan reschedule request is not in submitted and pending approval state.");
    }

    LocalDate rescheduleFromDate = loanRescheduleRequest.getRescheduleFromDate();
    final Loan loan = loanRescheduleRequest.getLoan();
    LoanRepaymentScheduleInstallment installment = null;
    if (loan != null) {

        if (!loan.status().isActive()) {
            dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode("loan.is.not.active",
                    "Loan is not active");
        }

        if (rescheduleFromDate != null) {
            installment = loan.getRepaymentScheduleInstallment(rescheduleFromDate);

            if (installment == null) {
                dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode(
                        "loan.repayment.schedule.installment.does.not.exist",
                        "Repayment schedule installment does not exist");
            }

            if (installment != null && installment.isObligationsMet()) {
                dataValidatorBuilder.reset().failWithCodeNoParameterAddedToErrorCode(
                        "loan.repayment.schedule.installment." + "obligation.met",
                        "Repayment schedule installment obligation met");
            }
        }
    }

    validateForOverdueCharges(dataValidatorBuilder, loan, installment);

    if (!dataValidationErrors.isEmpty()) {
        throw new PlatformApiDataValidationException(dataValidationErrors);
    }
}

From source file:com.liferay.cucumber.util.StringUtil.java

public static String toLowerCase(String s) {
    if (s == null) {
        return null;
    }//from  w w w  . ja  va  2  s.  com

    return StringUtils.lowerCase(s);
}

From source file:mitm.djigzo.web.services.SecurityModule.java

public void contributeHttpServletRequestHandler(OrderedConfiguration<HttpServletRequestFilter> configuration,
        @Inject @Value("${access-denied-page}") final String accessDeniedPage) {
    /*//from   ww w  . j av  a 2 s.c o m
     * Create a filter that will block access to some assets. The asset service allows access to some assets we do
     * not want to expose. The asset service will show all files in /assets/ directory and allows you (by default)
     * to download some files which you do not want to expose.
     */
    HttpServletRequestFilter filter = new HttpServletRequestFilter() {
        @Override
        public boolean service(HttpServletRequest request, HttpServletResponse response,
                HttpServletRequestHandler handler) throws IOException {
            String path = request.getServletPath();

            if (path.startsWith("/assets")
                    && (!assetsWhitelist.contains(StringUtils.lowerCase(FilenameUtils.getExtension(path))))) {
                logger.warn("access to asset " + path + " denied");

                response.sendRedirect(request.getContextPath() + "/" + accessDeniedPage);

                return true;
            }

            return handler.service(request, response);
        }
    };

    configuration.add("AssetProtectionFilter", filter, "before:*");
}

From source file:com.haulmont.cuba.desktop.gui.components.DesktopSearchField.java

protected void handleSearch(final String newFilter) {
    clearSearchVariants();//from   www  .  j a va 2  s .  com

    String filterForDs = newFilter;
    if (mode == Mode.LOWER_CASE) {
        filterForDs = StringUtils.lowerCase(newFilter);
    } else if (mode == Mode.UPPER_CASE) {
        filterForDs = StringUtils.upperCase(newFilter);
    }

    if (escapeValueForLike && StringUtils.isNotEmpty(filterForDs)) {
        filterForDs = QueryUtils.escapeForLike(filterForDs);
    }

    if (!isRequired() && StringUtils.isEmpty(filterForDs)) {
        if (optionsDatasource.getState() == Datasource.State.VALID) {
            optionsDatasource.clear();
        }

        setValue(null);
        updateOptionsDsItem();
        return;
    }

    if (StringUtils.length(filterForDs) >= minSearchStringLength) {
        optionsDatasource
                .refresh(Collections.singletonMap(SearchField.SEARCH_STRING_PARAM, (Object) filterForDs));

        if (optionsDatasource.getState() == Datasource.State.VALID) {
            if (optionsDatasource.size() == 0) {
                if (searchNotifications != null)
                    searchNotifications.notFoundSuggestions(newFilter);
            } else if (optionsDatasource.size() == 1) {
                setValue(optionsDatasource.getItems().iterator().next());
                updateOptionsDsItem();
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        updateComponent(getValue());
                    }
                });
            } else {
                initSearchVariants();
                comboBox.showSearchPopup();
            }
        }
    } else {
        if (optionsDatasource.getState() == Datasource.State.VALID) {
            optionsDatasource.clear();
        }

        if (searchNotifications != null && StringUtils.length(filterForDs) > 0) {
            searchNotifications.needMinSearchStringLength(newFilter, minSearchStringLength);
        }
    }
}

From source file:io.swagger.codegen.languages.SwiftCodegen.java

public String toSwiftyEnumName(String value) {
    // Prevent from breaking properly cased identifier
    if (value.matches("[A-Z][a-z0-9]+[a-zA-Z0-9]*")) {
        return value;
    }/*from w ww  .  j av  a 2 s . c  o  m*/
    char[] separators = { '-', '_', ' ' };
    return WordUtils.capitalizeFully(StringUtils.lowerCase(value), separators).replaceAll("[-_ ]", "");
}