List of usage examples for java.lang String concat
public String concat(String str)
From source file:de.thischwa.pmcms.view.context.object.SiteLinkTool.java
/** * Set the link to the committed page.//from ww w . j av a 2 s . c om * * @param pageTo */ public SiteLinkTool getPage(final Page pageTo) { if (isExportView) { String pageName; if (PoInfo.isWelcomePage(pageTo) || OrderableInfo.isFirst(pageTo)) pageName = welcomePageName; else pageName = pageTo.getName().concat(".") .concat(propertiesManager.getSiteProperty("pmcms.site.export.file.extension")); String levelName = PathTool.getURLRelativePathToLevel(this.currentLevel, pageTo.getParent()); if (StringUtils.isNotBlank(levelName) && !levelName.endsWith("/")) levelName = levelName.concat("/"); setResource(levelName.concat(pageName)); } else setPageForPreview(pageTo); return this; }
From source file:de.ingrid.portal.scheduler.jobs.IngridMonitorAbstractJob.java
private void sendEmail(JobDetail job, String email) { if (log.isDebugEnabled()) { log.debug("Try to sent alert email to " + email); }// w ww .j a v a2s. c om HashMap<String, Object> mailData = new HashMap<String, Object>(); mailData.put("JOB", job); ResourceBundle resources = ResourceBundle.getBundle("de.ingrid.portal.resources.AdminPortalResources", Locale.GERMAN); mailData.put("MESSAGES", new IngridResourceBundle(resources, Locale.GERMAN)); URL url = Thread.currentThread().getContextClassLoader() .getResource("../templates/administration/monitor_alert_email.vm"); String templatePath = url.getPath(); String emailSubject = PortalConfig.getInstance() .getString(PortalConfig.COMPONENT_MONITOR_ALERT_EMAIL_SUBJECT, "ingrid component monitor alert"); emailSubject = emailSubject.concat(" [").concat(job.getJobDataMap().getString(PARAM_COMPONENT_TITLE)) .concat("]"); if (job.getJobDataMap().getInt(PARAM_STATUS) == STATUS_OK) { emailSubject = emailSubject.concat("[OK]"); } else { emailSubject = emailSubject.concat("[FAILED]"); } String from = PortalConfig.getInstance().getString(PortalConfig.COMPONENT_MONITOR_ALERT_EMAIL_SENDER, "foo@bar.com"); String to = email; String text = Utils.mergeTemplate(templatePath, mailData, "map"); Utils.sendEmail(from, emailSubject, new String[] { to }, text, null); if (log.isDebugEnabled()) { log.debug("Sent alert email to " + to); } }
From source file:com.github.alexfalappa.nbspringboot.projects.initializr.InitializrService.java
public InputStream getProject(String bootVersion, String mvnGroup, String mvnArtifact, String mvnVersion, String mvnName, String mvnDesc, String packaging, String pkg, String lang, String javaVersion, String deps) throws Exception { // set connection timeouts timeoutFromPrefs();/* w w w. j a va 2s .c o m*/ // prepare parameterized url final String serviceUrl = NbPreferences.forModule(PrefConstants.class).get(PREF_INITIALIZR_URL, "http://start.spring.io"); UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(serviceUrl.concat("/starter.zip")) .queryParam("type", "maven-project").queryParam("bootVersion", bootVersion) .queryParam("groupId", mvnGroup).queryParam("artifactId", mvnArtifact) .queryParam("version", mvnVersion).queryParam("packaging", packaging).queryParam("name", mvnName) .queryParam("description", mvnDesc).queryParam("language", lang) .queryParam("javaVersion", javaVersion).queryParam("packageName", pkg) .queryParam("dependencies", deps); final URI uri = builder.build().encode().toUri(); // setup request object RequestEntity<Void> req = RequestEntity.get(uri).accept(APPLICATION_OCTET_STREAM) .header("User-Agent", REST_USER_AGENT).build(); // connect logger.info("Getting Spring Initializr project"); logger.log(INFO, "Service URL: {0}", uri.toString()); long start = System.currentTimeMillis(); ResponseEntity<byte[]> respEntity = rt.exchange(req, byte[].class); // analyze response outcome final HttpStatus statusCode = respEntity.getStatusCode(); if (statusCode == OK) { final ByteArrayInputStream stream = new ByteArrayInputStream(respEntity.getBody()); logger.log(INFO, "Retrieved archived project from Spring Initializr service. Took {0} msec", System.currentTimeMillis() - start); return stream; } else { // log status code final String errMessage = String.format( "Spring initializr service connection problem. HTTP status code: %s", statusCode.toString()); logger.severe(errMessage); // throw exception in order to set error message throw new RuntimeException(errMessage); } }
From source file:com.xively.client.http.DefaultRequestHandler.java
private URIBuilder buildUri(HttpMethod requestMethod, String appPath, Map<String, Object> params, AcceptedMediaType mediaType) {//from w ww.j av a2s. c o m URIBuilder uriBuilder = new URIBuilder(); String path = appPath; if (HttpMethod.GET == requestMethod) { path = appPath.concat(".").concat(mediaType.name()); } uriBuilder.setScheme("http").setHost(baseURI).setPath(path); if (params != null && !params.isEmpty()) { for (Entry<String, Object> param : params.entrySet()) { uriBuilder.addParameter(param.getKey(), StringUtil.toString(param.getValue())); } } return uriBuilder; }
From source file:de.ingrid.portal.scheduler.jobs.IngridMonitorAbstractJob.java
private boolean sendUpdateEmail(String email, IngridComponent component) { String from = PortalConfig.getInstance().getString(PortalConfig.COMPONENT_MONITOR_ALERT_EMAIL_SENDER, "foo@bar.com"); String emailSubject = PortalConfig.getInstance().getString( PortalConfig.COMPONENT_MONITOR_UPDATE_ALERT_EMAIL_SUBJECT, "ingrid component monitor update alert"); emailSubject = emailSubject.concat(" [").concat(component.getName()).concat("]"); URL url = Thread.currentThread().getContextClassLoader() .getResource("../templates/administration/monitor_update_alert_email.vm"); String templatePath = url.getPath(); HashMap<String, Object> mailData = new HashMap<String, Object>(); mailData.put("COMPONENT", component); ResourceBundle resources = ResourceBundle.getBundle("de.ingrid.portal.resources.AdminPortalResources", Locale.GERMAN);// w w w . ja v a2 s .c o m mailData.put("MESSAGES", new IngridResourceBundle(resources, Locale.GERMAN)); String text = Utils.mergeTemplate(templatePath, mailData, "map"); return Utils.sendEmail(from, emailSubject, new String[] { email }, text, null); }
From source file:at.zone.madeleine.slideshow.ImageDownloader.java
/** * Retrieve Bitmap from local storage./* ww w .j a va2 s. c o m*/ */ private Bitmap getBitmapFromDisc(String url) { String filename = getFileNameFromURL(url); if (url.contains("thumbnail")) { filename = "thumbnail_".concat(filename); } String path = ContentManager.getInstance().getSlideshowPath(); Bitmap bitmap = BitmapFactory.decodeFile(path.concat(filename)); return bitmap; }
From source file:com.pactera.edg.am.metamanager.extractor.adapter.extract.db.impl.DBExtractFilterImpl.java
private void filtrateView(View view) { Map<String, NamedColumnSetType> rSchTables = view.getReferenceSchTables(); if (rSchTables.size() == 0) return;/* w ww. ja va 2 s . com*/ Set<String> filtrateRTable = new HashSet<String>(); for (Iterator<Entry<String, NamedColumnSetType>> schTables = rSchTables.entrySet().iterator(); schTables .hasNext();) { Entry<String, NamedColumnSetType> schTable = schTables.next(); if (schTable.getValue() == NamedColumnSetType.TABLE) { // ?,? filtrateRTable.add(schTable.getKey()); } } for (String srcTableName : filtrateRTable) { rSchTables.remove(srcTableName); String srcSchemaName = srcTableName.substring(0, srcTableName.indexOf(".") + 1); if (filtrateTables.containsKey(srcTableName)) { rSchTables.put(srcSchemaName.concat(filtrateTables.get(srcTableName)), NamedColumnSetType.TABLE); } } }
From source file:edu.wisc.hr.demo.RandomContactInfoDao.java
@Override public PersonInformation getPersonalData(String emplId) { if (this.emplIdToPersonInformation.containsKey(emplId)) { return (PersonInformation) this.emplIdToPersonInformation.get(emplId); }//from ww w .j a v a 2 s. c o m PersonInformation personInformation = new PersonInformation(); personInformation.setName(RANDOM_NAME_GENERATOR.randomName(emplId)); personInformation.setEmail(emplId.concat("@entropy.edu")); Job primaryJob = RANDOM_JOB_GENERATOR.randomJob(); personInformation.setPrimaryJob(primaryJob); personInformation.setHomeAddress(RANDOM_ADDRESS_GENERATOR.randomHomeAddress()); String department = primaryJob.getDepartmentName(); personInformation.setOfficeAddress(RANDOM_ADDRESS_GENERATOR.randomOfficeAddress(department)); personInformation.setMadisonEmpl(random.nextBoolean()); personInformation.setOnVisa(random.nextBoolean()); this.emplIdToPersonInformation.put(emplId, personInformation); return personInformation; }
From source file:com.adithya321.sharesanalysis.fragments.DetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_detail, container, false); final TextView date = (TextView) rootView.findViewById(R.id.detail_date); final TextView open = (TextView) rootView.findViewById(R.id.detail_open); final TextView high = (TextView) rootView.findViewById(R.id.detail_high); final TextView low = (TextView) rootView.findViewById(R.id.detail_low); final TextView last = (TextView) rootView.findViewById(R.id.detail_last); final TextView close = (TextView) rootView.findViewById(R.id.detail_close); final TextView quantity = (TextView) rootView.findViewById(R.id.detail_quantity); final TextView turnover = (TextView) rootView.findViewById(R.id.detail_turnover); final SparkView sparkView = (SparkView) rootView.findViewById(R.id.detail_spark_view); databaseHandler = new DatabaseHandler(getActivity()); List<Share> shares = databaseHandler.getShares(); share = new Share(); for (Share s : shares) { if (s.getName().equals(getArguments().getString(ARG_SHARE_NAME))) { share = s;/*www.j a v a2s . co m*/ break; } } String BASE_URL = "https://www.quandl.com/api/v3/datasets/NSE/"; String url = BASE_URL.concat(StringUtils.getCode(share.getName()) + ".json"); HttpUrl.Builder urlBuilder = HttpUrl.parse(url).newBuilder(); urlBuilder.addQueryParameter("api_key", getString(R.string.quandl_api_key)); url = urlBuilder.build().toString(); OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder().url(url).build(); client.newCall(request).enqueue(new Callback() { @Override public void onResponse(Call call, final Response response) throws IOException { try { String responseData = response.body().string(); JSONObject j = new JSONObject(responseData); j = j.getJSONObject("dataset"); final JSONArray jsonArray = j.getJSONArray("data"); getActivity().runOnUiThread(new Runnable() { @Override public void run() { try { float[] yData = new float[jsonArray.length()]; int j = jsonArray.length() - 1; for (int i = 0; i < jsonArray.length(); i++) { try { yData[j] = Float.parseFloat(jsonArray.getJSONArray(i).get(5).toString()); } catch (Exception e) { // } j--; } sparkView.setAdapter(new SparkViewAdapter(yData)); date.setText(jsonArray.getJSONArray(0).get(0).toString()); open.setText(jsonArray.getJSONArray(0).get(1).toString()); high.setText(jsonArray.getJSONArray(0).get(2).toString()); low.setText(jsonArray.getJSONArray(0).get(3).toString()); last.setText(jsonArray.getJSONArray(0).get(4).toString()); close.setText(jsonArray.getJSONArray(0).get(5).toString()); quantity.setText(jsonArray.getJSONArray(0).get(6).toString()); turnover.setText(jsonArray.getJSONArray(0).get(7).toString()); } catch (Exception e) { Log.e("UI Json", e.toString()); } } }); } catch (Exception e) { Log.e("DetailFragment Json", e.toString()); } } @Override public void onFailure(Call call, IOException e) { Log.e("DetailFragment onFail", e.toString()); } }); setSharePurchases(rootView); setShareSales(rootView); setShareHoldings(rootView); return rootView; }
From source file:com.mediaworx.ziputils.Zipper.java
/** * Creates a new zip file.// w w w .j a v a2 s .c om * @param zipFilename filename for the zip * @param zipTargetFolderPath path of the target folder where the zip should be stored (it will be created if it * doesn't exist) * @throws IOException Exceptions from the underlying package framework are bubbled up */ public Zipper(String zipFilename, String zipTargetFolderPath) throws IOException { File targetFolder = new File(zipTargetFolderPath); if (!targetFolder.exists()) { FileUtils.forceMkdir(targetFolder); } if (!zipTargetFolderPath.endsWith(File.separator)) { zipTargetFolderPath = zipTargetFolderPath.concat(File.separator); } zipOutputStream = new FileOutputStream(zipTargetFolderPath + zipFilename); try { zip = new ArchiveStreamFactory().createArchiveOutputStream(ArchiveStreamFactory.ZIP, zipOutputStream); } catch (ArchiveException e) { // This should never happen, because "zip" is a known archive type, but let's log it anyway LOG.error("Cant create an archive of type " + ArchiveStreamFactory.ZIP); } }