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:io.wcm.devops.conga.plugins.sling.fileheader.OsgiConfigFileHeader.java
@Override protected String sanitizeComment(String line) { if (StringUtils.equals(line, "") || StringUtils.contains(line, "*****")) { return null; }//from w w w . j a va 2s. c om return StringUtils.trim(line); }
From source file:com.cognifide.qa.bb.aem.touch.data.componentconfigs.ComponentConfiguration.java
/** * Returns first {@link FieldConfig} with provided label * * @param tabName Tab name in the dialog window * @param configurationKey key of yaml component configuration * @param label field label/*ww w . j a va 2 s . c o m*/ * @return */ public FieldConfig getFieldConfigByLabel(String tabName, String configurationKey, String label) { return getConfigurationForTab(tabName).stream().filter(t -> StringUtils.equals(t.getLabel(), label)) .findFirst() .orElseThrow(() -> new IllegalArgumentException("No field config found for provided data")); }
From source file:controller.ViewEC.java
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods./* w w w . jav a 2s .co m*/ * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { response.setContentType("text/html;charset=UTF-8"); int ecId = Integer.parseInt(request.getParameter("id")); String action = request.getParameter("action"); ExtenuatingCircumstance ec = new ExtenuatingCircumstanceDAO().retrieveECById(ecId); ArrayList<Evidence> evidences = new EvidenceDAO().retrieveEvidenceByEcId(ecId); request.setAttribute("ec", ec); request.setAttribute("evidences", evidences); request.setAttribute("role", request.getParameter("role")); if (StringUtils.equals(action, "edit")) { request.getRequestDispatcher("UpdateEC.jsp").forward(request, response); } else { request.getRequestDispatcher("ViewECDetail.jsp").forward(request, response); } } catch (SQLException ex) { Logger.getLogger(ViewEC.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.boozallen.cognition.ingest.storm.bolt.logic.SkipFieldValueBolt.java
@Override protected boolean shouldEmit(LogRecord record) { String value = record.getValue(field); if (StringUtils.equals(value, this.value)) return false; else// w w w. ja v a 2s .c o m return true; }
From source file:de.micromata.genome.gwiki.controls.GWikiPageSuggestionsActionBean.java
/** * deprecated/*from w w w . j a v a 2 s.c om*/ * * @return */ public Object onLinkAutocomplete() { String format = wikiContext.getRequestParameter("f"); String q = wikiContext.getRequestParameter("q"); String pageType = wikiContext.getRequestParameter("pageType"); String queryexpr = SearchUtils.createLinkExpression(q, true, pageType); SearchQuery query = new SearchQuery(queryexpr, wikiContext.getWikiWeb()); query.setMaxCount(1000); QueryResult qr = filter(query); StringBuilder sb = new StringBuilder(); // int size = qr.getResults().size(); if (StringUtils.equals(format, "json") == true) { wikiContext.getResponse().setContentType("application/json"); sb.append("["); boolean first = true; for (SearchResult sr : qr.getResults()) { if (first == false) { sb.append(","); } else { first = false; } String tti = wikiContext.getTranslatedProp(sr.getElementInfo().getTitle()); sb.append("{ pageId: '").append(sr.getPageId()).append("', title: '") .append(StringEscapeUtils.unescapeEcmaScript(tti)).append("'}"); // sb.append("'").append(sr.getPageId()).append("'"); } sb.append("]"); } else { for (SearchResult sr : qr.getResults()) { sb.append(sr.getPageId()).append("|") .append(wikiContext.getTranslatedProp(sr.getElementInfo().getTitle())).append("\n"); } } wikiContext.append(sb.toString()); wikiContext.flush(); return noForward(); }
From source file:fr.penet.servlet.TitleStatsServlet.java
@Override public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/plain"); String shardsString = req.getParameter("shards"); if (!StringUtils.isNumeric(shardsString)) { resp.getWriter().println("Error : empty shards parameter or not an integer"); return;//w ww . j a va 2s . co m } int shards = Integer.parseInt(shardsString); String runIdString = req.getParameter("runId"); if (!StringUtils.isNumeric(runIdString)) { resp.getWriter().println("Error : empty runId parameter or not an integer"); return; } int runId = Integer.parseInt(runIdString); String runType = req.getParameter("type"); CrawlDbInput input = new CrawlDbInput(runId, shards); TitleWordsMapper mapper = new TitleWordsMapper(); Output<Map<String, List<Integer>>, Void> output; String jobName = "MR stats for " + runId; if (StringUtils.equals(runType, "sql-output")) { output = new CrawlDbOutputWords(runId); jobName += " (SQL)"; } else { output = new CrawlDbOutputWordsDatastore(runId); jobName += " (datastore)"; } MapSpecification<CrawlPage, Map<String, List<Integer>>, Void> spec = new MapSpecification.Builder<>(input, mapper, output).setJobName(jobName).build(); // default settings should be ok MapSettings settings = new MapSettings.Builder().build(); String jobId = MapJob.start(spec, settings); resp.getWriter().println("Mapper started. Job id : " + jobId); }
From source file:com.hybris.mobile.app.commerce.helper.ProductHelper.java
/** * populate the spinner with variants otherwise hide Maximum supported Spinner is 3 *//* www . j av a 2s . c om*/ public static int populateVariant(Context context, List<Spinner> spinners, ProductBase product, boolean resetChildSpinner) { if (product.getBaseOptions() != null && !product.getBaseOptions().isEmpty()) { if (product.getVariantOptions() != null && product.getBaseOptions().size() == 1) { BaseOption newVariant = new BaseOption(); newVariant.setVariantType(product.getVariantType()); newVariant.setOptions(product.getVariantOptions()); product.getBaseOptions().add(newVariant); } for (BaseOption productOption : product.getBaseOptions()) { if (productOption.getOptions() != null) { if (StringUtils.equals(productOption.getVariantType(), B2CConstants.APPAREL_STYLE_VARIANT_PRODUCT)) { populateSpinner(context, spinners.get(0), productOption.getOptions(), findVariantPosition(productOption.getOptions(), productOption.getSelected())); } if (StringUtils.equals(productOption.getVariantType(), B2CConstants.APPAREL_SIZE_VARIANT_PRODUCT)) { for (VariantOption options : productOption.getOptions()) { if (options.getVariantOptionQualifiers() != null && !options.getVariantOptionQualifiers().isEmpty()) { for (VariantOptionQualifier qualifier : options.getVariantOptionQualifiers()) { if (qualifier != null) { if (StringUtils.equals(qualifier.getQualifier(), B2CConstants.VARIANT_SIZE)) { VariantOptionQualifier newOptionQualifier = new VariantOptionQualifier(); newOptionQualifier.setImage(qualifier.getImage()); newOptionQualifier.setName(qualifier.getName()); newOptionQualifier.setQualifier(qualifier.getQualifier()); newOptionQualifier.setValue(qualifier.getValue()); List<VariantOptionQualifier> newListQualifiers = new ArrayList<>(); newListQualifiers.add(newOptionQualifier); options.setVariantOptionQualifiers(newListQualifiers); } } } } } VariantOption mSelectedVariantOption = new VariantOption(); //Select the current vairant selection mSelectedVariantOption.setCode(product.getCode()); ProductHelper.populateSpinner(context, spinners.get(1), productOption.getOptions(), resetChildSpinner ? 0 : ProductHelper.findVariantPosition(productOption.getOptions(), mSelectedVariantOption)); } } } return product.getBaseOptions().size(); } else { return 0; } }
From source file:ch.cyberduck.core.b2.B2AttributesFeature.java
@Override public PathAttributes find(final Path file) throws BackgroundException { if (file.isRoot()) { return PathAttributes.EMPTY; }/* w ww . j a v a2 s .c o m*/ try { final B2FileResponse info = session.getClient() .getFileInfo(new B2FileidProvider(session).getFileid(file)); return this.toAttributes(info); } catch (B2ApiException e) { if (StringUtils.equals("file_state_none", e.getMessage())) { return PathAttributes.EMPTY; } throw new B2ExceptionMappingService(session).map("Failure to read attributes of {0}", e, file); } catch (IOException e) { throw new DefaultIOExceptionMappingService().map(e); } }
From source file:com.devicehive.service.IdentityProviderService.java
@Transactional(propagation = Propagation.REQUIRED) public IdentityProviderVO update(@NotNull String providerName, IdentityProviderVO identityProvider) { if (!StringUtils.equals(providerName, identityProvider.getName())) { throw new IllegalParametersException(String.format(Messages.IDENTITY_PROVIDER_NAME_CHANGE_NOT_ALLOWED, providerName, identityProvider.getName())); }//w ww . j a v a 2 s.c o m IdentityProviderVO existing = find(providerName); if (existing == null) { throw new IllegalParametersException(String.format(Messages.IDENTITY_PROVIDER_NOT_FOUND, providerName)); } if (identityProvider.getName() != null) { existing.setName(identityProvider.getName()); } if (identityProvider.getApiEndpoint() != null) { existing.setApiEndpoint(identityProvider.getApiEndpoint()); } hiveValidator.validate(existing); return identityProviderDao.merge(existing); }
From source file:com.callidusrobotics.droptables.configuration.LoginInfo.java
@Override public boolean equals(Object other) { if (this == other) { return true; }/* w ww. j a va2 s . com*/ if (!(other instanceof LoginInfo)) { return false; } LoginInfo otherInfo = (LoginInfo) other; return StringUtils.equals(username + " " + password, otherInfo.username + " " + otherInfo.password); }