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:org.fiware.apps.repository.it.IntegrationTestHelper.java

public static String collectionToXml(ResourceCollection collection) {
    String collectionString = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n";
    if (collection.getId() != null) {
        collectionString = collectionString.concat("<collection id=\"" + collection.getId() + "\">");
    } else {// w w w .  jav a2s.  c o m
        collectionString = collectionString.concat("<collection>");
    }
    if (collection.getCreationDate() != null) {
        collectionString = collectionString
                .concat("<creationDate>" + collection.getCreationDate().toString() + "</creationDate>\n");
    }
    if (collection.getCreator() != null) {
        collectionString = collectionString.concat("<creator>" + collection.getCreator() + "</creator>\n");
    }
    if (collection.getModificationDate() != null) {
        collectionString = collectionString.concat(
                "<modificationDate>" + collection.getModificationDate().toString() + "</modificationDate>\n");
    }
    if (collection.getName() != null) {
        collectionString = collectionString.concat("<name>" + collection.getName() + "</name>\n");
    }
    return collectionString.concat("</collection>");
}

From source file:com.kangdainfo.common.util.BeanUtil.java

/**
 * @param name/*from   w w  w.ja  v a 2s.c o  m*/
 * @param localName
 *
 * @return name for attribute
 */
private static String dealWithAttributeName(String name, String localName) {

    String tempName = name;
    tempName = ((tempName != null) && !tempName.equals("")) ? tempName.concat(".").concat(localName)
            : localName;

    return tempName;

}

From source file:dynamicrefactoring.util.io.FileManager.java

/**
 * Obtiene el nombre de un fichero determinado, sin la ruta hasta l.
 * //from   w ww  .  j  a va 2s .co  m
 * @param filePath
 *            la ruta del fichero.
 * 
 * @return el nombre del fichero sin la ruta para llegar hasta l.
 */
public static String getFileName(String filePath) {
    String temp = new String();
    if (filePath.lastIndexOf(File.separatorChar) >= 0) //$NON-NLS-1$
        temp = temp.concat(filePath.substring(filePath.lastIndexOf(File.separatorChar) + 1, filePath.length())); //$NON-NLS-1$

    // Si el fichero no est en un directorio.
    else
        temp = filePath;

    return temp;
}

From source file:org.fiware.apps.repository.it.IntegrationTestHelper.java

public static String resourceToXML(Resource resource) {
    String resourceString = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n";

    if (resource.getId() != null) {
        resourceString = resourceString.concat("<resource id=\"" + resource.getId() + "\">\n");
    } else {/*from   www.jav a 2  s. com*/
        resourceString = resourceString.concat("<resource>\n");
    }
    if (resource.getContentFileName() != null) {
        resourceString = resourceString
                .concat("<contentFileName>" + resource.getContentFileName() + "</contentFileName>\n");
    }
    if (resource.getContentMimeType() != null) {
        resourceString = resourceString
                .concat("<contentMimeType>" + resource.getContentMimeType() + "</contentMimeType>\n");
    }
    if (resource.getContentUrl() != null) {
        resourceString = resourceString.concat("<contentUrl>" + resource.getContentUrl() + "</contentUrl>\n");
    }
    if (resource.getCreationDate() != null) {
        resourceString = resourceString
                .concat("<creationDate>" + resource.getCreationDate().toString() + "</creationDate>\n");
    }
    if (resource.getCreator() != null) {
        resourceString = resourceString.concat("<creator>" + resource.getCreator() + "</creator>\n");
    }
    if (resource.getModificationDate() != null) {
        resourceString = resourceString.concat(
                "<modificationDate>" + resource.getModificationDate().toString() + "</modificationDate>\n");
    }
    if (resource.getName() != null) {
        resourceString = resourceString.concat("<name>" + resource.getName() + "</name>\n");
    }

    return resourceString.concat("</resource>");
}

From source file:dynamicrefactoring.util.io.FileManager.java

/**
 * Obtiene la ruta del directorio donde est contenido un fichero
 * determinado./*from   www  .j a v a2 s  .  c  o m*/
 * 
 * @param filePath
 *            la ruta del fichero.
 * 
 * @return la ruta del directorio donde est contenido el fichero.
 */
public static String getDirectoryPath(String filePath) {

    String temp = new String();
    if (filePath.lastIndexOf(File.separatorChar) >= 0) { //$NON-NLS-1$
        temp = temp.concat(filePath.substring(0, filePath.lastIndexOf(File.separatorChar))); //$NON-NLS-1$
        if (temp.lastIndexOf(".." + File.separatorChar) >= 0) //$NON-NLS-1$ //$NON-NLS-2$
            temp = temp.substring(temp.lastIndexOf(".." + File.separatorChar) + 3, temp.length()); //$NON-NLS-1$ //$NON-NLS-2$

        temp = temp.substring(temp.indexOf(File.separatorChar) + 1, temp.length()); //$NON-NLS-1$
    }

    return temp;
}

From source file:demo.RxJavaTransformer.java

