List of usage examples for org.apache.commons.lang3 StringUtils equals
public static boolean equals(final CharSequence cs1, final CharSequence cs2)
Compares two CharSequences, returning true if they represent equal sequences of characters.
null s are handled without exceptions.
From source file:com.neophob.sematrix.generator.Blinkenlights.java
/** * load a new file./* w w w.j a va 2 s.co m*/ * * @param file the file */ public void loadFile(String file) { //only load if needed if (!StringUtils.equals(file, this.filename)) { long start = System.currentTimeMillis(); LOG.log(Level.INFO, "Load blinkenlights file " + file); this.filename = file; blinken.loadFile(PREFIX + file, this.internalBufferXSize); blinkenSettings(); LOG.log(Level.INFO, "Load blinkenlights done, needed time in ms: " + (System.currentTimeMillis() - start)); } }
From source file:controllers.attachment.AttachUploadApp.java
/** * ?/*from w ww. j av a 2 s . c o m*/ * @param filePart * @return */ public static ObjectNodeResult save(File sourceFile, String fileName, ObjectNodeResult result, User currentUser, String attachType) { StringBuffer sb = new StringBuffer(PROOF_UPLOAD_PATH); String date = dateFormat.format(new java.util.Date()); sb.append("attachment"); if (StringUtils.equals("suggestion", attachType)) { sb.append(File.separator).append("suggestion"); } else if (StringUtils.equals("service", attachType)) { sb.append(File.separator).append("service"); } else if (StringUtils.equals("require", attachType)) { sb.append(File.separator).append("require"); } else if (StringUtils.equals("feedback", attachType)) { sb.append(File.separator).append("feedback"); } else { sb.append(File.separator).append("industry"); } sb.append(File.separator).append(date); // File path = new File(sb.toString()); if (!path.exists()) { path.mkdirs(); } //???cdn if (!path.exists()) { String str = "??"; if (StringUtils.equals("service", attachType)) { str = "??"; } else if (StringUtils.equals("require", attachType)) { str = "?"; } return result.error(str); } String newFileName = getNewFileName(fileName); String uploadPath = sb.append(File.separator).append(newFileName).toString(); File target = new File(uploadPath); BigDecimal sizeTemp = BigDecimal.valueOf(sourceFile.length()); String suffixTemp = getSuffix(fileName); move(sourceFile, target); String relativePath = FEEDBACK_UPLOAD_RELATIVE_PATH; if (StringUtils.equals("suggestion", attachType)) { relativePath = SUGGESTION_UPLOAD_RELATIVE_PATH; } else if (StringUtils.equals("service", attachType)) { relativePath = SERVICE_UPLOAD_RELATIVE_PATH; } else if (StringUtils.equals("require", attachType)) { relativePath = REQUIRE_UPLOAD_RELATIVE_PATH; } else if (StringUtils.equals("industry", attachType)) { relativePath = INDUSTRY_UPLOAD_RELATIVE_PATH; } String relPath = new StringBuffer(relativePath).append(date).append("/").append(newFileName).toString(); result.getObjectNode().put("path", relPath); result.getObjectNode().put("pathsource", Assets.at(relPath)); // String pathTemp = relPath; Attach attach = new AttachOfFeedback(fileName, pathTemp, suffixTemp, sizeTemp, new Date(), currentUser == null ? null : currentUser.getId(), currentUser == null ? "" : currentUser.getName(), false); if (StringUtils.equals("suggestion", attachType)) { attach = new AttachOfSuggestion(fileName, pathTemp, suffixTemp, sizeTemp, new Date(), currentUser == null ? null : currentUser.getId(), currentUser == null ? "" : currentUser.getName(), false); } else if (StringUtils.equals("service", attachType)) { attach = new AttachOfService(fileName, pathTemp, suffixTemp, sizeTemp, new Date(), currentUser == null ? null : currentUser.getId(), currentUser == null ? "" : currentUser.getName(), false); } else if (StringUtils.equals("require", attachType)) { attach = new AttachOfRequire(fileName, pathTemp, suffixTemp, sizeTemp, new Date(), currentUser == null ? null : currentUser.getId(), currentUser == null ? "" : currentUser.getName(), false); } else if (StringUtils.equals("industry", attachType)) { attach = new AttachOfIndustry(fileName, pathTemp, suffixTemp, sizeTemp, new Date(), currentUser == null ? null : currentUser.getId(), currentUser == null ? "" : currentUser.getName(), false); } attach.saveOrUpdate(); result.getObjectNode().put("attachId", attach.id); result.getObjectNode().put("fileName", fileName); return result; }
From source file:com.hybris.mobile.activity.BarCodeScannerActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { String contents = data.getStringExtra(SCAN_RESULT); String format = data.getStringExtra(SCAN_RESULT_FORMAT); Log.i(TAG, "Contents: " + contents); Log.i(TAG, "format: " + format); String isUseSpecificBaseUrl = Hybris .getSharedPreferenceString(InternalConstants.KEY_PREF_TOGGLE_SPECIFIC_BASE_URL); if (StringUtils.equals(isUseSpecificBaseUrl, String.valueOf(false))) { Log.i(TAG, "calling default handler for url: " + contents); // We run the task to check the format and data availability of the barcode scanned new CheckBarcodeFormatAndValueTask().execute(contents, format); } else {//from w w w. j a v a 2 s . c o m //isScannerRunning = false; // WebView myWebView = new WebView(this); // myWebView = (WebView) findViewById(R.layout.app_web_view); Log.i(TAG, "calling webview activity with url: " + contents); // myWebView.loadUrl(contents); // WebSettings webSettings = myWebView.getSettings(); // webSettings.setJavaScriptEnabled(true); Intent localintent = new Intent(Hybris.getAppContext(), ScanCodeWebViewActivity.class); localintent.putExtra(Constants.DATA, contents); localintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Log.i(TAG, "Sending intent to start webview for url"); Hybris.getAppContext().startActivity(localintent); } } else if (resultCode == RESULT_CANCELED) { Message msg = new Message(); msg.what = BarCodeScannerActivity.MSG_CANCEL_SCAN; mHandler.sendMessage(msg); } }
From source file:com.adeptj.modules.commons.jdbc.service.internal.HikariDataSourceService.java
/** * {@inheritDoc}/*from ww w .j a va2 s . c o m*/ */ @Override public DataSource getDataSource(String name) { Validate.isTrue(StringUtils.isNotEmpty(name), "DataSource name can't be empty!!"); if (StringUtils.equals(this.dataSource.getPoolName(), name)) { return new DataSourceWrapper(this.dataSource); } throw new IllegalStateException(String.format(JDBC_DS_NOT_CONFIGURED_MSG, name)); }
From source file:gov.nih.nci.caintegrator.web.action.query.form.AbstractCriterionParameter.java
/** * @param operator the new operator value *//*from ww w . j a va 2 s . co m*/ public void setOperator(String operator) { if (!StringUtils.equals(getOperator(), operator)) { newOperator = operator; operatorChanged = true; } }
From source file:com.glaf.batch.domain.JobInstance.java
public Double getDoubleValue(String keyName) { if (params != null && !params.isEmpty()) { for (JobParam param : params) { if (StringUtils.equals(keyName, param.getKeyName())) { return param.getDoubleVal(); }/*w w w . j a v a 2 s .c om*/ } } return null; }
From source file:com.hybris.mobile.app.commerce.fragment.ProductDetailFragment.java
@Override protected OnItemSelectedListener getVariantSpinnerListener() { return new OnItemSelectedListener() { @Override//from www. j ava 2 s.co m public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { switch (parent.getId()) { case R.id.product_detail_variant_spinner_1: if (mVariantPopulated && position < mProductDetailVariantSpinner1.getAdapter().getCount() && !StringUtils.equals( ((VariantOption) mProductDetailVariantSpinner1.getSelectedItem()).getCode(), mProduct.getCode())) { mVariantPopulated = false; mNbVariantLevelsInstantiated = 0; selectVariant(((VariantOption) mProductDetailVariantSpinner1.getSelectedItem()).getCode()); } break; case R.id.product_detail_variant_spinner_2: if (mVariantPopulated && position < mProductDetailVariantSpinner2.getAdapter().getCount() && !StringUtils.equals( ((VariantOption) mProductDetailVariantSpinner2.getSelectedItem()).getCode(), mProduct.getCode())) { mVariantPopulated = false; mNbVariantLevelsInstantiated = 0; selectVariant(((VariantOption) mProductDetailVariantSpinner2.getSelectedItem()).getCode()); } break; } mNbVariantLevelsInstantiated++; if (mNbVariantLevelsInstantiated == mNbVariantLevels) { mVariantPopulated = true; } } @Override public void onNothingSelected(AdapterView<?> parent) { } }; }
From source file:io.wcm.devops.conga.generator.plugins.postprocessor.AbstractPostProcessor.java
/** * Find matching file header plugin for the given file. * @param file// w w w. ja v a2s .c o m * @return File header plugin or null if no match found. */ private FileHeaderPlugin detectFileHeaderPlugin(FileContext file, PostProcessorContext postProcessorContext) { FileHeaderContext dummyFileHeader = new FileHeaderContext(); Optional<FileHeaderPlugin> fileHeaderPlugin = postProcessorContext.getPluginManager() .getAll(FileHeaderPlugin.class).stream().filter(plugin -> plugin.accepts(file, dummyFileHeader)) .filter(plugin -> !StringUtils.equals(plugin.getName(), NoneFileHeader.NAME)).findFirst(); if (fileHeaderPlugin.isPresent()) { return fileHeaderPlugin.get(); } else { return null; } }
From source file:de.jcup.egradle.eclipse.ide.preferences.EGradleSetupGradlePreferencePage.java
@Override public boolean performOk() { boolean done = super.performOk(); if (done) {//from w w w .jav a 2 s .c o m String newRootProject = uiDelegate.getRootPathDirectory(); if (StringUtils.isEmpty(newRootProject)) { try { IDEUtil.setNoRootProjectFolder(); } catch (CoreException e) { IDEUtil.logError("Was not able to set no root project folder", e); /* not done... */ return false; } } else if (!StringUtils.equals(newRootProject, originRootProject)) { /* * root project has changed - refresh decoration of all projects */ File newRootProjectFolder = new File(newRootProject); try { IDEUtil.setNewRootProjectFolder(newRootProjectFolder); } catch (CoreException e) { IDEUtil.logError("Was not able to set new root project folder:" + newRootProject, e); /* not done... */ return false; } } } return done; }
From source file:gob.dp.simco.registro.controller.VictimaViolenciaController.java
public void mapearTipos() { tiposVictima = new HashMap(); int nroMuertos = 0; int nroSecuestrados = 0; int nroHerido = 0; int nroDetenidos = 0; int nroOtros = 0; int nroDesaparecidos = 0; int nN = 0;/*from ww w . j ava2 s . c o m*/ if (listaVictimas != null) { for (ActividadVictima av : listaVictimas) { if (StringUtils.equals(av.getTipo(), "01")) { nroMuertos++; } if (StringUtils.equals(av.getTipo(), "02")) { nroHerido++; } if (StringUtils.equals(av.getTipo(), "03")) { nroSecuestrados++; } if (StringUtils.equals(av.getTipo(), "04")) { nroDetenidos++; } if (StringUtils.equals(av.getTipo(), "05")) { nroDesaparecidos++; } if (StringUtils.equals(av.getTipo(), "06")) { nroOtros++; } if (StringUtils.equals(av.getTipo(), "0")) { nN++; } } } tiposVictima.put("Muertos", nroMuertos); tiposVictima.put("Heridos", nroHerido); tiposVictima.put("Secuestrados", nroSecuestrados); tiposVictima.put("Detenidos", nroDetenidos); tiposVictima.put("Desaparecidos", nroDesaparecidos); tiposVictima.put("Otros", nroOtros); tiposVictima.put("NN", nN); }