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

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

Introduction

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

Prototype

public static String replace(String text, String searchString, String replacement) 

Source Link

Document

Replaces all occurrences of a String within another String.

Usage

From source file:com.sfs.whichdoctor.search.http.DebitBasicInputHandler.java

/**
 * Process the incoming HttpRequest for search parameters.
 *
 * @param request the request/*from w ww  .  j a  va  2  s .c  om*/
 * @param user the user
 *
 * @return the search bean
 */
public final SearchBean process(final HttpServletRequest request, final UserBean user) {

    SearchBean search = debitSqlHandler.initiate(user);

    String strBasicSearch = DataFilter.getHtml(request.getParameter("Search"));

    DebitBean searchCriteria = (DebitBean) search.getSearchCriteria();

    if (StringUtils.isNotBlank(strBasicSearch)) {
        // Replace ` with ' (` is given by dynamic searches in place of
        // ' due to Javascript issues
        searchCriteria.setBasicSearch(StringUtils.replace(strBasicSearch.trim(), "`", "'"));
    }
    search.setSearchCriteria(searchCriteria);

    return search;
}

From source file:com.sfs.whichdoctor.search.http.GroupBasicInputHandler.java

/**
 * Process the incoming HttpRequest for search parameters.
 *
 * @param request the request/*  w ww. j  a  v  a2s  .c  o  m*/
 * @param user the user
 *
 * @return the search bean
 */
public final SearchBean process(final HttpServletRequest request, final UserBean user) {

    SearchBean search = groupSqlHandler.initiate(user);

    String strBasicSearch = DataFilter.getHtml(request.getParameter("Search"));

    GroupBean searchCriteria = (GroupBean) search.getSearchCriteria();

    if (StringUtils.isNotBlank(strBasicSearch)) {
        // Replace ` with ' (` is given by dynamic searches in place of
        // ' due to Javascript issues
        searchCriteria.setBasicSearch(StringUtils.replace(strBasicSearch.trim(), "`", "'"));
    }
    search.setSearchCriteria(searchCriteria);

    return search;
}

From source file:com.sfs.whichdoctor.search.http.PersonBasicInputHandler.java

/**
 * Process the incoming HttpRequest for search parameters.
 *
 * @param request the request//ww  w. j  av  a  2 s  .  c  o  m
 * @param user the user
 *
 * @return the search bean
 */
public final SearchBean process(final HttpServletRequest request, final UserBean user) {

    SearchBean search = personSqlHandler.initiate(user);
    String strBasicSearch = DataFilter.getHtml(request.getParameter("Search"));

    PersonBean searchCriteria = (PersonBean) search.getSearchCriteria();

    if (StringUtils.isNotBlank(strBasicSearch)) {
        // Replace ` with ' (` is given by dynamic searches in place of
        // ' due to Javascript issues
        searchCriteria.setBasicSearch(StringUtils.replace(strBasicSearch.trim(), "`", "'"));
    }
    search.setSearchCriteria(searchCriteria);

    return search;
}

From source file:com.sfs.whichdoctor.search.http.CreditBasicInputHandler.java

/**
 * Process the incoming HttpRequest for search parameters.
 *
 * @param request the request/* w w  w  .  j ava2  s  .co  m*/
 * @param user the user
 *
 * @return the search bean
 */
public final SearchBean process(final HttpServletRequest request, final UserBean user) {

    SearchBean search = creditSqlHandler.initiate(user);

    String strBasicSearch = DataFilter.getHtml(request.getParameter("Search"));

    CreditBean searchCriteria = (CreditBean) search.getSearchCriteria();

    if (StringUtils.isNotBlank(strBasicSearch)) {
        // Replace ` with ' (` is given by dynamic searches in place of
        // ' due to Javascript issues
        searchCriteria.setBasicSearch(StringUtils.replace(strBasicSearch.trim(), "`", "'"));
    }
    search.setSearchCriteria(searchCriteria);

    return search;
}

From source file:com.hangum.tadpole.rdb.core.editors.table.TbUtils.java

/** ? ??  */
public static String getOriginalData(String value) {
    value = StringUtils.replace(value, TbUtils.MODIFY_DATA_START, ""); //$NON-NLS-1$
    value = StringUtils.replace(value, TbUtils.MODIFY_DATA_END, ""); //$NON-NLS-1$

    return XMLUtils.stringToXml(value);
}