private static List<EventData> transformData(List<String> filtereddata) {

    List<EventData> transformedData = new ArrayList<EventData>();

    for (String d : filtereddata) {
        List<String> entryList = Arrays.asList(d.split(","));
        String medallion = entryList.get(0);
        String pickupTime = entryList.get(2);
        String dropoffTime = entryList.get(3);
        String tripDistance = entryList.get(5);
        String pickuplong = entryList.get(6);
        String pickuplat = entryList.get(7);
        String dropofflong = entryList.get(8);
        String dropofflat = entryList.get(9);
        String startCellid = getCellId(pickuplong, pickuplat);
        String destCellid = getCellId(dropofflong, dropofflat);
        //String cellId = "wrong";
        if ((null != startCellid) && (null != destCellid)) {
            String cellId = startCellid.concat("_to_").concat(destCellid);
            EventData eventData = new EventData(medallion, pickupTime, dropoffTime, tripDistance, pickuplong,
                    pickuplat, dropofflong, dropofflat, startCellid, destCellid);
            eventData.setProcessingTimeStart(String.valueOf(System.currentTimeMillis()));
            transformedData.add(eventData);
        }/*from w ww  .java2  s. c  o m*/
    }
    return transformedData;
}

From source file:com.github.zhanhb.ckfinder.connector.utils.PathUtils.java

/**
 * Escapes double slashes (//) and replaces backslashes characters (\) with
 * slashes (/). <br>//  www .j a va  2s. c o  m
 * <strong>NOTE:</strong> This method preserves UNC paths.
 *
 * @param string string to escapeUrl
 * @return Escaped string, {@code null} or empty string.
 */
public static String normalizeUrl(String string) {
    if (StringUtils.isEmpty(string)) {
        return string;
    }
    final int prefixIndex = string.indexOf("://");
    String prefix;
    String suffix;
    if (prefixIndex > -1) {
        prefix = string.substring(0, prefixIndex + 2);
        suffix = string.substring(prefixIndex + 2);
    } else {
        prefix = "";
        suffix = string;
    }
    suffix = suffix.replace('\\', '/');

    // preserve // at the beginning for UNC paths
    if (suffix.startsWith("//")) {
        return prefix + "/" + suffix.replaceAll("/+", "/");
    } else {
        return prefix.concat(suffix.replaceAll("/+", "/"));
    }
}

From source file:org.fiware.apps.repository.it.collectionService.CollectionServiceITTest.java

@BeforeClass
public static void setUpClass() throws IOException {
    //Delete test collection.
    IntegrationTestHelper client = new IntegrationTestHelper();
    List<Header> headers = new LinkedList<>();
    client.deleteCollection("collectionTest1", headers);

    String auxString = "";
    FileReader file = new FileReader("src/test/resources/rdf+xml.rdf");
    BufferedReader buffer = new BufferedReader(file);
    while (buffer.ready()) {
        auxString = auxString.concat(buffer.readLine());
    }/*ww w .j  av  a 2  s . c  o m*/
    buffer.close();
    rdfxmlExample = auxString;

    auxString = "";
    file = new FileReader("src/test/resources/rdf+json.rdf");
    buffer = new BufferedReader(file);
    while (buffer.ready()) {
        auxString = auxString.concat(buffer.readLine());
    }
    buffer.close();
    rdfjsonExample = auxString;

}

From source file:eu.optimis.ics.core.util.PropertiesReader.java

/**
 * Gets the configuration file path/*from w  ww  .  j a  v  a2s.  com*/
 * @param configFile  the properties file
 * @return configuration file path
 */
public static String getConfigFilePath(String configFile) {
    String optimisHome = System.getenv("OPTIMIS_HOME");
    if (optimisHome == null) {
        optimisHome = Constants.OPTIMIS_HOME_DEFAULT;
        log.debug("ics.core.util.PropertiesReader.getConfigFilePath(): OPTIMIS_HOME_DEFAULT: " + optimisHome);
    } else {
        log.debug(
                "ics.core.util.PropertiesReader.getConfigFilePath(): OPTIMIS_HOME_CUSTOMIZED: " + optimisHome);
    }

    File fileObject = new File(optimisHome.concat(configFile));
    if (!fileObject.exists()) {
        try {
            createDefaultConfigFile(fileObject);
        } catch (Exception ex) {
            log.error("ics.core.util.PropertiesReader.getConfigFilePath(): Error reading "
                    + optimisHome.concat(configFile) + " configuration file: " + ex.getMessage());
            //ex.printStackTrace();
        }
    }

    return optimisHome.concat(configFile);
}

From source file:net.sf.farrago.namespace.sfdc.SfdcUdx.java

private static String stripQuote(String s) {
    String ret = s;
    if (s.startsWith("'")) {
        int lastQuote = s.lastIndexOf("'");
        ret = s.substring(1, lastQuote);
        if (s.length() > (lastQuote + 1)) {
            ret = ret.concat(s.substring(lastQuote + 1));
        }/* ww  w.  ja va  2  s.  c  o m*/
    }
    return ret;
}