Example usage for java.lang String concat

List of usage examples for java.lang String concat

Introduction

In this page you can find the example usage for java.lang String concat.

Prototype

public String concat(String str) 

Source Link

Document

Concatenates the specified string to the end of this string.

Usage

From source file:es.juntadeandalucia.panelGestion.negocio.utiles.Geoserver.java

public String getWFSUrl(String workspace) {
    String wfsUrl = geoserverAUX.getGeoserverUrl().concat("/");
    if (!StringUtils.isEmpty(workspace)) {
        wfsUrl = wfsUrl.concat(workspace).concat("/");
    }//from w  ww  .  j a  v a2 s . c  o m
    wfsUrl = wfsUrl.concat("wfs?");

    return wfsUrl;
}

From source file:net.sf.jabref.importer.fetcher.GVKFetcher.java

@Override
public boolean processQuery(String query, ImportInspector dialog, OutputPrinter frame) {

    query = query.trim();//from  w w  w .j a  va2 s.c om

    String[] qterms = query.split("\\s");

    // Null abfangen!
    if (qterms.length == 0) {
        return false;
    }

    // Jeden einzelnen Suchbegriff URL-Encodieren
    for (int x = 0; x < qterms.length; x++) {
        try {
            qterms[x] = URLEncoder.encode(qterms[x], StandardCharsets.UTF_8.name());
        } catch (UnsupportedEncodingException e) {
            LOGGER.error("Unsupported encoding", e);
        }
    }

    String gvkQuery;
    if (searchKeys.containsKey(qterms[0])) {
        gvkQuery = processComplexQuery(qterms);
    } else {
        gvkQuery = "pica.all%3D";
        gvkQuery = gvkQuery.concat(qterms[0]);

        for (int x = 1; x < qterms.length; x++) {
            gvkQuery = gvkQuery.concat("%20");
            gvkQuery = gvkQuery.concat(qterms[x]);
        }
    }

    List<BibEntry> bibs = fetchGVK(gvkQuery);

    for (BibEntry entry : bibs) {
        dialog.addEntry(entry);
    }

    if (bibs.isEmpty()) {
        frame.showMessage(Localization.lang("No references found"));
    }

    return true;
}

From source file:com.jaspersoft.jasperserver.war.StaticFilesCacheControlFilter.java

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {

    if (request instanceof HttpServletRequest) {
        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
        HttpServletResponse httpServletResponse = (HttpServletResponse) response;
        String path = httpServletRequest.getServletPath();
        if (path != null) {
            String resourcePatch = httpServletRequest.getPathInfo() == null ? path
                    : path.concat(httpServletRequest.getPathInfo());

            boolean excludeFromCacheFlag = false;
            for (String exclRegex : exclusionRegexSet) {
                if (path.matches(exclRegex)) {
                    log.debug("Excluding the path from browser cache by not setting the response header: "
                            + path);//from  w w w  .  jav a 2s .  co  m
                    excludeFromCacheFlag = true;
                    break;
                }
            }

            if (!excludeFromCacheFlag) {
                boolean set = false;
                for (String suffix : urlSuffixes) {
                    if (path.toLowerCase().endsWith(suffix)) {
                        log.debug("Setting headers for " + path);
                        setHeaders(httpServletRequest, httpServletResponse);
                        set = true;
                        break;
                    }
                }
                if (!set) {
                    for (String prefix : urlPrefixes) {
                        if (resourcePatch.toLowerCase().startsWith(prefix)) {
                            log.debug("Setting headers for " + resourcePatch);
                            setHeaders(httpServletRequest, httpServletResponse);
                            break;
                        }
                    }
                }
            }
        }
    }

    chain.doFilter(request, response);
}

From source file:net.sourceforge.fenixedu.util.tests.ResponseProcessing.java

public String toXML(String feedback) {
    String result = "<respcondition>\n<conditionvar>\n";
    if (responseConditions.isEmpty()) {
        result = result.concat("\n<other/>");
    } else {// w  w w. j a  v a  2s . c  o m
        for (ResponseCondition responseCondition : responseConditions) {
            result = result.concat(responseCondition.toXML());
        }
    }
    result = result.concat("\n</conditionvar>\n<setvar action=\"" + getActionString(action) + "\">"
            + responseValue + "\n</setvar>\n");
    if (feedback != null) {
        result = result.concat(feedback);
    }
    result = result.concat("</respcondition>\n");

    return result;
}

From source file:com.interacciones.mxcashmarketdata.mama.queue.SendMessageToMama.java

