List of usage examples for java.lang String concat
public String concat(String str)
From source file:edu.wisc.hr.demo.InMemoryBusinessEmailUpdateDao.java
@Override public void updatePreferedEmail(String emplId, String newAddress) { if (newAddress == null) { throw new IllegalArgumentException("Cannot set preferred email address to null."); }//from ww w .j a v a 2 s. c om if (emplId == null) { throw new IllegalArgumentException( "Cannot update the preferred email address of " + "a user identified by a null emplId"); } String defaultAddress = emplId.concat(DEMO_DOMAIN); String oldAddress = defaultAddress; if (idToEmail.containsKey(emplId)) { oldAddress = (String) idToEmail.get(emplId); } if (newAddress.equals(defaultAddress)) { // setting preferred email to the default; simply drop any remembered mapping for this user idToEmail.remove(emplId); } idToEmail.put(emplId, newAddress); this.businessEmailUpdateNotifier.notifyEmailUpdated(oldAddress, newAddress); }
From source file:info.ajaxplorer.client.http.AjxpAPI.java
private String getLsRepositoryUrl() throws URISyntaxException { String ret = getGetActionUrl("ls"); return ret.concat("dir=%2F"); }
From source file:name.gumartinm.weather.information.widget.WidgetIntentService.java
private Current getRemoteCurrentThrowable(final WeatherLocation weatherLocation, final CustomHTTPClient HTTPClient, final ServiceCurrentParser weatherService) throws ClientProtocolException, MalformedURLException, URISyntaxException, JsonParseException, IOException {//from ww w .j a va 2s. co m final SharedPreferences sharedPreferences = PreferenceManager .getDefaultSharedPreferences(this.getApplicationContext()); final String APPID = sharedPreferences.getString(this.getString(R.string.weather_preferences_app_id_key), ""); final String APIVersion = this.getResources().getString(R.string.api_version); final String urlAPI = this.getResources().getString(R.string.uri_api_weather_today); String url = weatherService.createURIAPICurrent(urlAPI, APIVersion, weatherLocation.getLatitude(), weatherLocation.getLongitude()); if (!APPID.isEmpty()) { url = url.concat("&APPID=" + APPID); } final String jsonData = HTTPClient.retrieveDataAsString(new URL(url)); return weatherService.retrieveCurrentFromJPOS(jsonData); }
From source file:fr.natoine.model_annotation.AnnotationStatus.java
private String oneRadioButtonOnly(String _html, String _className, String _status, JSONArray _choices) throws JSONException { String _value = _choices.getString(0); _html = _html .concat("<div class=choice><input type=radio name=\"annotation_added_" + _className.toLowerCase() + "_" + _status + "\" value=\"" + _value + "\" checked /> " + _value + "</div>"); return _html; }
From source file:mobi.nordpos.catalog.action.ProductCreateActionBean.java
@ValidationMethod(priority = 1) public void validateProductBarcode(ValidationErrors errors) { String prefix = getBarcodePrefix(); if (!prefix.matches("\\d\\d\\d")) { prefix = DEFAULT_BARCODE_PREFIX; }/*from www.j av a 2 s . com*/ try { String plu = getPLU(getProduct().getProductCategory().getCode()); String code = getShortCode(); String barcode = prefix.concat(plu).concat(code); getProduct().setCode(barcode.concat(new EAN13CheckDigit().calculate(barcode))); } catch (CheckDigitException ex) { getContext().getValidationErrors().addGlobalError(new SimpleError(ex.getMessage())); } catch (SQLException ex) { getContext().getValidationErrors().addGlobalError(new SimpleError(ex.getMessage())); } }
From source file:net.sf.mzmine.modules.peaklistmethods.dataanalysis.projectionplots.ProjectionPlotPanel.java
public ProjectionPlotPanel(ProjectionPlotWindow masterFrame, ProjectionPlotDataset dataset, ParameterSet parameters) {//from w w w .jav a 2s . c o m super(null); boolean createLegend = false; if ((dataset.getNumberOfGroups() > 1) && (dataset.getNumberOfGroups() < 20)) createLegend = true; chart = ChartFactory.createXYAreaChart("", dataset.getXLabel(), dataset.getYLabel(), dataset, PlotOrientation.VERTICAL, createLegend, false, false); chart.setBackgroundPaint(Color.white); setChart(chart); // title TextTitle chartTitle = chart.getTitle(); chartTitle.setMargin(5, 0, 0, 0); chartTitle.setFont(titleFont); chart.removeSubtitle(chartTitle); // disable maximum size (we don't want scaling) setMaximumDrawWidth(Integer.MAX_VALUE); setMaximumDrawHeight(Integer.MAX_VALUE); // set the plot properties plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); // set grid properties plot.setDomainGridlinePaint(gridColor); plot.setRangeGridlinePaint(gridColor); // set crosshair (selection) properties plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); plot.setForegroundAlpha(dataPointAlpha); NumberFormat numberFormat = NumberFormat.getNumberInstance(); // set the X axis (component 1) properties NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setNumberFormatOverride(numberFormat); // set the Y axis (component 2) properties NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setNumberFormatOverride(numberFormat); plot.setDataset(dataset); spotRenderer = new ProjectionPlotRenderer(plot, dataset); itemLabelGenerator = new ProjectionPlotItemLabelGenerator(parameters); spotRenderer.setBaseItemLabelGenerator(itemLabelGenerator); spotRenderer.setBaseItemLabelsVisible(true); spotRenderer.setBaseToolTipGenerator(new ProjectionPlotToolTipGenerator(parameters)); plot.setRenderer(spotRenderer); // Setup legend if (createLegend) { LegendItemCollection legendItemsCollection = new LegendItemCollection(); for (int groupNumber = 0; groupNumber < dataset.getNumberOfGroups(); groupNumber++) { Object paramValue = dataset.getGroupParameterValue(groupNumber); if (paramValue == null) { // No parameter value available: search for raw data files // within this group, and use their names as group's name String fileNames = new String(); for (int itemNumber = 0; itemNumber < dataset.getItemCount(0); itemNumber++) { String rawDataFile = dataset.getRawDataFile(itemNumber); if (dataset.getGroupNumber(itemNumber) == groupNumber) fileNames = fileNames.concat(rawDataFile); } if (fileNames.length() == 0) fileNames = "Empty group"; paramValue = fileNames; } Color nextColor = (Color) spotRenderer.getGroupPaint(groupNumber); Color groupColor = new Color(nextColor.getRed(), nextColor.getGreen(), nextColor.getBlue(), (int) Math.round(255 * dataPointAlpha)); legendItemsCollection.add(new LegendItem(paramValue.toString(), "-", null, null, spotRenderer.getDataPointsShape(), groupColor)); } plot.setFixedLegendItems(legendItemsCollection); } }
From source file:com.photon.phresco.impl.ATGApplicationProcessor.java
private void updateBuildProperties(File propertyFile, String moduleName) throws PhrescoException { Properties properties = new Properties(); FileInputStream fis;/* w w w .ja v a 2 s . c o m*/ try { fis = new FileInputStream(propertyFile); properties.load(fis); String moduleBuildOrder = properties.getProperty("modules.build.order"); String module = moduleName + "/build.xml"; if (StringUtils.isEmpty(moduleBuildOrder)) { properties.put("modules.build.order", module); } else { if (!moduleBuildOrder.contains(module)) { properties.put("modules.build.order", moduleBuildOrder.concat(",").concat(module)); } } String moduleOrder = properties.getProperty("module.order"); if (StringUtils.isEmpty(moduleOrder)) { properties.put("module.order", moduleName); } else { if (!moduleOrder.contains(moduleName)) { properties.put("module.order", moduleOrder + " " + moduleName); } } properties.save(new FileOutputStream(propertyFile), ""); } catch (FileNotFoundException e) { throw new PhrescoException(e); } catch (IOException e) { throw new PhrescoException(e); } }
From source file:de.tudarmstadt.ukp.lmf.transform.wordnet.SubcategorizationFrameExtractor.java
/** * This method parses syntactic arguments encoded in a line of subcategorization mapping file * @param synSemArgs part of the line encoding the arguments * @param subcatFrame subcategorization frame to which syntactic arguments should be appended * @return subcategorization frame with appended syntactic arguments * @see SubcategorizationFrame//from w w w . j ava2s.c o m * @see SyntacticArgument */ private SubcategorizationFrame parseArguments(String synSemArgs, SubcategorizationFrame subcatFrame) { SubcategorizationFrame scFrame = subcatFrame; List<SyntacticArgument> synArgs = new LinkedList<SyntacticArgument>(); String[] args = synSemArgs.split(":"); for (String arg : args) { if (!arg.contains("syntacticProperty")) { SyntacticArgument syntacticArgument = new SyntacticArgument(); syntacticArgument.setId("WN_SyntacticArgument_".concat(Integer.toString(syntacticArgumentNumber))); syntacticArgumentNumber++; String[] atts = arg.split(","); for (String att : atts) { String[] splits = att.split("="); String attName = splits[0]; if (attName.equals("grammaticalFunction")) { String gf = splits[1]; if (gf.endsWith("Comp")) { gf = gf.concat("lement"); } syntacticArgument.setGrammaticalFunction(EGrammaticalFunction.valueOf(gf)); } if (attName.equals("syntacticCategory")) { syntacticArgument.setSyntacticCategory(ESyntacticCategory.valueOf(splits[1])); } else if (attName.equals("optional")) { syntacticArgument.setOptional(splits[1].equals("yes")); } else if (attName.equals("case")) { syntacticArgument.setCase(ECase.valueOf(splits[1])); } else if (attName.equals("determiner")) { syntacticArgument.setDeterminer(EDeterminer.valueOf(splits[1])); } else if (attName.equals("preposition")) { syntacticArgument.setPreposition(splits[1]); } else if (attName.equals("prepositionType")) { syntacticArgument.setPrepositionType(splits[1]); } else if (attName.equals("number")) { syntacticArgument.setNumber(EGrammaticalNumber.valueOf(splits[1])); } else if (attName.equals("lex")) { syntacticArgument.setLexeme(splits[1]); } else if (attName.equals("verbForm")) { syntacticArgument.setVerbForm(EVerbForm.valueOf(splits[1])); } else if (attName.equals("tense")) { syntacticArgument.setTense(ETense.valueOf(splits[1])); } else if (attName.equals("complementizer")) { syntacticArgument.setComplementizer(EComplementizer.valueOf(splits[1])); } } synArgs.add(syntacticArgument); } else { String[] splits = arg.split("="); String sp = splits[1]; if (sp.equals("raising")) { sp = sp.replaceAll("raising", "subjectRaising"); } LexemeProperty lexemeProperty = new LexemeProperty(); lexemeProperty.setSyntacticProperty(ESyntacticProperty.valueOf(sp)); scFrame.setLexemeProperty(lexemeProperty); } } scFrame.setSyntacticArguments(synArgs); return scFrame; }
From source file:pdl.web.service.common.FileService.java
public Map<String, String> downloadFile(String fileId, HttpServletResponse res, String username) { //TODO check user permission for downloading a file Map<String, String> rtnJson = new TreeMap<String, String>(); try {/*from w w w.ja va2 s . co m*/ String filePath = this.getFilePathById(fileId); if (filePath != null && !filePath.isEmpty() && ToolPool.canReadFile(filePath)) { String fileName = fileId.concat(".json"); res.setContentType("application/json"); res.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\""); IOUtils.copy(new FileInputStream(filePath), res.getOutputStream()); res.flushBuffer(); rtnJson.put("file name", fileName); } } catch (Exception ex) { rtnJson.put("error", "Downloading file failed"); rtnJson.put("message", ex.toString()); } return rtnJson; }
From source file:com.krawler.spring.crm.caseModule.CrmCustomerCaseController.java
public ModelAndView custPassword_Change(HttpServletRequest request, HttpServletResponse response) throws ServletException { String newpass = request.getParameter("newpass"); String currentpass = request.getParameter("curpass"); String customerid = request.getParameter("customerid"); String email = request.getParameter("email"); Map model = new HashMap(); // String replaceStr=request.getParameter("cdomain"); String url = URLUtil.getRequestPageURL(request, Links.UnprotectedLoginPageFull); String loginurl = url.concat("caselogin.jsp"); String name = request.getParameter("cname"); boolean verify_pass = false; String responseMessage = ""; if ((String) request.getSession().getAttribute(Constants.SESSION_CUSTOMER_ID) != null) { DefaultTransactionDefinition def = new DefaultTransactionDefinition(); def.setName("JE_Tx"); def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); def.setIsolationLevel(TransactionDefinition.ISOLATION_READ_UNCOMMITTED); TransactionStatus status = txnManager.getTransaction(def); try {/*from w w w.j ava 2s . c o m*/ verify_pass = contactManagementService.verifyCurrentPass(currentpass, customerid); if (verify_pass) { contactManagementService.custPassword_Change(newpass, customerid); txnManager.commit(status); request.setAttribute("homepage", "true"); request.setAttribute("success", "true"); responseMessage = "usercases/redirect"; String partnerNames = sessionHandlerImplObj.getPartnerName(); String sysEmailId = sessionHandlerImplObj.getSystemEmailId(); String passwordString = "Username: " + email + " <br/><br/>Password: <b>" + newpass + "</b>"; String htmlmsg = "Dear <b>" + name + "</b>,<br/><br/> Your <b>password has been changed</b> for your account on " + partnerNames + " CRM. <br/><br/>" + passwordString + "<br/><br/>You can log in at:\n" + loginurl + "<br/><br/>See you on " + partnerNames + " CRM <br/><br/> -The " + partnerNames + " CRM Team"; try { SendMailHandler.postMail(new String[] { email }, "[" + partnerNames + "] Password Changed", htmlmsg, "", sysEmailId, partnerNames + " Admin"); } catch (MessagingException e) { e.printStackTrace(); } } else { request.setAttribute("changepassword", "true"); request.setAttribute("mis_pass", "true"); txnManager.commit(status); } } catch (Exception e) { logger.warn("custPassword_change Error:", e); txnManager.rollback(status); responseMessage = "../../usercases/failure"; } } else { request.setAttribute("logout", "true"); } responseMessage = "usercases/redirect"; return new ModelAndView(responseMessage, "model", model); }