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

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

Introduction

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

Prototype

public static String trim(String str) 

Source Link

Document

Removes control characters (char <= 32) from both ends of this String, handling null by returning null.

Usage

From source file:com.intuit.tank.report.JobReportOptions.java

public void setJobIdStart(String jobIdStart) {
    this.jobIdStart = StringUtils.trim(jobIdStart);
}

From source file:hudson.plugins.clearcase.ucm.UcmCommon.java

/**
 * @param clearToolLauncher/*from w  w  w  . j  av  a2 s.c o  m*/
 * @param isUseDynamicView
 * @param viewName
 * @param filePath
 * @param readWriteComponents . if null both baselines on read and read-write components will be returned
 * @return List of latest baselines on read write components (only)
 * @throws InterruptedException
 * @throws IOException
 * @throws Exception
 */
public static List<String> getLatestBaselineNames(ClearTool clearTool, boolean isUseDynamicView,
        String viewName, FilePath filePath, List<String> readWriteComponents)
        throws IOException, InterruptedException {
    String output = clearTool.lsstream(null, viewName, "%[latest_bls]Xp");
    String prefix = "baseline:";
    List<String> baselineNames = new ArrayList<String>();
    if (StringUtils.startsWith(output, prefix)) {
        String[] baselineNamesSplit = output.split("baseline:");
        for (String baselineName : baselineNamesSplit) {
            if (StringUtils.isNotBlank(baselineName)) {
                String baselineNameTrimmed = StringUtils.trim(baselineName);
                // Retrict to baseline bind to read/write component
                String blComp = getDataforBaseline(clearTool, filePath, baselineNameTrimmed).getBaselineName();
                if (readWriteComponents == null || readWriteComponents.contains(blComp)) {
                    baselineNames.add(baselineNameTrimmed);
                }
            }
        }

    }

    return baselineNames;
}

From source file:com.evolveum.midpoint.model.common.expression.functions.BasicExpressionFunctions.java

/**
 * Remove whitespaces at the beginning and at the end of the string.
 */
public static String trim(String orig) {
    return StringUtils.trim(orig);
}

From source file:com.seeyon.apps.m1.common.manager.menu.impl.MMenuManagerImpl.java

