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

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

Introduction

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

Prototype

public static String[] split(String str, String separatorChars) 

Source Link

Document

Splits the provided text into an array, separators specified.

Usage

From source file:com.neusoft.mid.clwapi.threadwork.MtMsgSendWorkThread.java

public void run() {
    if (null != msgInfo) {

        logger.info("VINS?:" + msgInfo.getVin());
        String[] vinArray = StringUtils.split(StringUtils.strip(msgInfo.getVin()), "|");
        logger.info("???" + vinArray.length + "");
        // ?./* w w  w. j a va 2  s .c o m*/
        String batchId = UUID.randomUUID().toString().replaceAll("-", "");
        for (String vin : vinArray) {
            String msgId = createMsgId();
            MDC.put("SUB_ID", "[" + msgId + "]");
            try {
                logger.info("vin:" + vin + "");
                TerminalViBean terminalInfo = (TerminalViBean) msgMapper.getRealVehcileByVin(vin);
                // ????
                if (isMsgPassable(vin, terminalInfo)) {
                    logger.info("VIN:" + vin + "??????");
                    SendCommandInfo info = initDiaoduCommandInfo(vin, msgInfo.getMsg(), msgInfo.getType(),
                            terminalInfo.getSimCardNum(), batchId, msgId, msgInfo.getUserId());
                    if (null != info) {
                        // ?????
                        sendDeliverMsgService.sendCommandToCoreService(info);

                    } else {
                        logger.info("???,??");
                    }
                } else {
                    logger.info("VIN:" + vin + "????");
                }
            } catch (DataAccessException e) {
                logger.error("??vin:" + vin + "?", e);
            } catch (Exception e) {
                logger.error("vin:" + vin + "??", e);
            }
            MDC.remove("SUB_ID");
        }
    }

}

From source file:com.adobe.acs.tools.csv.impl.Column.java

public Column(final String raw, final int index) {
    this.index = index;
    this.raw = StringUtils.trim(raw);

    String paramsStr = StringUtils.substringBetween(raw, "{{", "}}");
    String[] params = StringUtils.split(paramsStr, ":");

    if (StringUtils.isBlank(paramsStr)) {
        this.propertyName = this.getRaw();
    } else {/*  w  ww .  j ava  2s  .c om*/
        this.propertyName = StringUtils.trim(StringUtils.substringBefore(this.getRaw(), "{{"));

        if (params.length == 2) {
            this.dataType = nameToClass(StringUtils.stripToEmpty(params[0]));
            this.multi = StringUtils.equalsIgnoreCase(StringUtils.stripToEmpty(params[1]), MULTI);
        }

        if (params.length == 1) {
            if (StringUtils.equalsIgnoreCase(MULTI, StringUtils.stripToEmpty(params[0]))) {
                this.multi = true;
            } else {
                this.dataType = nameToClass(StringUtils.stripToEmpty(params[0]));
            }
        }
    }
}

From source file:com.groupon.jenkins.dynamic.build.api.QueuedBuild.java

@Override
public BuildCause.CommitInfo getCommit() {
    final String[] buildParams = StringUtils.split(this.item.getParams(), "\n");
    String branch = "";
    for (final String buildParam : buildParams) {
        if (buildParam.startsWith("BRANCH=")) {
            branch = StringUtils.split(buildParam, "=")[1];
        }//from   w  ww .j  a v a  2  s.co m
    }
    return new BuildCause.CommitInfo("Queued: " + this.item.getWhy(), this.item.getInQueueForString(), branch);
}

From source file:gov.nih.nci.cabig.caaers.domain.Notification.java

@Transient
public List<String> getRecipientRoles() {
    if (StringUtils.isEmpty(roles))
        return new ArrayList<String>();
    return Arrays.asList(StringUtils.split(roles, ','));
}

From source file:de.stefanbohne.ubiqlip.messaging.MIMEParse.java

/**
 * Carves up a mime-type and returns a ParseResults object
 *
 * For example, the media range 'application/xhtml;q=0.5' would get parsed
 * into:/*w  w  w  . j a  va 2 s.  co  m*/
 *
 * ('application', 'xhtml', {'q', '0.5'})
 */