private void msgO_DO(Parser message) {

    if (_pubNormal) {
        mamaMsg.clear();//from  ww  w .  ja  v  a 2 s  . com
        //mamaMsg.addU32("MessageNo", 10001, tmpSequence);
        String emisora = message.Emisora().trim();
        mamaMsg.addString("PublisherTopic", 10002, emisora.concat(message.Serie().concat(message.TypeValue())));
        mamaMsg.addString("QouteTimestamp", 10004, format.format(new Date()));
        MamaPrice askPrice = new MamaPrice();
        askPrice.add(message.AskPrice());
        mamaMsg.addPrice("AskPrice", 10005, askPrice);
        MamaPrice bidPrice = new MamaPrice();
        bidPrice.add(message.BidPrice());
        mamaMsg.addPrice("BidPrice", 10006, bidPrice);
        mamaMsg.addI64("AskSize", 10007, message.AskSize());
        mamaMsg.addI64("BidSize", 10008, message.BidSize());

        publisher = listPublisher.get(_topicNormal);
        publisher.send(mamaMsg);
    }
    if (_pubSetrib) {
        mamaMsgSetrib.clear();
        //mamaMsgSetrib.addString( "MessageNo", 10001, message.Emisora().trim() );
        mamaMsgSetrib.addString("MessageNo", 10001, message.getCompleteMsg());

        publisher = listPublisher.get(_topicSetrib);
        publisher.send(mamaMsgSetrib);
    }
    /*
     Sequence.setSequence(message.getSequence());
     System.out.print("\rMensaje " + message.getSequence() + "         ");
     * */
}

From source file:com.github.cereda.arara.rulechecker.RuleUtils.java

public static void updateRules(List<File> files) {

    // check if the provided list is empty
    if (files.isEmpty()) {

        // print error message
        System.err.println(WordUtils.wrap("Fatal exception: I could not find any rules in "
                + "the provided directory. I am afraid I won't be "
                + "be able to continue. Please make sure the "
                + "provided directory contains at least one rule to "
                + "be analyzed. The application will halt now.", 60));
    }//  w ww .  j  a  v a  2s .  c o  m

    // print header
    System.out.println(StringUtils.center(" Update report ", 60, "-").concat("\n"));

    // read each file of the list and extract
    // each task found
    for (File file : files) {

        try {

            // read each file into a list
            // of strings
            List<String> lines = FileUtils.readLines(file, "UTF-8");

            // create the potential
            // output for the updated file
            List<String> output = new ArrayList<>();

            // iterate through each line
            for (String line : lines) {

                // only add lines not matching
                // the task pattern
                if (!match(line)) {
                    output.add(line);
                }

            }

            // result string
            String result;

            // if the sizes are the same,
            // nothing happened
            if (lines.size() == output.size()) {

                // update status
                result = " Unchanged";
            } else {

                // update the file reference
                FileUtils.writeLines(file, "UTF-8", output);

                // update status
                result = " Updated";
            }

            // build the beginning of the line
            String line = String.format("- %s ", file.getName());

            // generate the full entry
            line = line.concat(StringUtils.repeat(".", 60 - line.length() - result.length())).concat(result);

            // print entry
            System.out.println(line);

        } catch (IOException exception) {

            // print error message
            System.err.println(WordUtils.wrap("Fatal exception: an error was raised while "
                    + "trying to read one of the rules. Please make "
                    + "sure all rules in the provided directory have "
                    + "read permission. I won't be able to continue. " + "The application will halt now.", 60));
            System.exit(1);
        }
    }
}

From source file:it.uniud.ailab.dcore.wrappers.external.RCallerEvaluator.java

