List of usage examples for org.apache.commons.lang StringUtils equals
public static boolean equals(String str1, String str2)
Compares two Strings, returning true
if they are equal.
From source file:me.leep.wf.services.system.impl.TestShiroRealmImpl.java
@Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { System.out.println(// w w w.j a v a2 s . c o m " , ?loaddoGetAuthorizationInfo................."); // doGetAuthenticationInfo ? ShiroUser shiroUser = (ShiroUser) principals.fromRealm(getName()).iterator().next(); String userName = shiroUser.getName(); if (StringUtils.equals("admin", userName)) { SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); //?<shiro:hasRole>name info.addRole("admin"); //? <shiro:hasPermission> name info.addStringPermission("user:edit"); return info; } else if (StringUtils.equals("test", userName)) { SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); //?<shiro:hasRole>name info.addRole("test"); //? <shiro:hasPermission> name, ?,? info.addStringPermission("user:view"); return info; } else { return null; } }
From source file:fr.paris.lutece.plugins.captcha.service.CaptchaService.java
/** * {@inheritDoc}// ww w .ja v a 2 s. co m */ @Override public boolean validate(HttpServletRequest request) { List<ICaptchaEngine> listCaptchaEngine = SpringContextService.getBeansOfType(ICaptchaEngine.class); if (listCaptchaEngine != null && listCaptchaEngine.size() > 0) { String strDefaultCaptchaEngineName = getDefaultCaptchaEngineName(); for (ICaptchaEngine captchaImpl : listCaptchaEngine) { if (StringUtils.equals(strDefaultCaptchaEngineName, captchaImpl.getCaptchaEngineName())) { return captchaImpl.validate(request); } } } // If there is no captcha implementation, we return true return true; }
From source file:fr.paris.lutece.plugins.extend.service.type.ExtendableResourceTypeService.java
/** * {@inheritDoc}/*from w ww. ja va2 s. co m*/ */ @Override public ExtendableResourceType findByPrimaryKey(String strKey, Locale locale) { List<IExtendableResourceService> listExtendableResources = SpringContextService .getBeansOfType(IExtendableResourceService.class); ExtendableResourceType resourceType = null; for (IExtendableResourceService resource : listExtendableResources) { if (StringUtils.equals(resource.getResourceType(), strKey)) { resourceType = new ExtendableResourceType(); resourceType.setKey(resource.getResourceType()); resourceType.setDescription(resource.getResourceTypeDescription(locale)); } } return resourceType; }
From source file:io.kamax.mxisd.backend.memory.MemoryIdentityStore.java
public Optional<MemoryIdentityConfig> findByUsername(String username) { return cfg.getIdentities().stream().filter(id -> StringUtils.equals(id.getUsername(), username)) .findFirst();/*from www.j a v a 2 s . c om*/ }
From source file:cn.cuizuoli.gotour.controller.WebDetailController.java
@RequestMapping("{productCode}/{categoryCode}/{id}") public ModelAndView index(@PathVariable String productCode, @PathVariable String categoryCode, @PathVariable int id) { Info product = productService.getProduct(productCode); Info category = categoryService.getCategory(categoryCode); if (StringUtils.equals(productCode, ProductType.LOCAL.getCode())) { Local detail = localRepository.selectOne(id); return new ModelAndView("web/detail").addObject("product", product).addObject("category", category) .addObject("productCode", productCode).addObject("categoryCode", categoryCode) .addObject("detail", detail).addObject("id", id); }//w ww . j a va 2 s . c o m if (StringUtils.equals(productCode, ProductType.INTERNAL.getCode())) { Internal detail = internalRepository.selectOne(id); detail.setItineraryList(itineraryRepository.selectList(id)); return new ModelAndView("web/detail").addObject("product", product).addObject("category", category) .addObject("productCode", productCode).addObject("categoryCode", categoryCode) .addObject("detail", detail).addObject("id", id); } if (StringUtils.equals(productCode, ProductType.OUTDOOR.getCode())) { Outdoor detail = outdoorRepository.selectOne(id); return new ModelAndView("web/detail").addObject("product", product).addObject("category", category) .addObject("productCode", productCode).addObject("categoryCode", categoryCode) .addObject("detail", detail).addObject("id", id); } if (StringUtils.equals(productCode, ProductType.ATTRACTIONS.getCode())) { Attractions detail = attractionsRepository.selectOne(id); return new ModelAndView("web/detail").addObject("product", product).addObject("category", category) .addObject("productCode", productCode).addObject("categoryCode", categoryCode) .addObject("detail", detail).addObject("id", id); } if (StringUtils.equals(productCode, ProductType.EXPANSION_TRAINING.getCode())) { Training detail = trainingRepository.selectOne(id); return new ModelAndView("web/detail").addObject("product", product).addObject("category", category) .addObject("productCode", productCode).addObject("categoryCode", categoryCode) .addObject("detail", detail).addObject("id", id); } return new ModelAndView("web/detail").addObject("product", product).addObject("category", category) .addObject("productCode", productCode).addObject("categoryCode", categoryCode).addObject("id", id); }
From source file:com.tesora.dve.sql.schema.LoadDataInfileColOption.java
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; LoadDataInfileColOption other = (LoadDataInfileColOption) obj; if (!StringUtils.equals(enclosed, other.getEnclosed()) || !StringUtils.equals(escaped, other.getEscaped()) || !StringUtils.equals(terminated, other.getTerminated())) return false; return true;//from w w w .j a v a2s .c om }
From source file:net.peakplatform.sonar.plugins.spring.SpringSensor.java
public boolean shouldExecuteOnProject(final Project project) { return StringUtils.equals(Spring.KEY, project.getLanguageKey()) && hasActiveRules(this.profile); }
From source file:com.ning.maven.plugins.dependencyversionscheck.strategy.APRVersionStrategy.java
protected boolean checkCompatible(final AprVersion aprVersionA, final AprVersion aprVersionB) { if (aprVersionA == null || aprVersionB == null) { LOG.debug("... no, could not parse versions."); return false; }/*from w w w . ja v a 2s. c om*/ if (aprVersionA.getMajor() != aprVersionB.getMajor()) { LOG.debug("... no, different major versions!"); return false; } if (aprVersionA.getMinor() >= aprVersionB.getMinor()) { LOG.debug("... yes, minor version is ok!"); return true; } final boolean res = StringUtils.equals(aprVersionA.getQualifier(), aprVersionB.getQualifier()); if (!res) { LOG.debug("... no, qualifiers don't match!"); } else { LOG.debug("... yes!"); } return res; }
From source file:com.bluexml.xforms.actions.ListAction.java
/** * Used when performing searches on lists. Invoked via ModelElementListUpdater. *//* w ww .j a va 2 s.com*/ @SuppressWarnings("deprecation") @Override public void submit() throws ServletException { // update list using search Document doc = (Document) node; String query = ""; String maxResults = ""; Element queryElement = doc.getDocumentElement(); NodeList childNodes = queryElement.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node child = childNodes.item(i); if (child instanceof Element) { Element element = (Element) child; if (StringUtils.equals(element.getTagName(), "query")) { query = element.getTextContent(); } if (StringUtils.equals(element.getTagName(), "maxResults")) { maxResults = element.getTextContent(); } } } requestParameters.put(MsgId.INT_ACT_PARAM_LIST_QUERY.getText(), query); requestParameters.put(MsgId.INT_ACT_PARAM_LIST_SIZE.getText(), maxResults); // retrieves elements Node list = list(); // convert to string Source xmlSource = new DOMSource(list); ByteArrayOutputStream pos = new ByteArrayOutputStream(); Result outputTarget = new StreamResult(pos); try { documentTransformer.transform(xmlSource, outputTarget); } catch (TransformerException e) { if (logger.isErrorEnabled()) { logger.error("Failed to convert the list document into a string", e); } throw new ServletException(MsgId.MSG_ERROR_DEFAULT_MSG.getText()); } ByteArrayInputStream pis = new ByteArrayInputStream(pos.toByteArray()); result.put(XFormsProcessor.SUBMISSION_RESPONSE_STREAM, pis); }
From source file:hydrograph.ui.propertywindow.widgets.filterproperty.ELTCellModifier.java
@Override public Object getValue(Object element, String property) { FilterProperties filter = (FilterProperties) element; if (StringUtils.equals(Constants.COMPONENT_NAME, property)) return filter.getPropertyname(); else if (StringUtils.equals(ELTLookupMapWizard.OPERATIONAL_INPUT_FIELD, property)) { return filter.getPropertyname(); } else if (StringUtils.equals(Messages.OUTPUT_FIELD, property) || StringUtils.equals(Messages.INNER_OPERATION_INPUT_FIELD, property) || StringUtils.equals(Messages.INNER_OPERATION_OUTPUT_FIELD, property)) return filter.getPropertyname(); return null;/*from w w w .j a v a 2 s .co m*/ }