public static ParseResults parseMimeType(String mimeType) {
    String[] parts = StringUtils.split(mimeType, ";");
    ParseResults results = new ParseResults();
    results.params = new HashMap<String, String>();

    for (int i = 1; i < parts.length; ++i) {
        String p = parts[i];
        String[] subParts = StringUtils.split(p, '=');
        if (subParts.length == 2)
            results.params.put(subParts[0].trim(), subParts[1].trim());
    }
    String fullType = parts[0].trim();

    // Java URLConnection class sends an Accept header that includes a
    // single "*" - Turn it into a legal wildcard.
    if (fullType.equals("*"))
        fullType = "*/*";
    String[] types = StringUtils.split(fullType, "/");
    results.type = types[0].trim();
    results.subType = types[1].trim();
    return results;
}

From source file:com.mks.zookeeper.addrs.url.UrlAddressReader.java

@Override
public String read() {
    String[] urls = StringUtils.split(url, SPLIT_CHAR);
    String addrs = null;// ww  w  .  j  a v a 2s . co  m
    for (String url : urls) {
        addrs = read(url);
    }
    if (StringUtils.isBlank(addrs))
        throw new ReaderException("empty!");
    return StringUtils.trim(addrs);
}

From source file:net.ageto.gyrex.impex.common.steps.impl.misc.SplitByDelimiter.java

@Override
protected StatusStep process() {

    @SuppressWarnings("unchecked")
    ArrayList<String> list = (ArrayList<String>) getInputParam(
            SplitByDelimiterDefinition.InputParamNames.STRING_LIST.name());

    if (list == null) {
        processError("{0} missing input.", ID);
        return StatusStep.ERROR;
    }// w  w  w . ja v  a2s  .c o  m

    String delimiter = (String) getInputParam(SplitByDelimiterDefinition.InputParamNames.DELIMITER.name());

    if (delimiter == null) {
        processError(ID + " missing delimiter input.");
        return StatusStep.ERROR;
    }

    ArrayList<String[]> lines = new ArrayList<String[]>();

    // add lines to data pool
    for (String line : list) {
        lines.add(StringUtils.split(line, delimiter));
    }

    setOutputParam(OutputParamNames.STRING_LIST.name(), lines);

    processInfo("{0} has been completed successfully.", ID);

    return StatusStep.OK;
}

From source file:de.thischwa.pmcms.tool.connection.PathConstructor.java

public String[] getDirs() {
    if (sb.length() == 0 || sb.toString().equals("" + separator))
        return new String[] {};
    String string = sb.toString();
    if (!string.contains("" + separator))
        return new String[] { string };
    return StringUtils.split(string, separator);
}

From source file:hudson.plugins.clearcase.ucm.service.ProjectService.java

public Component[] getModifiableComponents(Project project) throws IOException, InterruptedException {
    Reader reader = clearTool.describe("%[mod_comps]Xp", null, project.getSelector());
    String output = IOUtils.toString(reader);
    if (ClearCaseUtils.isCleartoolOutputValid(output)) {
        String[] split = StringUtils.split(output, ' ');
        Component[] components = new Component[split.length];
        for (int i = 0; i < split.length; i++) {
            components[i] = UcmSelector.parse(split[i], Component.class);
        }//from ww w . j a  va 2 s.  c  o m
        return components;
    }
    throw new IOException(output);
}

From source file:com.hangum.tadpole.engine.sql.util.executer.procedure.PostgreSQLProcedureExecuter.java

/**
 * execute script// w  w w . j  a  va2s .com
 */
public String getMakeExecuteScript() throws Exception {
    StringBuffer sbQuery = new StringBuffer();
    if (!"".equals(procedureDAO.getPackagename())) {
        sbQuery.append("SELECT " + procedureDAO.getPackagename() + "." + procedureDAO.getSysName() + "(");
    } else {
        sbQuery.append("SELECT " + procedureDAO.getSysName() + "(");
    }

    List<InOutParameterDAO> inList = getInParameters();
    InOutParameterDAO inOutParameterDAO = inList.get(0);
    String[] inParams = StringUtils.split(inOutParameterDAO.getRdbType(), ",");
    for (int i = 0; i < inParams.length; i++) {
        String name = StringUtils.trimToEmpty(inParams[i]);

        if (i == (inParams.length - 1))
            sbQuery.append(String.format(":%s", name));
        else
            sbQuery.append(String.format(":%s, ", name));
    }
    sbQuery.append(");");

    if (logger.isDebugEnabled())
        logger.debug("Execute Procedure query is\t  " + sbQuery.toString());

    return sbQuery.toString();
}