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

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

Introduction

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

Prototype

public static String join(Collection<?> collection, String separator) 

Source Link

Document

Joins the elements of the provided Collection into a single String containing the provided elements.

Usage

From source file:edu.illinois.cs.cogcomp.GenerateMojo.java

public void execute() throws MojoExecutionException {
    dFlag = FileUtils.getPlatformIndependentFilePath(dFlag);
    gspFlag = FileUtils.getPlatformIndependentFilePath(gspFlag);
    sourcepathFlag = FileUtils.getPlatformIndependentFilePath(sourcepathFlag);

    classpath.add(dFlag);//from  www . j  a va  2 s  .  com
    classpath.add(gspFlag);

    String newpath = StringUtils.join(classpath, File.pathSeparator);

    // If these directories don't exist, make them.
    new File(dFlag).mkdirs();
    new File(gspFlag).mkdirs();

    for (String lbjInputFile : lbjavaInputFileList) {
        if (StringUtils.isEmpty(lbjInputFile)) {
            // making the optional-compile-step parameter happy.
            continue;
        }

        getLog().info("Calling Java edu.illinois.cs.cogcomp.lbjava.Main...");

        lbjInputFile = FileUtils.getPlatformIndependentFilePath(lbjInputFile);

        try {
            String[] args = new String[] { "java", "-cp", newpath, "edu.illinois.cs.cogcomp.lbjava.Main", "-c",
                    "-d", dFlag, "-gsp", gspFlag, "-sourcepath", sourcepathFlag, lbjInputFile };

            ProcessBuilder pr = new ProcessBuilder(args);
            pr.inheritIO();
            Process p = pr.start();
            p.waitFor();

        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("Yeah, an error.");
        }
    }

}

From source file:nc.noumea.mairie.appock.viewmodel.EditContactReferentAchatViewModel.java

@Init
public void init() {
    List<AppUser> listeAppUser = appUserService.findAllWithRole(Role.ROLE_REFERENT_ACHAT, true);
    List<String> result = new ArrayList<>();
    for (AppUser appUser : listeAppUser) {
        if (StringUtils.isNotBlank(appUser.getEmail())) {
            result.add(appUser.getEmail());
        }//from  w  w  w.  j av  a  2 s .c om
    }
    setListeAdresseMail(StringUtils.join(result, "; "));
}

From source file:edu.illinois.cs.cogcomp.CompileMojo.java

public void execute() throws MojoExecutionException {
    dFlag = FileUtils.getPlatformIndependentFilePath(dFlag);
    gspFlag = FileUtils.getPlatformIndependentFilePath(gspFlag);
    sourcepathFlag = FileUtils.getPlatformIndependentFilePath(sourcepathFlag);

    classpath.add(dFlag);/*  www . ja  va2s  .co m*/
    classpath.add(gspFlag);

    String newpath = StringUtils.join(classpath, File.pathSeparator);

    // If these directories don't exist, make them.
    new File(dFlag).mkdirs();
    new File(gspFlag).mkdirs();

    for (String lbjInputFile : lbjavaInputFileList) {
        if (StringUtils.isEmpty(lbjInputFile)) {
            // making the optional-compile-parameter happy.
            continue;
        }

        getLog().info("Calling Java edu.illinois.cs.cogcomp.lbjava.Main...");

        lbjInputFile = FileUtils.getPlatformIndependentFilePath(lbjInputFile);

        try {
            String[] args = new String[] { "java", "-cp", newpath, "edu.illinois.cs.cogcomp.lbjava.Main", "-d",
                    dFlag, "-gsp", gspFlag, "-sourcepath", sourcepathFlag, lbjInputFile };

            ProcessBuilder pr = new ProcessBuilder(args);
            pr.inheritIO();
            Process p = pr.start();
            p.waitFor();

        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("Yeah, an error.");
        }
    }

}

From source file:com.thoughtworks.go.task.rpmbuild.RPMBuildTask.java

@Override
public TaskExecutor executor() {
    return new TaskExecutor() {
        @Override//from w  ww.j  a v a2s  .  c o m
        public ExecutionResult execute(TaskConfig taskConfig, TaskExecutionContext taskExecutionContext) {
            String targetArch = taskConfig.getValue(TARGET_ARCH);
            String specFilePath = taskConfig.getValue(SPEC_FILE);
            List<String> command = Arrays.asList("rpmbuild", "--target", targetArch, "-bb", "-v", "--clean",
                    specFilePath);
            try {
                taskExecutionContext.console().printLine("[exec] " + StringUtils.join(command, " "));
                Process process = runProcess(taskExecutionContext, command);
                taskExecutionContext.console().readOutputOf(process.getInputStream());
                taskExecutionContext.console().readErrorOf(process.getErrorStream());
                try {
                    process.waitFor();
                } catch (InterruptedException e) {
                    // continue
                }
                int exitValue = process.exitValue();
                if (exitValue != 0) {
                    return ExecutionResult.failure("[exec] FAILED with return code " + exitValue);
                }
            } catch (IOException e) {
                return ExecutionResult.failure("[exec] Exception: " + e.getMessage(), e);
            }
            return ExecutionResult.success(
                    String.format("[exec] Successfully executed command [%s]", StringUtils.join(command, " ")));
        }
    };
}