@Override
public void annotate(Blackboard blackboard, DocumentComponent component) {

    Collection<Keyphrase> keyphrases = blackboard.getGramsByType(Keyphrase.KEYPHRASE);

    // Step 1: generate the candidates file
    FileSystem.createDirectoryIfNotExists(FileSystem.getDistillerTmpPath());

    String candidatePath = FileSystem.getDistillerTmpPath().concat(FileSystem.getSeparator())
            .concat("candidates.csv");

    CsvPrinter candidatePrinter = new CsvPrinter();
    candidatePrinter.loadKeyphrases(blackboard);
    candidatePrinter.writeFile(candidatePath);

    // Step 2: move the models to the Distiller's temporary folder
    String tmpModelPath = FileSystem.getDistillerTmpPath().concat(FileSystem.getSeparator())
            .concat("model.RData");

    try {/*from w ww  .  j a  v  a2  s  . c  om*/
        org.apache.commons.io.FileUtils.copyInputStreamToFile(
                FileSystem.getInputStreamFromPath(getClass().getClassLoader().getResource(modelPath).getFile()),
                new File(tmpModelPath));

    } catch (IOException ex) {
        Logger.getLogger(RCallerEvaluator.class.getName()).log(Level.SEVERE, null, ex);
        throw new AnnotationException(this, "Error while copying model file to temporary directory");
    } catch (NullPointerException ex) {
        // The model required is not packaged in the JAR: just use
        // the provided path
        tmpModelPath = modelPath;
    }

    // Step 3: predict with R
    RCaller caller = new RCaller();
    Globals.detect_current_rscript();
    caller.setRscriptExecutable(Globals.Rscript_current);

    RCode rCode = new RCode();

    // load packages (if any)
    if (requires != null && !requires.isEmpty()) {
        String[] packageNames = requires.split(",");
        for (String packageName : packageNames) {
            rCode.addRCode("require(\"" + packageName + "\")");
        }
    }

    rCode.addRCode("load(\"" + tmpModelPath + "\")");
    rCode.addRCode("predictions <- read.csv(\"" + candidatePath + "\",stringsAsFactors = FALSE)");

    String prediction = "predictions$score <- predict(model,newdata = predictions";

    if (modelParameters != null && !modelParameters.isEmpty()) {
        prediction = prediction.concat(",").concat(modelParameters);
    }
    prediction = prediction.concat(")");

    rCode.addRCode(prediction);

    caller.setRCode(rCode);
    caller.runAndReturnResult("predictions");

    String[] idChecks = caller.getParser().getAsStringArray("ID");
    double[] predictions = caller.getParser().getAsDoubleArray("score");

    // Step 4: collect predictions and store them in the KP object.
    int kpCounter = 0;
    for (Keyphrase kp : keyphrases) {
        // coherence check: if for some reason we are getting the
        // wrong KP from the printer, shut down everything.
        if (!kp.getIdentifier().equals(idChecks[kpCounter])) {
            throw new AnnotationException(this, "ERROR: non-matching keyphrase in R code printer");
        }
        kp.putFeature(it.uniud.ailab.dcore.annotation.annotators.GenericEvaluatorAnnotator.SCORE,
                predictions[kpCounter]);

        kpCounter++;
    }
}

From source file:edu.northwestern.bioinformatics.studycalendar.web.activity.AdvancedEditActivityCommand.java

public void updateExistingUri() {
    Map<String, UriPropertyList> updatedUri = getExistingUri();
    Set entries = updatedUri.entrySet();
    Iterator iterator = entries.iterator();
    while (iterator.hasNext()) {
        Map.Entry entry = (Map.Entry) iterator.next();
        String indexValue = (String) entry.getKey();
        if (getExistingUri().get(entry.getKey()).getTemplateValue() != null) {
            String templateName = indexValue.concat(".").concat("template");
            ActivityProperty activityProperty1 = activityPropertyDao.getByNamespaceAndName(activity.getId(),
                    namespace, templateName);
            if (activityProperty1 == null) {
                activityProperty1 = new ActivityProperty();
                activityProperty1.setActivity(activity);
                activityProperty1.setNamespace(namespace);
                activityProperty1.setName(templateName);
                activityProperty1.setValue(getExistingUri().get(entry.getKey()).getTemplateValue());
            } else {
                activityProperty1.setValue(getExistingUri().get(entry.getKey()).getTemplateValue());
            }/* w w  w.  jav  a2 s  .  c  om*/
            activityPropertyDao.save(activityProperty1);
        }
        if (getExistingUri().get(entry.getKey()).getTextValue() != null) {
            String textName = indexValue.concat(".").concat("text");
            ActivityProperty activityProperty2 = activityPropertyDao.getByNamespaceAndName(activity.getId(),
                    namespace, textName);
            if (activityProperty2 == null) {
                activityProperty2 = new ActivityProperty();
                activityProperty2.setActivity(activity);
                activityProperty2.setNamespace(namespace);
                activityProperty2.setName(textName);
                activityProperty2.setValue(getExistingUri().get(entry.getKey()).getTemplateValue());
            } else {
                activityProperty2.setValue(getExistingUri().get(entry.getKey()).getTextValue());
            }
            activityPropertyDao.save(activityProperty2);
        }
    }
}

From source file:br.usp.poli.lta.cereda.aa.model.actions.Variable.java

/**
 * Retorna uma representao textual do conjunto de estados.
 * @param set Conjunto de estados.//  w  ww .j  av  a 2s. c  om
 * @param separator Separador dos elementos.
 * @return Representao textual do conjunto de estados.
 */
private String printElements(Set<Object> set, String separator) {
    StringBuilder sb = new StringBuilder();
    for (Object element : set) {
        if (element == null) {
            sb.append("");
        } else {
            sb.append(element);
        }
        sb.append(separator.concat(" "));
    }
    return "(".concat(sb.toString().substring(0, sb.length() - 2)).concat(")");
}

From source file:com.fbr.services.SecurityService.java

private String findPath(String uri) {
    String uris[] = uri.split("\\?");
    uri = uris[0];/*www . j a va  2  s  . c o  m*/
    uri = uri.concat("/");
    uri = "/".concat(uri);
    uri = uri.replaceAll("/+", "/");
    return uri;
}