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:com.edgenius.wiki.render.impl.LinkReplacerFilter.java
@Override public void replace(StringBuffer buffer, MatchResult result, RenderContext context) { LinkModel link = getLinkModel(result, context.getCurrentRegion()); LinkReplacer replacer = (LinkReplacer) context.getGlobalParam(LinkReplacer.class.getName()); if (replacer.getType() == WikiConstants.AUTO_FIX_COPY_LINK) { //change spaceUname: append @spaceUname after link if (StringUtils.isBlank(link.getSpaceUname()) || StringUtils.equals(link.getSpaceUname(), replacer.getFromSpaceUname())) { buffer.append(getLink(replacer.getFromSpaceUname(), link)); return; }/*from w w w . j a v a 2s . co m*/ } else if (replacer.getType() == WikiConstants.AUTO_FIX_TITLE_CHANGE_LINK) { //change pageTitle: change old title to new one //link has not assign space, then from(content's space) must be same with the space of updated title page if (((StringUtils.isBlank(link.getSpaceUname()) && StringUtils.equalsIgnoreCase(replacer.getFromSpaceUname(), replacer.getToSpaceUname())) //if assigned space, then it must be same with the space of updated title page || StringUtils.equalsIgnoreCase(link.getSpaceUname(), replacer.getToSpaceUname())) //title must be same && StringUtils.equalsIgnoreCase(StringUtils.trim(link.getLink()), StringUtils.trim(replacer.getOldTitle()))) { link.setLink(replacer.getNewTitle()); buffer.append(getLink(null, link)); return; } } String body; //append original text if no change if (context.getCurrentRegion() != null) { body = context.getCurrentRegion().getBody(); } else { body = result.group(0); } buffer.append(body); }
From source file:com.adobe.acs.commons.httpcache.store.jcr.impl.visitor.EntryNodeByStringKeyVisitor.java
protected void entering(final Node node, int level) throws RepositoryException { super.entering(node, level); if (isCacheEntryNode(node)) { try {/* ww w.j a va 2 s . com*/ final CacheKey cacheKey = getCacheKey(node); if (StringUtils.equals(cacheKey.toString(), cacheKeyStr)) { cacheContent = new EntryNodeToCacheContentHandler(node).get(); } } catch (Exception e) { log.error("Exception occured in retrieving the cacheKey from the entryNode", e); throw new RepositoryException(e); } } }
From source file:com.github.fritaly.svngraph.RevisionPath.java
@Override public boolean equals(Object obj) { if (obj == null) { return false; }/* w ww . j a va 2s .c om*/ if (obj == this) { return true; } if (obj instanceof RevisionPath) { final RevisionPath other = (RevisionPath) obj; return (this.revision == other.revision) && StringUtils.equals(this.path, other.path); } return false; }
From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.AbstractChildrenChangeXmlSerializer.java
@Override public StringBuffer validateElement(Change change, Element eChange) { if (change == null && eChange == null) { return new StringBuffer(""); } else if ((change == null && eChange != null) || (change != null && eChange == null)) { return new StringBuffer("either change or element is null"); }//from w w w .j av a 2s . com StringBuffer errorMessageStringBuffer = super.validateElement(change, eChange); ChildrenChange childrenChange = (ChildrenChange) change; if (eChange.attributeValue(CHILD_ID) != null) { String childId = childrenChange.getChild() != null ? childrenChange.getChild().getGridId() : null; if (!StringUtils.equals(childId, eChange.attributeValue(CHILD_ID))) { errorMessageStringBuffer.append( String.format("childId is different. expected:%s , found (in imported document) :%s \n", childId, eChange.attributeValue(CHILD_ID))); } } return errorMessageStringBuffer; }
From source file:com.openlegacy.enterprise.ide.eclipse.editors.models.rpc.RpcDateFieldModel.java
@Override public boolean equals(Object obj) { if (!(obj instanceof RpcDateFieldModel) || !super.equals(obj)) { return false; }/*w ww . j a v a 2 s . com*/ RpcDateFieldModel model = (RpcDateFieldModel) obj; return StringUtils.equals(pattern, model.getPattern()); }
From source file:de.hybris.platform.b2b.punchout.services.impl.DefaultPunchOutCredentialService.java
protected B2BCustomerModel getCustomerForCredential(final Credential credential, final boolean verifySharedSecret) { B2BCustomerModel customer = null;/* w ww . j a va2 s. com*/ final String domain = credential.getDomain(); final String identity = extractIdentity(credential); final PunchOutCredentialModel credentialModel = getPunchOutCredential(domain, identity); if (credentialModel != null) { final B2BCustomerPunchOutCredentialMappingModel mappingModel = credentialModel .getB2BCustomerPunchOutCredentialMapping(); boolean authenticated = true; if (verifySharedSecret) { final String sharedSecret = extractSharedSecret(credential); authenticated = StringUtils.equals(sharedSecret, credentialModel.getSharedsecret()); } if (mappingModel != null && authenticated) { customer = mappingModel.getB2bCustomer(); } } return customer; }
From source file:net.peakplatform.sonar.plugins.spring.file.SpringSourceImporter.java
@Override public boolean shouldExecuteOnProject(Project project) { return isEnabled(project) && StringUtils.equals(Spring.KEY, project.getLanguageKey()); }
From source file:com.cloudbees.plugins.credentials.cli.BaseCredentialsCLICommand.java
protected static Domain getDomainByName(CredentialsStore store, String domain) { if (StringUtils.equals("_", domain) || StringUtils.isBlank(domain) || "(global)".equals(domain)) { return Domain.global(); } else {// w w w. ja v a 2 s . com for (Domain d : store.getDomains()) { if (domain.equals(d.getName())) { return d; } } } return null; }
From source file:com.evolveum.midpoint.prism.match.ExchangeEmailAddressesMatchingRule.java
@Override public boolean match(String a, String b) { if (a == null && b == null) { return true; }// w w w .j a va2s . c o m if (a == null || b == null) { return false; } a = a.trim(); b = b.trim(); if (a.equals(b)) { return true; } String aPrefix = getPrefix(a); String aSuffix = getSuffix(a); String bPrefix = getPrefix(b); String bSuffix = getSuffix(b); return StringUtils.equals(aPrefix, bPrefix) && StringUtils.equalsIgnoreCase(aSuffix, bSuffix); }
From source file:com.bluexml.xforms.actions.AbstractWriteAction.java
/** * Builds a redirection URL, adding or not the parameters to the given URL. Adding the * parameters is the default behavior.//w w w . j a va 2 s .c o m * * @param pSubmitURL * @param currentPage * @return the URL, with or without parameters appended */ protected String buildRedirectionUrlWithParams(String pSubmitURL, Page currentPage) { Map<String, String> initParams = currentPage.getInitParams(); String submitURL = pSubmitURL; boolean foundInParams = initParams.containsKey(MsgId.PARAM_SKIP_ADDITIONAL_INFO.getText()); boolean skipInfo = false; if (foundInParams) { skipInfo = (StringUtils.equals(initParams.get(MsgId.PARAM_SKIP_ADDITIONAL_INFO.getText()), "true")); } else { // #1656 // there may be something specified in the Xtension property of this form skipInfo = controller.getXtensionSkipAdditionalInfo(currentPage.getFormName(), currentPage.getFormType()); } if (skipInfo == false) { String separator = (submitURL.indexOf('?') == -1 ? "?" : "&"); String idStr = StringUtils.trimToEmpty(currentPage.getDataId()); submitURL += separator + "id=" + idStr; submitURL += "&" + MsgId.PARAM_LEAVING_FORM + "=" + currentPage.getFormName(); } return submitURL; }