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:info.magnolia.module.delta.SetPropertyTask.java
/** * {@inheritDoc}// ww w .j a v a2 s .c o m */ @Override protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException { HierarchyManager hm = installContext.getHierarchyManager(workspaceName); Content node = hm.getContent(nodePath); NodeData property = NodeDataUtil.getOrCreate(node, propertyName); String actualValue = property.getString(); if (!StringUtils.equals(newValue, StringUtils.trim(actualValue))) { property.setValue(newValue); } }
From source file:gov.nih.nci.cabig.caaers.domain.LabCategory.java
public List<LabTerm> findAllMatchingTerms(String term) { List<LabTerm> matchingTerms = new ArrayList<LabTerm>(); if (!CollectionUtils.isEmpty(getTerms())) { for (LabTerm t : getTerms()) { if (t.isRetired()) continue; if (StringUtils.equals(term, t.getTerm())) matchingTerms.add(t);/* w ww .j a v a2s. c o m*/ } } return matchingTerms; }
From source file:com.adobe.acs.commons.forms.impl.FormsPostRedirectGetSlingFilterImpl.java
@Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { if (!(servletRequest instanceof SlingHttpServletRequest) || !(servletResponse instanceof SlingHttpServletResponse)) { filterChain.doFilter(servletRequest, servletResponse); return;/*from ww w . java2 s. co m*/ } final SlingHttpServletRequest slingRequest = (SlingHttpServletRequest) servletRequest; final SlingHttpServletResponse slingResponse = (SlingHttpServletResponse) servletResponse; /** * Fail fast and early! * * Must be: * - HTTP GET Request * - Have Forms Sling Suffix * - At this point, 99% of includes will be passed over * - Must contain Form Selector Query Parameter * - Include is not a product of a previous forward by this Filter */ if (!StringUtils.equals("GET", slingRequest.getMethod()) || !formHelper.hasValidSuffix(slingRequest)) { filterChain.doFilter(servletRequest, servletResponse); return; } /* Ensure there is a valid form selector as part of Query Params */ final String formSelector = formHelper.getFormSelector(slingRequest); //this.getParameter(slingRequest, PostRedirectGetFormHelper.QUERY_PARAM_FORM_SELECTOR); if (formSelector == null) { filterChain.doFilter(servletRequest, servletResponse); return; } /* Ensure this is not a product of a previous forward; This is to be absolutely sure we are not hitting an * infinite loop condition */ if (slingRequest.getAttribute(REQUEST_ATTR_PREVIOUSLY_PROCESSED) != null) { filterChain.doFilter(servletRequest, servletResponse); return; } final RequestDispatcherOptions options = new RequestDispatcherOptions(); options.setReplaceSelectors(formSelector); options.setReplaceSuffix(slingRequest.getRequestPathInfo().getSuffix()); if (log.isDebugEnabled()) { log.debug("Post-Redirect-Get Form Filter; Internal forward to resource: {} ", slingRequest.getResource()); log.debug("Post-Redirect-Get Form Filter; Internal forward to path: {} ", slingRequest.getResource().getPath()); log.debug("Post-Redirect-Get Filter; Internal forward w/ replace selectors: {} ", options.getReplaceSelectors()); log.debug("Post-Redirect-Get Filter; Internal forward w/ suffix: {} ", options.getReplaceSuffix()); } // Avoid accidental infinite loops with API consumers doing their own Fws and Includes slingRequest.setAttribute(REQUEST_ATTR_PREVIOUSLY_PROCESSED, Boolean.TRUE); slingRequest.getRequestDispatcher(slingRequest.getResource(), options).forward(slingRequest, slingResponse); }
From source file:com.l1j5.web.common.utils.ImageUtils.java
public static void createThumbnail(BufferedInputStream stream_file, String save, String type, int w) { try {//www .ja va2 s .com if (StringUtils.equals(StringUtils.lowerCase(type), "gif")) { getGifImageThumbnail(stream_file, save, type, w); } else { getImageThumbnail(stream_file, save, type, w); } } catch (Exception e) { log.error(e); } }
From source file:com.microsoft.alm.plugin.idea.tfvc.ui.workspace.WorkspaceModel.java
public void setName(final String name) { if (!StringUtils.equals(this.name, name)) { this.name = name; super.setChangedAndNotify(PROP_NAME); }//from w ww.j ava2s . c om }
From source file:com.vangent.hieos.services.xds.bridge.activity.DocumentIdValidationActivity.java
/** * Method description// w ww . j ava 2s. co m * * * @param context * * @return */ @Override public boolean execute(SDRActivityContext context) { boolean result = false; Document doc = context.getDocument(); if (doc.isGeneratedDocumentId()) { // if we generated the id, nothing to check result = true; } else if (StringUtils.equals(doc.getDocumentIdAsOID(), doc.getReplaceIdAsOID())) { // error condition String errmsg = String.format( "Document Id (OID) %s equals Replace Id (OID) %s. These IDs can not be the same.", doc.getDocumentIdAsOID(), doc.getReplaceIdAsOID()); SubmitDocumentResponse sdrResponse = context.getSubmitDocumentResponse(); logger.error(errmsg); sdrResponse.addResponse(doc, ResponseTypeStatus.Failure, errmsg); } else { GetDocumentsSQResponseMessage getDocsResp = callGetDocumentsSQ(context, doc.getDocumentIdAsOID()); if (getDocsResp != null) { result = checkForSuccess(getDocsResp, context); } } return result; }
From source file:com.adobe.acs.commons.users.impl.ServiceUser.java
public boolean hasAceAt(String path) { for (Ace ace : getAces()) { if (StringUtils.equals(path, ace.getContentPath())) { return true; }/*from w ww.j a v a2 s .c om*/ } return false; }
From source file:com.btobits.automator.fix.comparator.HeaderComparator.java
protected boolean compareFiled(final FixMessageType.Field f, final FixMessageType.Field modelField) { if (modelField.isValueRegGxp()) { return new RE(modelField.getValue()).match(f.getValue()); } else {//ww w.j a v a 2 s . co m return StringUtils.equals(f.getValue(), modelField.getValue()); } }
From source file:com.pedra.storefront.forms.validation.RegistrationValidator.java
@Override public void validate(final Object object, final Errors errors) { final RegisterForm registerForm = (RegisterForm) object; final String titleCode = registerForm.getTitleCode(); final String firstName = registerForm.getFirstName(); final String lastName = registerForm.getLastName(); final String email = registerForm.getEmail(); final String pwd = registerForm.getPwd(); final String checkPwd = registerForm.getCheckPwd(); if (StringUtils.isEmpty(titleCode)) { errors.rejectValue("titleCode", "register.title.invalid"); } else if (StringUtils.length(titleCode) > 255) { errors.rejectValue("titleCode", "register.title.invalid"); }/* ww w . j a v a 2 s . c om*/ if (StringUtils.isEmpty(firstName)) { errors.rejectValue("firstName", "register.firstName.invalid"); } else if (StringUtils.length(firstName) > 255) { errors.rejectValue("firstName", "register.firstName.invalid"); } if (StringUtils.isEmpty(lastName)) { errors.rejectValue("lastName", "register.lastName.invalid"); } else if (StringUtils.length(lastName) > 255) { errors.rejectValue("lastName", "register.lastName.invalid"); } if (StringUtils.length(firstName) + StringUtils.length(lastName) > 255) { errors.rejectValue("lastName", "register.name.invalid"); errors.rejectValue("firstName", "register.name.invalid"); } if (StringUtils.isEmpty(email)) { errors.rejectValue("email", "register.email.invalid"); } else if (StringUtils.length(email) > 255 || !validateEmailAddress(email)) { errors.rejectValue("email", "register.email.invalid"); } if (StringUtils.isEmpty(pwd)) { errors.rejectValue("pwd", "register.pwd.invalid"); } else if (StringUtils.length(pwd) < 6 || StringUtils.length(pwd) > 255) { errors.rejectValue("pwd", "register.pwd.invalid"); } if (StringUtils.isNotEmpty(pwd) && StringUtils.isNotEmpty(checkPwd) && !StringUtils.equals(pwd, checkPwd)) { errors.rejectValue("checkPwd", "validation.checkPwd.equals"); } else { if (StringUtils.isEmpty(checkPwd)) { errors.rejectValue("checkPwd", "register.checkPwd.invalid"); } } }
From source file:AIR.Common.Web.Session.CaseInsensitiveFileNameFilter.java
@Override public void doFilter(ServletRequest wrappedRequest, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) wrappedRequest; String servletPath = request.getServletPath(); String requestedPath = servletPath; boolean remapped = false; boolean needsSeparateRequestDispatcher = false; // first do extensions mapping. this way if we need to take care of casing // we will do that in the later step. _Ref<String> extensionMappedString = new _Ref<String>(); if (getExtensionRemap(servletPath, extensionMappedString)) { servletPath = extensionMappedString.get(); remapped = needsSeparateRequestDispatcher = true; }/*w ww. j a va2s . c o m*/ String remappedServletPath = servletPath; // now we can do case insensitive path name mapping. if (_pathMap.containsKey(servletPath)) { remappedServletPath = _pathMap.get(servletPath); remapped = true; } else if (isMatchForRewriting(servletPath)) { remappedServletPath = remapUri(servletPath); if (!StringUtils.equals(remappedServletPath, servletPath)) { _pathMap.put(servletPath, remappedServletPath); remapped = true; } } if (remapped) { final String remappedServletPathFinal = remappedServletPath; HttpServletRequestWrapper modifiedHttpRequest = new HttpServletRequestWrapper(request) { @Override public String getServletPath() { return remappedServletPathFinal; } @Override public String getRequestURI() { return Path.combine(Server.getContextPath(), remappedServletPathFinal, "/"); } }; request = modifiedHttpRequest; if (needsSeparateRequestDispatcher) { // Sajib/Shiva: This is the only way to handle aspx to xhtml // transformations where // the xhtml is a real JSF page but this may be expensive as we may // already have gone // down other filtering chains. We are doing this as a last resort. _logger.warn(String.format( "Redispatching as there was an extension transformation. Original URI %s. New URI %s", requestedPath, remappedServletPath)); request.getRequestDispatcher(request.getRequestURI()).forward(request, response); } } chain.doFilter(request, response); }