List of usage examples for java.lang String concat
public String concat(String str)
From source file:com.saltedge.sdk.network.SERequestManager.java
private boolean sendGETRequest(String servicePath, HashMap<String, String> params, String loginSecret, SEHTTPResponseHandler handler) { HashMap<String, String> headers = headers(); String url = servicePath; if (!loginSecret.isEmpty()) { headers = loginSecretHeaders(loginSecret); }/* ww w. j a v a2 s. c om*/ if (params != null) { url = url.concat(SETools.paramsToString(params)); } return SERestClient.get(url, handler, headers); }
From source file:io.github.xfally.cordova.plugin.ftp.CDVFtp.java
private void list(String path, CallbackContext callbackContext) { if (path == null) { callbackContext.error("Expected path."); } else {/*from w ww . j a va 2s .com*/ if (!path.endsWith("/")) { path = path.concat("/"); } try { this.client.changeDirectory(path); FTPFile[] list = client.list(); JSONArray fileList = new JSONArray(); for (FTPFile file : list) { String name = file.getName(); Number type = file.getType(); String link = file.getLink(); Number size = file.getSize(); Date modifiedDate = file.getModifiedDate(); String modifiedDateString = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss zzz")) .format(modifiedDate); String jsonStr = "{" + "name:\"" + name + "\",type:" + type + ",link:\"" + link + "\",size:" + size + ",modifiedDate:\"" + modifiedDateString + "\"}"; JSONObject jsonObj = new JSONObject(jsonStr); fileList.put(jsonObj); } callbackContext.success(fileList); } catch (Exception e) { callbackContext.error(e.toString()); } } }
From source file:eu.optimis.ip.gui.server.IPManagerWebServiceImpl.java
private String readFileTail(String file, int lines) throws IOException { BufferedReader reader = new BufferedReader(new FileReader(file)); String line = null;// w ww . j av a2 s.c om List<String> read = new ArrayList<String>(); while ((line = reader.readLine()) != null) { read.add(line); } if (lines == 0) { read = read.subList(0, read.size()); } else { if (read.size() <= lines) { read = read.subList(0, read.size()); } else { read = read.subList(read.size() - lines, read.size()); } } String ret = new String(); for (String lineRead : read) { ret = ret.concat(lineRead + "\n"); } return ret; }
From source file:SciTK.PlotXY.java
/** * Get a string representation of the plotted data * @return the data in CSV format, contained in a String. *//*from www.ja va 2s . c o m*/ public String toString() { String s = ""; // iterate over all data series: for (int i = 0; i < data.getSeriesCount(); i++) { // iterate over items in the series: for (int j = 0; j < data.getItemCount(i); j++) { // add x,y then new line: s = s.concat(Double.toString(data.getXValue(i, j))); s = s.concat(SciTK_Text.TOOLKIT_CSV_DELIM); s = s.concat(Double.toString(data.getYValue(i, j))); s = s.concat(SciTK_Text.TOOLKIT_NEWLINE); } // add another line break after series is done: s = s.concat(SciTK_Text.TOOLKIT_NEWLINE); } return s; }
From source file:com.stoxx.portlet.clientlist.delegate.ClientListInfoDelegator.java
@SuppressWarnings("unchecked") public ClientModel getClientListInfo(long companyId, Locale locale, String alphabet, ClientModel clientModel, long userId) { List<SalesEntry> salesEntryList = null; try {// w w w . j a v a2s . co m if (alphabet.equalsIgnoreCase(ALL)) { salesEntryList = SalesEntryLocalServiceUtil.getSalesEntries(0, SalesEntryLocalServiceUtil.getSalesEntriesCount()); } else { salesEntryList = SalesEntryLocalServiceUtil.getSalesListByStartingAlphabet(alphabet); } List<ClientListVO> clientListVOList = new ArrayList<ClientListVO>(); if (Validator.isNotNull(salesEntryList) && salesEntryList.size() > 0) { for (SalesEntry salesEntry : salesEntryList) { ClientListVO clientListVO = new ClientListVO(); List<EmployeeVO> employeeList = new ArrayList<EmployeeVO>(); long salesEntryId = salesEntry.getSalesEntryId(); if (0 != salesEntryId) { String companyName = salesEntry.getCompanyName(); if (StringUtils.isNotBlank(companyName)) { companyName = companyName.trim(); clientListVO.setCompanyName(companyName); } Date endDate = salesEntry.getEndDate(); if (Validator.isNotNull(endDate)) { String salesEntryEndDate = STOXXDateUtil .convertDateToStringInStoxxApplicationDateFormat(salesEntry.getEndDate()); clientListVO.setEndDate(salesEntryEndDate); } else { clientListVO.setEndDate(NA); } clientListVO.setAllowedUsers(salesEntry.getUsersAllowed()); clientListVO.setPackagesSubscribed(salesEntry.getPackageNames()); List<UserProfileDetails> licensedUserDetails = userProfileService .getLicensedUsers(salesEntryId); if (Validator.isNotNull(licensedUserDetails) && licensedUserDetails.size() > 0) { int usedLicenses = licensedUserDetails.size(); clientListVO.setUsedLicenses(usedLicenses); } List<EmailDomain> emailDomainList = EmailDomainLocalServiceUtil .getEmailDomains(salesEntryId); String commaSeperatedEmailDomain = new String(); for (EmailDomain emailDomain : emailDomainList) { String domainName = emailDomain.getDomain(); commaSeperatedEmailDomain += domainName + StringPool.COMMA; } if (commaSeperatedEmailDomain.endsWith(StringPool.COMMA)) { commaSeperatedEmailDomain = commaSeperatedEmailDomain.substring(0, commaSeperatedEmailDomain.length() - 1); } if (StringUtils.isNotBlank(commaSeperatedEmailDomain)) { clientListVO.setDomainName(commaSeperatedEmailDomain); } else { clientListVO.setDomainName(LanguageUtil.get(locale, "stoxx-client-no-domain-present")); } List<String> emailAddressList = userProfileService .getLicensedUsersEmailAddress(salesEntryId); if (Validator.isNotNull(emailAddressList) && emailAddressList.size() > 0) { for (String emailAddress : emailAddressList) { if (StringUtils.isNotBlank(emailAddress)) { EmployeeVO employeeVO = new EmployeeVO(); User user = UserLocalServiceUtil.fetchUserByEmailAddress(companyId, emailAddress.toLowerCase()); UserProfileDetails userProfileDetails = userProfileService .getUserProfileData(emailAddress.toLowerCase()); if (Validator.isNotNull(userProfileDetails)) { Integer stoxxUserStatus = userProfileDetails.getStatus(); String statusFlag = null; if (Validator.isNotNull(user)) { String fullName = user.getFirstName() + StringPool.SPACE + user.getLastName(); employeeVO.setFullName(fullName); employeeVO.setEmailAddress(emailAddress); //PermissionChecker permissionChecker = setAnonymousUserPermission(UserLocalServiceUtil.getDefaultUserId(companyId)); List<Address> addressList = AddressServiceUtil .getAddresses(Contact.class.getName(), user.getContactId()); for (Address address : addressList) { if (address.getType().getName() .equals(STOXXConstants.ADDRESS_TYPE_BUSINESS)) { String street = address.getStreet1(); if (StringUtils.isNotBlank(address.getStreet2())) { street = street.concat( StringPool.COMMA + address.getStreet2().trim()); } long countryId = address.getCountryId(); String countryName = null; Country country = CountryServiceUtil.getCountry(countryId); if (Validator.isNotNull(country)) { countryName = country.getName(locale); } employeeVO.setCountry(countryName); employeeVO.setAddress(street); } } int liferayUserstatus = user.getStatus(); if (Validator.isNull(stoxxUserStatus)) { statusFlag = STOXXConstants.INTIATAED; } else { if (liferayUserstatus == 0 && stoxxUserStatus == 1) { statusFlag = STOXXConstants.ACTIVE; } else if (stoxxUserStatus == 3) { statusFlag = STOXXConstants.NOTREGISTERED; } else { statusFlag = STOXXConstants.SUSPENDED; } } employeeVO.setStatus(statusFlag); List<Phone> phoneList = PhoneServiceUtil .getPhones(Contact.class.getName(), user.getContactId()); if (Validator.isNotNull(phoneList) && phoneList.size() > 0) { for (Phone phone : phoneList) { if (phone.getType().getName() .equalsIgnoreCase(STOXXConstants.PHONE_TYPE_BUSINESS)) employeeVO.setPhoneNumber(phone.getNumber()); } } employeeList.add(employeeVO); } else { employeeVO.setFullName(NA); employeeVO.setEmailAddress(emailAddress); String location = userProfileDetails.getLocation(); if (StringUtils.isNotBlank(location)) { employeeVO.setEmailAddress(location); } employeeVO.setPhoneNumber(NA); if (Validator.isNull(stoxxUserStatus)) { statusFlag = STOXXConstants.INTIATAED; } else if (stoxxUserStatus.intValue() == 1 || stoxxUserStatus.intValue() == 0) { // if a user starts 1st step of registration process its staus=1, but its not updated in user_ table, so its status is Initiated. statusFlag = STOXXConstants.INTIATAED; // if user is created from sales entry page or account detail page by KAH, then status=null, so its Initiated. } else { statusFlag = "No Status Found"; } employeeVO.setStatus(statusFlag); employeeVO.setAddress(NA); employeeList.add(employeeVO); } } } } } } clientListVO.setEmployeeList(employeeList); clientListVOList.add(clientListVO); } } Collections.sort(clientListVOList); clientModel.setClientList(clientListVOList); } catch (Exception e) { log.error("Exception in getClientListInfo of ClientListInfoDelegator", e); } return clientModel; }
From source file:com.capitalone.dashboard.util.ClientUtil.java
/** * Canonicalizes date format returned from source system. Some source * systems have incorrectly formatted dates, or date times stamps that are * not database friendly./*from ww w .ja v a 2s . c om*/ * * @param nativeRs * Native date format as a string * @return A stringified canonical date format */ public String toCanonicalDate(String nativeRs) { String canonicalRs = ""; if ((nativeRs != null) && !(nativeRs.isEmpty())) { StringBuilder interrimRs = new StringBuilder(nativeRs); if (interrimRs.length() > 0) { canonicalRs = interrimRs.substring(0, MAX_ISO_INDEX); canonicalRs = canonicalRs.concat("0000"); } } return canonicalRs; }
From source file:info.ajaxplorer.client.http.AjxpAPI.java
public URI getFilehashDeltaUri(Node node) throws URISyntaxException { String url = getGetActionUrl("filehasher_delta"); try {//from w ww .j a v a2s. c o m url = url.concat("file=" + java.net.URLEncoder.encode(node.getPath(true), "UTF-8")); return returnUriFromString(url); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } }
From source file:info.ajaxplorer.client.http.AjxpAPI.java
public URI getFilehashPatchUri(Node node) throws URISyntaxException { String url = getGetActionUrl("filehasher_patch"); try {/*from w w w . ja v a2s. c om*/ url = url.concat("file=" + java.net.URLEncoder.encode(node.getPath(true), "UTF-8")); return returnUriFromString(url); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } }
From source file:Controller.FileAction.java
public String insertTaskPr() { String result = "fail"; session = ActionContext.getContext().getSession(); if (session.get("USER") != null && (int) session.get("ROLE") != 3) { return "fail"; } else {/*from ww w. ja va2s. c o m*/ if (session.get("ID") != null) { usercode = (int) session.get("ID"); } else { return "fail"; } try { if (this.taskFileFileName != null) { String filePath = ServletActionContext.getServletContext().getRealPath("/"); int a = filePath.indexOf("\\build\\web"); filePath = filePath.substring(0, a); filePath = filePath.concat("/web/task/"); filePath = filePath.concat(Integer.toString(usercode)); String fileName = new SimpleDateFormat("yyyyMMddHHmmss") .format(Calendar.getInstance().getTime()); fileName = fileName.concat(cc.randomString(6)).concat(".").concat(this.taskFileFileName .substring(this.taskFileFileName.lastIndexOf(".") + 1).toLowerCase()); File fileToCreate = new File(filePath, fileName); FileUtils.copyFile(this.taskFile, fileToCreate); f.setfName(fileName); } f.setuId(usercode); f.setStatus(true); f.setpId(0); if (fdao.insertFile(f)) { result = "success"; } else { result = "fail"; } } catch (Exception e) { e.printStackTrace(); } } return result; }
From source file:info.ajaxplorer.client.http.AjxpAPI.java
public URI getFilehashSignatureUri(Node node) throws URISyntaxException { String url = getGetActionUrl("filehasher_signature"); try {// w w w. ja va2 s.c om url = url.concat("file=" + java.net.URLEncoder.encode(node.getPath(true), "UTF-8")); return returnUriFromString(url); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } }