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:gov.nih.nci.cabig.caaers.domain.OtherIntervention.java
@Override public boolean equals(Object o) { if (o == null) return false; if (this == o) return true; if (!(o instanceof OtherIntervention)) return false; OtherIntervention that = (OtherIntervention) o; if (!this.getStudyTherapyType().equals(((StudyIntervention) o).getStudyTherapyType())) return false; if (!StringUtils.equals(getName(), that.getName())) return false; if (!StringUtils.equals(getDescription(), that.getDescription())) return false; return super.equals(that); }
From source file:com.syaku.commons.DateUtils.java
public static Date setDateString(String date) { Date retDate = null;//from ww w . j av a2s. c o m try { String sysdate_patten = "(^[A-Za-z]{3}), ([0-9]{2}) ([A-Za-z]{3}) ([0-9]{4}) ([0-9]{2}):([0-9]{2}):([0-9]{2}) ([+0-9]{5})$"; String yyyy = date.replaceAll(sysdate_patten, "$4"); String MM = date.replaceAll(sysdate_patten, "$3"); String dd = date.replaceAll(sysdate_patten, "$2"); String hh = date.replaceAll(sysdate_patten, "$5"); String mm = date.replaceAll(sysdate_patten, "$6"); String ss = date.replaceAll(sysdate_patten, "$7"); String timezone = date.replaceAll(sysdate_patten, "$8"); String[] months = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; int months_int = months.length; for (int i = 0; i < months_int; i++) { String month = months[i]; if (StringUtils.equals(MM, month)) { MM = "" + (i + 1); MM = StringUtils.leftPad(MM, 2, '0'); break; } } date = yyyy + MM + dd + hh + mm + ss; date = date("yyyy-MM-dd HH:mm:ss", date); formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); retDate = formatter.parse(date); } catch (Exception e) { log.error("[#MEI DateUtils.setDateString] " + e.toString()); } return retDate; }
From source file:com.thoughtworks.go.buildsession.UploadArtifactCommandExecutor.java
protected String destURL(File rootPath, File file, String src, String dest) { String trimmedPattern = rtrimStandardrizedWildcardTokens(src); if (StringUtils.equals(normalizePath(trimmedPattern), normalizePath(src))) { return dest; }/*ww w.j av a2s . co m*/ String trimmedPath = removeStart(subtractPath(rootPath, file), normalizePath(trimmedPattern)); if (!StringUtils.startsWith(trimmedPath, "/") && StringUtils.isNotEmpty(trimmedPath)) { trimmedPath = "/" + trimmedPath; } return dest + trimmedPath; }
From source file:cn.cuizuoli.appranking.enumeration.FeedType.java
/** * getObject//from w ww . ja va 2 s . c o m * @param code * @return */ public static FeedType getObject(String code) { for (FeedType feedType : FeedType.values()) { if (StringUtils.equals(feedType.getCode(), code)) { return feedType; } } return null; }
From source file:com.adobe.acs.commons.forms.impl.FormsRouterImpl.java
/** * Gets the Form Selector for the form POST request. * * @param slingRequest//from w w w.j a v a 2 s. c o m * @return */ @Override public final String getFormSelector(final SlingHttpServletRequest slingRequest) { final String requestSuffix = slingRequest.getRequestPathInfo().getSuffix(); if (StringUtils.equals(requestSuffix, this.getSuffix()) || !StringUtils.startsWith(requestSuffix, this.getSuffix() + "/")) { return null; } final int segments = StringUtils.split(this.getSuffix(), '/').length; if (segments < 1) { return null; } final String formSelector = PathInfoUtil.getSuffixSegment(slingRequest, segments); return StringUtils.stripToNull(formSelector); }
From source file:com.tesora.dve.sql.schema.LoadDataInfileLineOption.java
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; LoadDataInfileLineOption other = (LoadDataInfileLineOption) obj; if (!StringUtils.equals(starting, other.getStarting()) || !StringUtils.equals(terminated, other.getTerminated())) return false; return true;/*from w ww . ja va 2 s . c o m*/ }
From source file:com.sfs.whichdoctor.formatter.OutputFormatter.java
/** * Output the person bean to the person's formal name. * * @param person the person//w w w . j av a 2 s .com * * @return the string */ public static String toMemberName(final PersonBean person) { final StringBuffer name = new StringBuffer(); if (person != null) { if (StringUtils.isNotBlank(person.getTitle())) { name.append(person.getTitle().trim()); name.append(" "); } if (StringUtils.isNotBlank(person.getFirstName())) { name.append(person.getFirstName().trim()); name.append(" "); } if (StringUtils.isNotBlank(person.getMiddleName())) { name.append(person.getMiddleName().trim()); name.append(" "); } if (StringUtils.isNotBlank(person.getLastName())) { name.append(person.getLastName().trim()); } if (StringUtils.isNotBlank(person.getHonors())) { name.append(", "); name.append(person.getHonors().trim()); } final String type = person.getMembershipField("Membership Type"); if (StringUtils.equals(type, "Member: Fellow") || StringUtils.equals(type, "Member: Life Fellow")) { name.append(", FRACP"); } } return name.toString(); }
From source file:com.cyclopsgroup.waterview.ui.layout.DefaultLayout.java
/** * Overwrite or implement method execute() * * @see com.cyclopsgroup.waterview.Module#execute(com.cyclopsgroup.waterview.RuntimeData, com.cyclopsgroup.waterview.Context) *//*from www .j ava2 s .c om*/ public void execute(RuntimeData data, Context context) throws Exception { NavigatorService navigator = (NavigatorService) lookup(NavigatorService.ROLE); RuntimeTreeNode root = navigator.getRuntimeNode(data); Node[] tabNodes = root.getChildrenNodes(); context.put("tabNodes", tabNodes); context.put("navigator", navigator); context.put("currentNavigatorNode", navigator.getNodeByPage(data.getPage().getFullPath())); RuntimeTreeNode selectedNode = null; for (int i = 0; i < tabNodes.length; i++) { RuntimeTreeNode runtimeNode = (RuntimeTreeNode) tabNodes[i]; NavigatorNode node = (NavigatorNode) runtimeNode.getContent(); if (!StringUtils.equals(node.getPage(), data.getPage().getFullPath())) { NavigatorNode n = navigator.getNodeByPage(data.getPage().getFullPath()); if (n != null && !n.isParent(node.getPage())) { continue; } } selectedNode = runtimeNode; context.put("selectedNode", selectedNode); break; } /* if ( selectedNode != null ) { context.put( "navigatorRows", TreeUtils.flattenTree( selectedNode ) ); }*/ }
From source file:gov.nih.nci.cabig.caaers.domain.dto.AdverseEventDTO.java
public int match(AdverseEventDTO oae) { if (oae == null) return 0; if (isSame(oae)) return 100; int p = 0;//from w w w . j a v a 2 s . c o m if (StringUtils.equals(oae.getExternalID(), this.getExternalID())) p += 46; if (oae.term.isSame(this.term)) p = p + 20; if (StringUtils.equals(oae.startDate, this.startDate)) p = p + 16; if (StringUtils.equals(oae.endDate, this.endDate)) p = p + 2; if (StringUtils.equals(oae.grade, this.grade)) p = p + 10; if (StringUtils.equals(oae.attribution, this.attribution)) p = p + 2; if (StringUtils.equals(oae.verbatim, this.verbatim)) p = p + 2; if (StringUtils.equals(oae.whySerious, this.whySerious)) p = p + 2; return p; }
From source file:cn.vlabs.duckling.vwb.PromitionLogFilter.java
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (!(request instanceof HttpServletRequest)) { chain.doFilter(request, response); return;//from www . j a va 2s . c o m } HttpServletRequest httpRequest = (HttpServletRequest) request; String serverName = request.getServerName(); if (!StringUtils.equals(serverName, VWBContext.getContainer().getDomainService().getSiteDefaultDomain(ADMIN_SITE_ID))) { chain.doFilter(request, response); return; } HttpSession session = httpRequest.getSession(); String promotionHost = (String) session.getAttribute(PROMOTION_HOST); String requestUrl = httpRequest.getRequestURI(); if (StringUtils.equals(requestUrl, createUrl)) { logCreateJson(promotionHost, requestUrl); } if (StringUtils.isNotBlank(promotionHost)) { chain.doFilter(request, response); return; } String paramRef = request.getParameter(PARAM_REF); if (StringUtils.isNotBlank(paramRef)) { session.setAttribute(PROMOTION_HOST, paramRef); logAccessJson("", paramRef, paramRef, requestUrl); chain.doFilter(request, response); return; } String referer = httpRequest.getHeader("Referer"); String referHost = getRefererHost(referer); if (StringUtils.isNotBlank(referHost)) { session.setAttribute(PROMOTION_HOST, getRefererNameByHost(referHost)); logAccessJson(referer, referHost, getRefererNameByHost(referHost), requestUrl); chain.doFilter(request, response); } }