List of usage examples for org.apache.commons.lang StringUtils equalsIgnoreCase
public static boolean equalsIgnoreCase(String str1, String str2)
Compares two Strings, returning true
if they are equal ignoring the case.
From source file:com.edgenius.wiki.search.interceptor.PageIndexInterceptor.java
public void afterReturning(Object retValue, Method method, Object[] args, Object target) throws Throwable { //PageService.savePage() Page page = null;// ww w . java 2 s . c om String spaceUname = null; String removedPageUuid = null; boolean needRebuildRss = false; if (StringUtils.equals(method.getName(), PageService.savePage)) { page = (Page) retValue; int reqireSendNotify = (Integer) args[1]; spaceUname = page.getSpace().getUnixName(); needRebuildRss = true; sendNotifyMessage(page, reqireSendNotify); } else if (StringUtils.equals(method.getName(), SpaceService.saveHomepage)) { page = (Page) args[1]; spaceUname = page.getSpace().getUnixName(); needRebuildRss = true; } else if (StringUtils.equals(method.getName(), PageService.copy)) { page = (Page) retValue; spaceUname = page.getSpace().getUnixName(); //rebuild target space RSS needRebuildRss = true; } else if (StringUtils.equals(method.getName(), PageService.removePage)) { //new page spaceUname = (String) args[0]; removedPageUuid = (String) args[1]; page = (Page) retValue; sendPageRemoveMessage(removedPageUuid, spaceUname, page); } else if (StringUtils.equals(method.getName(), PageService.restorePage)) { page = (Page) retValue; //Dirty FIX: MQ consumer can not get content correctly since lazy loading reason, initialize here. page.getContent().getContent(); spaceUname = page.getSpace().getUnixName(); needRebuildRss = true; } else if (StringUtils.equals(method.getName(), PageService.restoreHistory)) { page = (Page) retValue; //Dirty FIX: MQ consumer can not get content correctly since lazy loading reason, initialize here. page.getContent().getContent(); spaceUname = page.getSpace().getUnixName(); needRebuildRss = true; } else if (StringUtils.equals(method.getName(), PageService.move)) { //new page //also need do delete from index String fromSpaceUname = (String) args[0]; //this flag will build move target space RSS spaceUname = (String) args[2]; if (!StringUtils.equalsIgnoreCase(fromSpaceUname, spaceUname)) { page = (Page) retValue; removedPageUuid = (String) args[1]; needRebuildRss = true; //rebuild to space RSS sendPageRemoveMessage(removedPageUuid, fromSpaceUname, page); //here will remove page RSS from fromSpaceUname } else { //if move happens in same space, then we need don't refresh index and rss! //actually, even no return, all below index and rss service also skipped, here just for easy code. return; } } if (page != null && removedPageUuid == null && !page.isRemoved()) { log.info("JMS message send for Page index creating. Title: " + page.getTitle() + ". Uuid:" + page.getPageUuid()); //the come in page bring too many information, such as user permission, roles etc. //in test, the page object is almost 680k in a ~700 user system for admin user. //so, as trade-off, low the traffice in MQ, but add more database query in consumer side... IndexMQObject mqObj = new IndexMQObject(IndexMQObject.TYPE_INSERT_PAGE, page.getUid()); jmsTemplate.convertAndSend(queue, mqObj); } if (needRebuildRss) { //send RSS feed rebuild message RSSMQObject mqObj = new RSSMQObject(RSSMQObject.TYPE_REBUILD, spaceUname); jmsTemplate.convertAndSend(rssQueue, mqObj); } }
From source file:hydrograph.ui.graph.controller.CommentBoxEditPart.java
@Override public void propertyChange(PropertyChangeEvent evt) { String prop = evt.getPropertyName(); if (StringUtils.equalsIgnoreCase(prop, LABEL_CONTENTS)) { refreshVisuals();//from w w w. j a va2 s. c o m } else if (StringUtils.equalsIgnoreCase(prop, SIZE) || StringUtils.equalsIgnoreCase(prop, LOCATION)) { Point loc = getLabel().getLocation(); Dimension size = getLabel().getSize(); Rectangle r = new Rectangle(loc, size); ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), r); refreshVisuals(); } }
From source file:hydrograph.ui.propertywindow.schema.propagation.helper.SchemaPropagationHelper.java
/** * pull out basicSchemaGridRow object from Schema object. * /* ww w .j a va 2 s. c o m*/ * @param targetTerminal * @param link * @return list of BasicSchemaGridRow */ public List<BasicSchemaGridRow> getBasicSchemaGridRowList(String targetTerminal, Link link) { List<BasicSchemaGridRow> basicSchemaGridRows = null; if (StringUtils.equalsIgnoreCase(Constants.INPUT_SUBJOB_COMPONENT_NAME, link.getSource().getComponentName()) || StringUtils.equalsIgnoreCase(Constants.SUBJOB_COMPONENT, link.getSource().getComponentName())) { Map<String, Schema> inputSchemaMap = (HashMap<String, Schema>) link.getSource().getProperties() .get(Constants.SCHEMA_FOR_INPUTSUBJOBCOMPONENT); if (inputSchemaMap != null && inputSchemaMap.get(targetTerminal) != null) basicSchemaGridRows = SchemaSyncUtility.INSTANCE.convertGridRowsSchemaToBasicSchemaGridRows( inputSchemaMap.get(targetTerminal).getGridRow()); } else { Schema previousComponentSchema = SchemaPropagation.INSTANCE.getSchema(link); if (previousComponentSchema != null) basicSchemaGridRows = SchemaSyncUtility.INSTANCE .convertGridRowsSchemaToBasicSchemaGridRows(previousComponentSchema.getGridRow()); } return basicSchemaGridRows; }
From source file:edu.monash.merc.common.name.DataType.java
/** * Get a DataType by a String value//from ww w . ja v a 2 s .co m * * @param type a DataType String value * @return a DataType based on a String value. */ public static DataType fromType(String type) { if (StringUtils.isNotBlank(type)) { for (DataType dataType : DataType.values()) { if (StringUtils.equalsIgnoreCase(dataType.type(), type)) { return dataType; } } } return DataType.UNKNOWN; }
From source file:com.vsct.supervision.seyren.api.Subscription.java
/** * Tests equality, "enabled" and "id" IS NOT compared. * * @param o subscription to compare to this * @return true if o is equal to this//from ww w .ja va 2 s. com */ @Override public boolean equals(Object o) {//NOSONAR if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Subscription that = (Subscription) o; return su == that.su && mo == that.mo && tu == that.tu && we == that.we && th == that.th && fr == that.fr && sa == that.sa && ignoreWarn == that.ignoreWarn && ignoreError == that.ignoreError && ignoreOk == that.ignoreOk && ignoreUnknown == that.ignoreUnknown && StringUtils.equalsIgnoreCase(target, that.target) && type == that.type && Objects.equals(fromTime, that.fromTime) && Objects.equals(toTime, that.toTime); }
From source file:info.magnolia.cms.security.SecurityFilter.java
/** * Authenticate on basic headers.//from w w w . jav a2s. co m * @param request HttpServletRequest * @param response HttpServletResponst * @return <code>true</code> if the user is authenticated */ private boolean authenticate(HttpServletRequest request, HttpServletResponse response) { try { if (Path.getURI(request).startsWith(this.filterConfig.getInitParameter(UNSECURED_URI))) { return true; } if (!Authenticator.authenticate(request)) { // invalidate previous session HttpSession httpsession = request.getSession(false); if (httpsession != null) { httpsession.invalidate(); } response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); if (StringUtils.equalsIgnoreCase(this.filterConfig.getInitParameter(AUTH_TYPE), AUTH_TYPE_BASIC)) { response.setHeader("WWW-Authenticate", "BASIC realm=\"" + Server.getBasicRealm() + "\""); } else { request.getRequestDispatcher(this.filterConfig.getInitParameter(LOGIN_FORM)).include(request, response); } return false; } } catch (Exception e) { log.error(e.getMessage(), e); return false; } return true; }
From source file:com.sfs.whichdoctor.search.http.OnlineApplicationInputHandler.java
/** * Process the incoming HttpRequest for search parameters. * * @param request the request/*from w w w . j a v a 2 s . c om*/ * @param user the user * * @return the search bean */ public final SearchBean process(final HttpServletRequest request, final UserBean user) { SearchBean search = onlineApplicationSqlHandler.initiate(user); OnlineApplicationBean searchCriteria = (OnlineApplicationBean) search.getSearchCriteria(); OnlineApplicationBean searchConstraints = (OnlineApplicationBean) search.getSearchConstraints(); /* Process search form */ String strPersonGUID = DataFilter.getHtml(request.getParameter("personGUID")); String strApplicationKey = DataFilter.getHtml(request.getParameter("applicationKey")); String strPersonName = DataFilter.getHtml(request.getParameter("personName")); String strFirstName = DataFilter.getHtml(request.getParameter("firstName")); String strLastName = DataFilter.getHtml(request.getParameter("lastName")); String strType = DataFilter.getHtml(request.getParameter("applicationType")); String strStatus = DataFilter.getHtml(request.getParameter("applicationStatus")); String strProcessed = DataFilter.getHtml(request.getParameter("processed")); String strCreatedA = DataFilter.getHtml(request.getParameter("createdA")); String strCreatedB = DataFilter.getHtml(request.getParameter("createdB")); String strUpdatedA = DataFilter.getHtml(request.getParameter("updatedA")); String strUpdatedB = DataFilter.getHtml(request.getParameter("updatedB")); /* Set the person GUID */ if (StringUtils.isNotBlank(strPersonGUID)) { int personGUID = 0; try { personGUID = Integer.parseInt(strPersonGUID.trim()); } catch (NumberFormatException nfe) { dataLogger.debug("Error parsing person GUID: " + nfe.getMessage()); } searchCriteria.setPersonGUID(personGUID); } /* Set the application key */ if (StringUtils.isNotBlank(strApplicationKey)) { searchCriteria.setKey(strApplicationKey); } /* Set the person name */ if (StringUtils.isNotBlank(strPersonName)) { searchCriteria.setDescription(strPersonName); } /* Set the first name */ if (StringUtils.isNotBlank(strFirstName)) { searchCriteria.setFirstName(strFirstName); } /* Set the last name */ if (StringUtils.isNotBlank(strLastName)) { searchCriteria.setLastName(strLastName); } /* Set the application type */ if (StringUtils.isNotBlank(strType) && !StringUtils.equals(strType, "Null")) { searchCriteria.setType(strType); } /* Set the application status */ if (StringUtils.isNotBlank(strStatus) && !StringUtils.equals(strStatus, "Null")) { searchCriteria.setStatus(strStatus); } /* Set the processed flag */ if (StringUtils.isNotBlank(strProcessed)) { searchCriteria.setProcessed(false); searchConstraints.setProcessed(true); if (StringUtils.equalsIgnoreCase(strProcessed, "true")) { searchCriteria.setProcessed(true); searchConstraints.setProcessed(true); } if (StringUtils.equalsIgnoreCase(strProcessed, "false")) { searchCriteria.setProcessed(false); searchConstraints.setProcessed(false); } } if (StringUtils.isNotBlank(strCreatedA)) { searchCriteria.setCreatedDate(DataFilter.parseDate(strCreatedA, false)); } if (StringUtils.isNotBlank(strCreatedB)) { searchConstraints.setCreatedDate(DataFilter.parseDate(strCreatedB, false)); if (strCreatedB.compareTo("+") == 0) { /* All dates above Date A requested */ searchConstraints.setCreatedDate(getMaximumDate()); } if (strCreatedB.compareTo("-") == 0) { /* Add dates below Date A requested */ searchConstraints.setCreatedDate(getMinimumDate()); } } if (StringUtils.isNotBlank(strUpdatedA)) { searchCriteria.setModifiedDate(DataFilter.parseDate(strUpdatedA, false)); } if (StringUtils.isNotBlank(strUpdatedB)) { searchConstraints.setModifiedDate(DataFilter.parseDate(strUpdatedB, false)); if (strUpdatedB.compareTo("+") == 0) { /* All dates above Date A requested */ searchConstraints.setModifiedDate(getMaximumDate()); } if (strUpdatedB.compareTo("-") == 0) { /* Add dates below Date A requested */ searchConstraints.setModifiedDate(getMinimumDate()); } } search.setSearchCriteria(searchCriteria); search.setSearchConstraints(searchConstraints); return search; }
From source file:de.hybris.platform.accountsummaryaddon.document.dao.impl.DefaultPagedB2BDocumentDao.java
protected String getWhereStatement(final Map<String, Object> criteria) { final StringBuffer whereStatement = new StringBuffer(); whereStatement.append(documentTypeDisplayInAllListFilter(criteria)); if (criteria != null && !criteria.isEmpty()) { if (StringUtils.isBlank(whereStatement.toString())) { whereStatement.append(WHERE_STATEMENT); } else {/*from www .ja v a 2 s . c o m*/ whereStatement.append(AND_STATEMENT); } final String[] criteriaNames = criteria.keySet().toArray(new String[0]); for (int i = 0; i < criteriaNames.length; i++) { if (StringUtils.endsWith(criteriaNames[i], "_min")) { whereStatement.append(formatField(criteriaNames[i]) + " >= ?" + criteriaNames[i]); } else if (StringUtils.endsWith(criteriaNames[i], "_max")) { whereStatement.append(formatField(criteriaNames[i]) + " <= ?" + criteriaNames[i]); } else if (StringUtils.equalsIgnoreCase(B2BDocumentModel.UNIT, criteriaNames[i])) { whereStatement.append(formatField(criteriaNames[i]) + " = ?" + criteriaNames[i]); } else if (criteria.get(criteriaNames[i]) instanceof List<?>) { whereStatement.append(formatField(criteriaNames[i]) + " IN (?" + criteriaNames[i] + ")"); } else { whereStatement.append(formatField(criteriaNames[i]) + " like ?" + criteriaNames[i]); } if (i + 1 < criteriaNames.length) { whereStatement.append(AND_STATEMENT); } } } return whereStatement.toString(); }
From source file:com.sfs.whichdoctor.dao.onlineapplication.BasicTrainingOnlineApplicationHandler.java
/** * Validate the next step./*from w ww . j av a2 s . c om*/ * * @param nextStep the next step * @param xml the xml * @param recordId the record id * @return true, if successful */ public final boolean validateNextStep(final String nextStep, final Document xml, final String recordId) { boolean validStep = true; Element root = new Element("root"); if (xml.getRootElement() != null) { root = xml.getRootElement(); } if (StringUtils.equalsIgnoreCase(nextStep, "Confirm email address") && loadEmailDetails(root, 0) == null) { validStep = false; } if (StringUtils.equalsIgnoreCase(nextStep, "Confirm work phone") && loadPhoneDetails(root, "work", 0) == null) { validStep = false; } if (StringUtils.equalsIgnoreCase(nextStep, "Confirm work fax") && loadPhoneDetails(root, "workfax", 0) == null) { validStep = false; } if (StringUtils.equalsIgnoreCase(nextStep, "Confirm home phone") && loadPhoneDetails(root, "home", 0) == null) { validStep = false; } if (StringUtils.equalsIgnoreCase(nextStep, "Confirm home fax") && loadPhoneDetails(root, "homefax", 0) == null) { validStep = false; } if (StringUtils.equalsIgnoreCase(nextStep, "Confirm mobile phone") && loadPhoneDetails(root, "mobile", 0) == null) { validStep = false; } if (StringUtils.equalsIgnoreCase(nextStep, "Confirm secondary qualifications") && loadQualificationDetails(root, 0, recordId) == null) { validStep = false; } if (StringUtils.equalsIgnoreCase(nextStep, "Confirm rotation details") && loadRotationDetails(root, 0, recordId) == null) { validStep = false; } if (StringUtils.equalsIgnoreCase(nextStep, "Issue invoice") && loadDebitDetails(root, 0) == null) { validStep = false; } return validStep; }
From source file:com.canoo.webtest.plugins.pdftest.PdfVerifyFontStep.java
private IStringVerifier getVerifier() { if (getMatchCase()) return EqualsStringVerfier.INSTANCE; else {//from w ww. j ava 2 s. c o m return new IStringVerifier() { public boolean verifyStrings(final String expectedValue, final String actualValue) { return StringUtils.equalsIgnoreCase(expectedValue, actualValue); } }; } }