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:com.jubination.io.chatbot.service.ReligareService.java

@Override
String validatedText(String type, String text, User user) {
    String validatedText = null;//from   w w w.  j  a v  a  2s .c om
    switch (type) {
    case "members-characters":
        validatedText = charOnly(text);

        validatedText = religareMembers(text, validatedText);
        break;
    case "members-less":
        validatedText = lessThan(text, 1);
        validatedText = religareMembers(text, validatedText);
        break;
    case "members-more":
        validatedText = moreThan(text, 4);
        validatedText = religareMembers(text, validatedText);
        break;
    case "members-multipleNumbers":
        validatedText = multipleNum(text);
        validatedText = religareMembers(text, validatedText);
        break;
    case "age-charactersOnly":
        validatedText = charOnly(text);
        break;
    case "age-tooYoung":
        validatedText = lessThan(text, 1);
        break;
    case "age-tooOld":
        validatedText = moreThan(text, 100);
        break;
    case "age-multipleNumbers":
        validatedText = multipleNum(text);
        break;

    case "children-characters":
        validatedText = charOnly(text);
        validatedText = religareChildren(text, validatedText);
        break;
    case "children-less":
        validatedText = lessThan(text, 0);
        validatedText = religareChildren(text, validatedText);
        break;
    case "children-more":
        validatedText = moreThan(text, 3);
        validatedText = religareChildren(text, validatedText);
        break;
    case "children-multipleNumbers":
        validatedText = multipleNum(text);
        validatedText = religareChildren(text, validatedText);
        if (validatedText != null) {
            int members = Integer.parseInt(user.getTags().get("members"));
            int children = Integer.parseInt(validatedText);
            if (children >= members) {
                validatedText = null;
            }
        }
        break;
    case "email-invalid":
        validatedText = emailValidate(text);
        break;
    case "phone-invalid":
        validatedText = phoneValidate(text);
        if (validatedText != null) {
            Random r = new Random();
            String otp = "";
            while (otp.length() < 4) {
                otp = otp.concat(Integer.toString(r.nextInt(9)));
            }
            user.getTags().put("otppass", otp);
            userRepository.updateObject(user.getSesId(), user.getTags(), "tags");
            sendOtp(validatedText, otp);
        }
        break;
    case "otp-invalid":

        if (text.trim().equals(user.getTags().get("otppass"))) {
            validatedText = text;
        } else {
            validatedText = null;
        }
        break;

    }

    return validatedText;
}

From source file:com.erudika.para.core.Tag.java

@Override
public String getObjectURI() {
    String defurl = "/".concat(getPlural());
    return (getTag() != null) ? defurl.concat("/").concat(getTag()) : defurl;
}

From source file:tasly.greathealth.erp.order.services.impl.DefaultOrderUpdateService.java

@Override
public ZSTRUPIBASEINFO2 createEccBaseInfo() throws Exception {
    final ZSTRUPIBASEINFO2 baseInfo = new ZSTRUPIBASEINFO2();
    final String sendTime = TaslyUtils.convertTimeToString();
    // generated ramdom code
    String msgID = "OMS_VENDOR_";
    msgID = msgID.concat(sendTime).concat("_").concat(TaslyUtils.generateRandomCode());
    baseInfo.setMSGID(msgID);/*from w  ww. j a  va 2s. com*/
    // baseInfo.setPMSGID(value);
    baseInfo.setSENDTIME(sendTime);
    baseInfo.setSSYSTEM(UO_SSYSTEM);
    baseInfo.setSERVICENAME(UO_SERVICENAME);
    baseInfo.setTSYSTEM(UO_TSYSTEM);
    baseInfo.setRETRY(UO_RETRY);
    return baseInfo;
}

From source file:org.gvnix.service.roo.addon.addon.util.WsdlParserUtils.java

/**
 * Get the path to the generated port type class.
 * /*from   www.  j  av a2s.  c  om*/
 * @param root Wsdl root element
 * @param sense Communication sense type
 * @return Path to the class
 */
public static String getPortTypeClassPath(Element root, WsType sense) {

    Validate.notNull(root, ROOT_ELEMENT_REQUIRED);

    // Build the classpath related to the namespace
    String path = getTargetNamespaceRelatedPackage(root);

    // Find a compatible port and port type name
    String portType = findFirstCompatiblePortTypeClassName(root, sense);
    String port = findFirstCompatiblePortClassName(root, sense);

    // RPC Encoded web services adds sufix to port type when equals to port
    if (WsType.IMPORT_RPC_ENCODED.equals(sense) && portType.equals(port)) {

        portType = portType.concat("_PortType");
    }

    // Class path is the concat of path and name
    return path + capitalizeFirstChar(portType);
}

From source file:org.gvnix.web.exception.handler.roo.addon.addon.ModalDialogMetadata.java