From source file:com.jstar.eclipse.preferences.PreferenceConstants.java

public static String getSmtPath() {
    final String path = getStore().getString(PreferenceConstants.SMT_PATH_PREFERENCE);

    if (SystemUtils.IS_OS_WINDOWS) {
        return StringUtils.replace(path, "\\", "/");
    }/*from w w w .  j  av a2s.  c o m*/

    return path;
}

From source file:com.sfs.whichdoctor.search.http.ReceiptBasicInputHandler.java

/**
 * Process the incoming HttpRequest for search parameters.
 *
 * @param request the request/*from   www .j a  va 2  s. c o m*/
 * @param user the user
 *
 * @return the search bean
 */
public final SearchBean process(final HttpServletRequest request, final UserBean user) {

    SearchBean search = receiptSqlHandler.initiate(user);

    String strBasicSearch = DataFilter.getHtml(request.getParameter("Search"));

    ReceiptBean searchCriteria = (ReceiptBean) search.getSearchCriteria();

    if (StringUtils.isNotBlank(strBasicSearch)) {
        // Replace ` with ' (` is given by dynamic searches in place of
        // ' due to Javascript issues
        searchCriteria.setBasicSearch(StringUtils.replace(strBasicSearch.trim(), "`", "'"));
    }
    search.setSearchCriteria(searchCriteria);

    return search;
}

From source file:com.sfs.whichdoctor.search.http.RotationBasicInputHandler.java

/**
 * Process the incoming HttpRequest for search parameters.
 *
 * @param request the request/*from  w  ww  .j a v a 2 s .  c  o m*/
 * @param user the user
 *
 * @return the search bean
 */
public final SearchBean process(final HttpServletRequest request, final UserBean user) {

    SearchBean search = rotationSqlHandler.initiate(user);

    String strBasicSearch = DataFilter.getHtml(request.getParameter("Search"));

    RotationBean searchCriteria = (RotationBean) search.getSearchCriteria();

    if (StringUtils.isNotBlank(strBasicSearch)) {
        // Replace ` with ' (` is given by dynamic searches in place of
        // ' due to Javascript issues
        searchCriteria.setBasicSearch(StringUtils.replace(strBasicSearch.trim(), "`", "'"));
    }
    search.setSearchCriteria(searchCriteria);

    return search;
}

From source file:com.hangum.tadpole.rdb.core.editors.objects.table.TbUtils.java

/** ? ??  */
public static String getOriginalData(String value) {
    value = StringUtils.replace(value, TbUtils.MODIFY_DATA_START, ""); //$NON-NLS-1$
    value = StringUtils.replace(value, TbUtils.MODIFY_DATA_END, ""); //$NON-NLS-1$

    return StringEscapeUtils.unescapeXml(value);
}

From source file:info.magnolia.cms.i18n.DefaultMessagesImpl.java

/**
 * @return Returns the bundle for the current basename
 *///  w  w  w  .j  a  va2s . c o m
protected ResourceBundle getBundle() {
    if (bundle == null) {
        try {
            InputStream stream = ClasspathResourcesUtil.getStream("/" + StringUtils.replace(basename, ".", "/")
                    + "_" + getLocale().getLanguage() + "_" + getLocale().getCountry() + ".properties", false);
            if (stream == null) {
                stream = ClasspathResourcesUtil.getStream("/" + StringUtils.replace(basename, ".", "/") + "_"
                        + getLocale().getLanguage() + ".properties", false);
            }
            if (stream == null) {
                stream = ClasspathResourcesUtil.getStream("/" + StringUtils.replace(basename, ".", "/") + "_"
                        + MessagesManager.getDefaultLocale().getLanguage() + ".properties", false);
            }
            if (stream == null) {
                stream = ClasspathResourcesUtil
                        .getStream("/" + StringUtils.replace(basename, ".", "/") + ".properties", false);
            }

            if (stream != null) {
                bundle = new PropertyResourceBundle(stream);
            } else {
                bundle = ResourceBundle.getBundle(getBasename(), getLocale());
            }
        } catch (IOException e) {
            log.error("can't load messages for " + basename);
        }
    }
    return bundle;
}