@Override
public MList<MMenuItemsCount> getMenusCount() throws BusinessException {
    MList<MMenuItemsCount> mlist = new MList<MMenuItemsCount>();
    List<MMenuItemsCount> list = new ArrayList<MMenuItemsCount>();
    MMenuItemsCount mcount = new MMenuItemsCount();
    // ????//from   www. j a  va  2 s  .c  o m
    mcount.setModuleType(MConstant.C_iModuleType_Collaboration);
    mcount.setCount(MMenuUtils.getColCount(colManager));
    list.add(mcount);
    // C_menu_log.info(
    // "**********************************???*************************" +
    // mcount.getCount());
    // ?
    mcount = new MMenuItemsCount();
    mcount.setModuleType(MConstant.C_iModuleType_EDoc);
    mcount.setCount(MMenuUtils.getEdocCount(edocListManager));
    list.add(mcount);
    // C_menu_log.info(
    // "***********************************************************" +
    // mcount.getCount());
    // ?
    if (mMeetingManager != null) {
        mcount = new MMenuItemsCount();
        mcount.setModuleType(MConstant.C_iModuleType_Meeting);
        mcount.setCount(MMenuUtils.getMMeetingCount(mMeetingManager));
        list.add(mcount);
    }

    try {
        // ?32??
        String ssoTicket = mloginManager.getDataByLoginname(AppContext.currentUserLoginName());
        if (ssoTicket != null) {
            InputStream input = null;
            input = MLoginManagerImpl.class.getClassLoader().getResourceAsStream("getMessage.properties");
            Properties config = new Properties();
            config.load(input);
            String app1Url = StringUtils.trim((String) config.get("app1Url"));
            String app2Url = StringUtils.trim((String) config.get("app2Url"));
            String app3Url = StringUtils.trim((String) config.get("app3Url"));

            mcount = new MMenuItemsCount();
            mcount.setModuleType(2001);
            if (app1Url != null && app1Url.length() > 10) {
                if (app1Url.indexOf("?") == -1) {
                    app1Url = app1Url + "?ticket=" + ssoTicket;
                } else {
                    app1Url = app1Url + "&ticket=" + ssoTicket;
                }
            }
            mcount.setCount(getNum(app1Url));
            list.add(mcount);

            mcount = new MMenuItemsCount();
            mcount.setModuleType(2002);
            if (app2Url != null && app2Url.length() > 10) {
                if (app2Url.indexOf("?") == -1) {
                    app2Url = app2Url + "?ticket=" + ssoTicket;
                } else {
                    app2Url = app2Url + "&ticket=" + ssoTicket;
                }
            }
            mcount.setCount(getNum(app2Url));
            list.add(mcount);

            mcount = new MMenuItemsCount();
            mcount.setModuleType(2003);
            if (app3Url != null && app3Url.length() > 10) {
                if (app3Url.indexOf("?") == -1) {
                    app3Url = app3Url + "?ticket=" + ssoTicket;
                } else {
                    app3Url = app3Url + "&ticket=" + ssoTicket;
                }
            }
            mcount.setCount(getNum(app3Url));
            list.add(mcount);
        }

    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    mlist.setValue(list);
    return mlist;
}

From source file:com.qualogy.qafe.bind.resource.query.Call.java

/**
 * parse the calls name from a fullblown statement
 * /*from w w  w.  j a va2  s .c o m*/
 *    { call ? = cursors_pkg.getdirect( from_city ?, to_city ?) }
 *    { call cursors_pkg.getdirect( from_city ?, to_city ?) }
 * 
 * @param call
 * @return
 */
private String parseProcedureNameFromSQL(String call) {
    int start = 0;

    if (call.indexOf(CALLABLESTATEMENT_KEYWORD) != -1) {
        start = call.indexOf(CALLABLESTATEMENT_KEYWORD) + CALLABLESTATEMENT_KEYWORD.length();
    }

    call = call.substring(start);

    if (call.indexOf("=") > 0)
        call = call.substring(call.indexOf("=") + 1);

    call = StringUtils.trim(call);

    if (call.indexOf(" ") > -1)
        call = call.substring(0, call.indexOf(" "));
    if (call.indexOf("(") > -1)
        call = call.substring(0, call.indexOf("("));
    if (call.indexOf(";") > -1)
        call = call.substring(0, call.indexOf(";"));

    return call;
}

From source file:com.thalesgroup.sonar.plugins.tusar.TUSARResource.java

/**
 * Creates a file from its containing directory and name
 *///from w w  w  . ja  v a 2  s  .  co  m
public TUSARResource(String directory, String filename, boolean unitTest) {
    this.filename = StringUtils.trim(filename);
    if (StringUtils.isBlank(directory)) {
        setKey(filename);

    } else {
        this.directoryKey = Directory.parseKey(directory);
        setKey(new StringBuilder().append(directoryKey).append(Directory.SEPARATOR).append(this.filename)
                .toString());
    }
    this.unitTest = unitTest;
}

From source file:eu.annocultor.data.destinations.SolrServer.java

public SolrServer(String datasetId, Environment environment, String datasetModifier, String objectType,
        String propertyType, String... comment) {
    super(datasetId, environment, datasetModifier, objectType, propertyType, "txt", comment);
    solrUrl = comment[0];/*from  www  . j a  v  a2  s  .c  om*/
    try {
        String location = comment[1];
        InputStream is = location.startsWith("http://") ? new URL(location).openStream()
                : new FileInputStream(location);
        for (String line : IOUtils.readLines(is, "UTF-8")) {
            String trimmedLine = StringUtils.trim(line);
            if (trimmedLine.startsWith("<field name=") || trimmedLine.startsWith("<dynamicField name=")) {
                final FieldDefinition fieldDefinition = new FieldDefinition(line);
                fieldDefinitions.put(fieldDefinition.getName(), fieldDefinition);
            }
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:au.org.ala.bhl.DocumentPaginator.java

private void paginateImpl(XMLStreamReader parser, PageHandler handler) throws Exception {

    if (parser == null) {
        return;//from   www.  j  av a 2 s  .co m
    }

    StringBuilder buffer = new StringBuilder();

    String currentPage = null;

    while (true) {
        int event = parser.next();
        if (event == XMLStreamConstants.END_DOCUMENT) {
            parser.close();
            break;
        }

        if (event == XMLStreamConstants.START_ELEMENT) {
            if (parser.getLocalName().equals("PARAM")) {
                String attrName = parser.getAttributeValue("", "name");
                if (attrName.equals("PAGE")) {

                    if (!StringUtils.isEmpty(currentPage)) {
                        if (handler != null) {
                            handler.handlePage(currentPage, buffer.toString());
                        }
                    }

                    buffer = new StringBuilder();
                    currentPage = parser.getAttributeValue("", "value");
                }
            }
        }

        if (event == XMLStreamConstants.CHARACTERS) {
            String value = StringUtils.trim(parser.getText());
            if (!StringUtils.isEmpty(value)) {
                buffer.append(value).append(" ");
            }
        }
    }

}

From source file:gemlite.core.internal.domain.utilClass.DBDataSource.java

@Override
public UUID getUUID(String name) {
    String str = "";
    try {//from  w w  w .ja  va2 s . c  o  m
        str = StringUtils.trim(rs.getString(name));
    } catch (SQLException e) {
        LogUtil.getCoreLog().error(name, e);
    }
    return UUID.fromString(str);
}

From source file:jp.ikedam.jenkins.plugins.viewcopy_builder.SetRegexOperation.java

@DataBoundConstructor
public SetRegexOperation(String regex) {
    this.regex = StringUtils.trim(regex);
}