/**
 * Returns the JavaType for the given className. It gets the fully qualified
 * package name from the aspect of this metadata, that is the aspect of a
 * Controller class.//from ww  w . j  a  va  2 s.  c om
 * <p>
 * Since the add-on installs Dialog class in subpackage
 * <code>controller_package.servlet.handler</code>, it builds the package
 * name adding <code>.dialog.[className]</code> to the aspect package.
 * <p>
 * DialogType is special because is an enum type defined in Dialog class
 * 
 * @param className Right now it expects only "DialogType" or "Dialog"
 * @return
 */
private JavaType getJavaTypeForClassName(String className) {
    String typePackage = aspectName.getPackage().getFullyQualifiedPackageName().concat(".dialog.");
    if (className.equals("DialogType")) {
        return new JavaType(typePackage.concat("Dialog.").concat(className));
    }
    return new JavaType(typePackage.concat(className));
}

From source file:org.opencastproject.series.remote.SeriesServiceRemoteImpl.java

/**
 * Builds the a series URL./*from w ww .j  av  a2  s. c  o m*/
 * 
 * @param q
 *          the series query
 * @param admin
 *          whether this is for an administrative read
 * @return the series URL
 */
private String getSeriesUrl(SeriesQuery q) {
    StringBuilder url = new StringBuilder();
    url.append("/series.xml?");

    List<NameValuePair> queryStringParams = new ArrayList<NameValuePair>();
    if (q.getText() != null)
        queryStringParams.add(new BasicNameValuePair("q", q.getText()));
    if (q.getSeriesId() != null)
        queryStringParams.add(new BasicNameValuePair("seriesId", q.getSeriesId()));
    queryStringParams.add(new BasicNameValuePair("edit", Boolean.toString(q.isEdit())));
    if (q.getSeriesTitle() != null)
        queryStringParams.add(new BasicNameValuePair("seriesTitle", q.getSeriesTitle()));
    if (q.getCreator() != null)
        queryStringParams.add(new BasicNameValuePair("creator", q.getCreator()));
    if (q.getContributor() != null)
        queryStringParams.add(new BasicNameValuePair("contributor", q.getContributor()));
    if (q.getPublisher() != null)
        queryStringParams.add(new BasicNameValuePair("publisher", q.getPublisher()));
    if (q.getRightsHolder() != null)
        queryStringParams.add(new BasicNameValuePair("rightsholder", q.getRightsHolder()));
    if (q.getCreatedFrom() != null)
        queryStringParams
                .add(new BasicNameValuePair("createdfrom", SolrUtils.serializeDate(q.getCreatedFrom())));
    if (q.getCreatedTo() != null)
        queryStringParams.add(new BasicNameValuePair("createdto", SolrUtils.serializeDate(q.getCreatedTo())));
    if (q.getLanguage() != null)
        queryStringParams.add(new BasicNameValuePair("language", q.getLanguage()));
    if (q.getLicense() != null)
        queryStringParams.add(new BasicNameValuePair("license", q.getLicense()));
    if (q.getSubject() != null)
        queryStringParams.add(new BasicNameValuePair("subject", q.getSubject()));
    if (q.getAbstract() != null)
        queryStringParams.add(new BasicNameValuePair("abstract", q.getAbstract()));
    if (q.getDescription() != null)
        queryStringParams.add(new BasicNameValuePair("description", q.getDescription()));
    if (q.getSort() != null) {
        String sortString = q.getSort().toString();
        if (!q.isSortAscending())
            sortString = sortString.concat("_DESC");
        queryStringParams.add(new BasicNameValuePair("sort", sortString));
    }
    queryStringParams.add(new BasicNameValuePair("startPage", Long.toString(q.getStartPage())));
    queryStringParams.add(new BasicNameValuePair("count", Long.toString(q.getCount())));

    url.append(URLEncodedUtils.format(queryStringParams, "UTF-8"));
    return url.toString();
}

From source file:net.librec.data.convertor.appender.SocialDataAppender.java

/**
 * Read data from the data file. Note that we didn't take care of the
 * duplicated lines.//from   ww  w . j a  v  a 2 s.  c  om
 *
 * @param inputDataPath
 *            the path of the data file
 * @throws IOException if I/O error occurs during reading
 */