From source file:com.nigelsmall.load2neo.AbstractNode.java

public String toString() {
    final ArrayList<String> parts = new ArrayList<>();
    if (this.name != null && !this.name.equals("")) {
        parts.add(this.name);
    }/*from   ww w.  j av  a 2s  . com*/
    if (this.labels != null) {
        String labels = "";
        for (String label : this.labels) {
            labels += ":" + label;
        }
        parts.add(labels);
    }
    if (this.properties != null) {
        if (parts.size() > 0) {
            parts.add(" ");
        }
        try {
            parts.add(mapper.writeValueAsString(this.properties));
        } catch (IOException e) {
            //
        }
    }
    if (this.hookLabel == null) {
        return "(" + StringUtils.join(parts, "") + ")";
    } else if (this.hookKey == null) {
        return ":" + this.hookLabel + ":=>(" + StringUtils.join(parts, "") + ")";
    } else {
        return ":" + this.hookLabel + ":" + this.hookKey + ":=>(" + StringUtils.join(parts, "") + ")";
    }
}

From source file:it.drwolf.ridire.util.async.FrequencyListDataGenerator.java

@Override
public String toString() {
    String join = StringUtils.join(this.getCorporaNames(), "-");
    String string = join//from w w  w  .  j  av  a2s .c  o m
            + (this.getSemanticMetadatumDescription() == null ? "" : this.getSemanticMetadatumDescription())
            + "-"
            + (this.getFunctionalMetadatumDescription() == null ? "" : this.getFunctionalMetadatumDescription())
            + "-" + this.getFrequencyBy();
    return string;
}

From source file:com.hs.mail.imap.processor.SearchProcessor.java

@Override
protected void doProcess(ImapSession session, ImapRequest message, Responder responder) {
    SearchRequest request = (SearchRequest) message;
    SelectedMailbox selected = session.getSelectedMailbox();
    MailboxManager manager = getMailboxManager();
    List<Long> uids = selected.getCachedUids();
    if (uids == null) {
        uids = manager.getMessageIDList(selected.getMailboxID());
    }/*from  w  w w  . j  a v a 2s  . c om*/
    UidToMsnMapper map = new UidToMsnMapper(selected, uids, request.isUseUID());
    List<Long> results = search(manager, map, selected.getMailboxID(), request);
    if (CollectionUtils.isNotEmpty(results)) {
        List<Long> searched = new ArrayList<Long>();
        for (long messageID : results) {
            long msgnum = map.getMessageNumber(messageID);
            if (msgnum != -1) {
                searched.add(msgnum);
            }
        }
        responder.untagged(request.getCommand() + " " + StringUtils.join(searched, ' ') + "\r\n");
    }
    responder.okCompleted(request);
}

From source file:io.kodokojo.bdd.stage.AccessRestThen.java

public SELF it_receive_a_valide_list_of_available_brick() {
    assertThat(brickAvailable).isNotEmpty();
    LOGGER.debug("Available brick are : {}", StringUtils.join(brickAvailable, ","));
    return self();
}

From source file:com.haulmont.cuba.web.security.idp.IdpLoginHttpRequestFilter.java

protected void checkRequiredConfigProperties(WebIdpConfig webIdpConfig) {
    List<String> missingProperties = new ArrayList<>();

    if (StringUtils.isBlank(webIdpConfig.getIdpBaseURL())) {
        missingProperties.add("cuba.web.idp.baseUrl");
    }//  w w w  . j  a v a 2  s  .c  om
    if (StringUtils.isBlank(webIdpConfig.getIdpTrustedServicePassword())) {
        missingProperties.add("cuba.web.idp.trustedServicePassword");
    }
    if (!missingProperties.isEmpty()) {
        throw new IllegalStateException(
                "Please configure required application properties for IDP integration: \n"
                        + StringUtils.join(missingProperties, "\n"));
    }
}

From source file:it.drwolf.ridire.index.results.LeftContext.java

@Override
public String toString() {
    // return super.toString();
    List<String> l1 = this.strTokenizer.reset(this.context).getTokenList();
    Collections.reverse(l1);/*from   ww  w  . ja va 2s.com*/
    return StringUtils.join(l1, " ").replaceAll("_", " ");
}