private void readData(String inputDataPath) throws IOException {
    // Table {row-id, col-id, rate}
    Table<Integer, Integer, Double> dataTable = HashBasedTable.create();
    // Map {col-id, multiple row-id}: used to fast build a rating matrix
    Multimap<Integer, Integer> colMap = HashMultimap.create();
    // BiMap {raw id, inner id} userIds, itemIds
    final List<File> files = new ArrayList<File>();
    final ArrayList<Long> fileSizeList = new ArrayList<Long>();
    SimpleFileVisitor<Path> finder = new SimpleFileVisitor<Path>() {
        @Override
        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
            fileSizeList.add(file.toFile().length());
            files.add(file.toFile());
            return super.visitFile(file, attrs);
        }
    };
    Files.walkFileTree(Paths.get(inputDataPath), finder);
    long allFileSize = 0;
    for (Long everyFileSize : fileSizeList) {
        allFileSize = allFileSize + everyFileSize.longValue();
    }
    // loop every dataFile collecting from walkFileTree
    for (File dataFile : files) {
        FileInputStream fis = new FileInputStream(dataFile);
        FileChannel fileRead = fis.getChannel();
        ByteBuffer buffer = ByteBuffer.allocate(BSIZE);
        int len;
        String bufferLine = new String();
        byte[] bytes = new byte[BSIZE];
        while ((len = fileRead.read(buffer)) != -1) {
            buffer.flip();
            buffer.get(bytes, 0, len);
            bufferLine = bufferLine.concat(new String(bytes, 0, len)).replaceAll("\r", "\n");
            String[] bufferData = bufferLine.split("(\n)+");
            boolean isComplete = bufferLine.endsWith("\n");
            int loopLength = isComplete ? bufferData.length : bufferData.length - 1;
            for (int i = 0; i < loopLength; i++) {
                String line = new String(bufferData[i]);
                String[] data = line.trim().split("[ \t,]+");
                String userA = data[0];
                String userB = data[1];
                Double rate = (data.length >= 3) ? Double.valueOf(data[2]) : 1.0;
                if (userIds.containsKey(userA) && userIds.containsKey(userB)) {
                    int row = userIds.get(userA);
                    int col = userIds.get(userB);
                    dataTable.put(row, col, rate);
                    colMap.put(col, row);
                }
            }
            if (!isComplete) {
                bufferLine = bufferData[bufferData.length - 1];
            }
            buffer.clear();
        }
        fileRead.close();
        fis.close();
    }
    int numRows = userIds.size(), numCols = userIds.size();
    // build rating matrix
    userSocialMatrix = new SparseMatrix(numRows, numCols, dataTable, colMap);
    // release memory of data table
    dataTable = null;
}

From source file:com.webbfontaine.valuewebb.action.tt.TtLogger.java

/**
 * Adds new entry to log list when user clicks on '(clear message)' link next to the warning/error message
 *
 * @param fieldId     field id error message concerns to
 * @param facesErrors list of errors/warnings
 *//*  w w w. j av  a2  s .  c om*/

public void addClearWarningMessageToLogger(String fieldId, String errorMessage,
        ArrayList<FacesError> facesErrors, TtGen ttGen, Boolean sendMail, Boolean shouldBeLogged) {
    String errorMessageToLog = "";

    for (FacesError err : facesErrors) {
        if (err.getFieldId().equals(fieldId) && err.getDetailedErrorDescription().contains(errorMessage)) {
            for (FacesMessageText msg : err.getFacesMessageTexts()) {
                errorMessageToLog = errorMessageToLog.concat(msg.getErrorText() + " ");
            }
        }
    }
    if (!errorMessageToLog.equals("")) {
        if (shouldBeLogged) {
            addMessageToLogger(fieldId, errorMessageToLog, facesErrors);
        }
        ValidatorUtils validatorUtils = (ValidatorUtils) Component.getInstance(ValidatorUtils.class);
        validatorUtils.setIgnoreWarning(true);
        ErrorHandling.getInstanceFromAnyScope().removeErrorWithLinks(fieldId, facesErrors, errorMessageToLog);
    }
    if (sendMail) {
        TTMailService.getInstance().sendMailForDuplicationWarning(ttGen);
    }
}

From source file:com.github.kubernetes.java.client.KubernetesApiClient.java

private String getLabelQuery(List<Label> label) {
    String query = "";
    for (Label l : label) {
        query = query.concat("name=" + l.getName() + ",");
    }//w  ww.j  av  a  2 s  . c  o m
    return query.endsWith(",") ? query.substring(0, query.length() - 1) : query;
}

From source file:alpha.portal.dao.hibernate.AlphaCardDaoHibernate.java

/**
 * List the last 20 changes of AlphaCards in AlphaCases where I take part.
 * /*w w  w  .  j  a  v  a  2  s.  c  o m*/
 * @param caseIDs
 *            A String array with the caseIDs of the cases where I take part
 * 
 * @return A list with AlphaCards
 */
public List<AlphaCard> listDashBoardAlphaCards(final String[] caseIDs) {
    Session session;
    boolean sessionOwn = false;
    try {
        session = this.getSessionFactory().getCurrentSession();
    } catch (final Exception e) {
        session = this.getSessionFactory().openSession();
        sessionOwn = true;
    }

    String queryStr = "from alphacard where";
    // add all caseIDs in 'where' with OR clause
    for (int i = 0; i < caseIDs.length; i++) {
        queryStr = queryStr.concat(" alphaCardIdentifier.caseId = " + "'" + caseIDs[i] + "'");
        if (i < (caseIDs.length - 1)) {
            queryStr = queryStr.concat(" or");
        }
    }

    // order the result descending
    queryStr = queryStr.concat(" order by alphaCardIdentifier.sequenceNumber DESC");

    final Query query = session.createQuery(queryStr);
    // only the top 20 results
    query.setMaxResults(20);

    return query.list();
}