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.sfs.whichdoctor.search.http.BulkEmailInputHandler.java
/** * Process the incoming HttpRequest for search parameters. * * @param request the request//w w w .j a va2 s. c o m * @param user the user * * @return the search bean */ public final SearchBean process(final HttpServletRequest request, final UserBean user) { SearchBean search = bulkEmailSqlHandler.initiate(user); BulkEmailBean searchCriteria = (BulkEmailBean) search.getSearchCriteria(); BulkEmailBean searchConstraints = (BulkEmailBean) search.getSearchConstraints(); /* Process search form */ String strName = DataFilter.getHtml(request.getParameter("senderName")); String strSubject = DataFilter.getHtml(request.getParameter("subject")); 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 sender name requirements */ if (StringUtils.isNotBlank(strName)) { searchCriteria.setSenderName(DataFilter.getHtml(strName.trim())); } /* Set subject requirements */ if (StringUtils.isNotBlank(strSubject)) { searchCriteria.setSubject(DataFilter.getHtml(strSubject.trim())); } if (StringUtils.isNotEmpty(strCreatedA)) { searchCriteria.setCreatedDate(DataFilter.parseDate(strCreatedA, false)); } if (StringUtils.isNotEmpty(strCreatedB)) { searchConstraints.setCreatedDate(DataFilter.parseDate(strCreatedB, false)); if (StringUtils.equals(strCreatedB, "+")) { /* All dates above Date A requested */ searchConstraints.setCreatedDate(getMaximumDate()); } if (StringUtils.equals(strCreatedB, "-")) { /* Add dates below Date A requested */ searchConstraints.setCreatedDate(getMinimumDate()); } } if (StringUtils.isNotEmpty(strUpdatedA)) { searchCriteria.setCreatedDate(DataFilter.parseDate(strUpdatedA, false)); } if (StringUtils.isNotEmpty(strUpdatedB)) { searchConstraints.setCreatedDate(DataFilter.parseDate(strUpdatedB, false)); if (StringUtils.equals(strUpdatedB, "+")) { /* All dates above Date A requested */ searchConstraints.setCreatedDate(getMaximumDate()); } if (StringUtils.equals(strUpdatedB, "-")) { /* Add dates below Date A requested */ searchConstraints.setCreatedDate(getMinimumDate()); } } search.setSearchCriteria(searchCriteria); search.setSearchConstraints(searchConstraints); return search; }
From source file:io.kamax.mxisd.controller.identity.v1.KeyController.java
@RequestMapping(value = "/pubkey/isvalid", method = GET) public String checkKeyValidity(HttpServletRequest request, @RequestParam("public_key") String pubKey) { log.info("Validating public key {}", pubKey); // TODO do in manager boolean valid = StringUtils.equals(pubKey, keyMgr.getPublicKeyBase64(keyMgr.getCurrentIndex())); return valid ? validKey : invalidKey; }
From source file:com.adobe.acs.commons.forms.impl.FormsPostSlingFilterImpl.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;// w w w.jav a2 s .c om } final SlingHttpServletRequest slingRequest = (SlingHttpServletRequest) servletRequest; final SlingHttpServletResponse slingResponse = (SlingHttpServletResponse) servletResponse; /** * Fail fast and early! * * Must be: * - HTTP POST Request * - Have Forms Sling Suffix * - At this point, 99% of includes will be passed over * - Must contain Form Resource Query Parameter */ if (!StringUtils.equals("POST", slingRequest.getMethod()) || !formHelper.hasValidSuffix(slingRequest)) { filterChain.doFilter(servletRequest, servletResponse); return; } final String formResource = this.getParameter(slingRequest, FormHelper.FORM_RESOURCE_INPUT); if (formResource == null || slingRequest.getResourceResolver().resolve(formResource) == null) { filterChain.doFilter(servletRequest, servletResponse); return; } String formSelector = formHelper.getFormSelector(slingRequest); if (formSelector == null) { formSelector = FormHelper.DEFAULT_FORM_SELECTOR; } final RequestDispatcherOptions options = new RequestDispatcherOptions(); options.setReplaceSelectors(formSelector); options.setReplaceSuffix(slingRequest.getRequestPathInfo().getSuffix()); if (log.isDebugEnabled()) { log.debug("Form Filter; Internal forward to path: {} ", formResource); log.debug("Form Filter; Internal forward w/ replace selectors: {} ", options.getReplaceSelectors()); log.debug("Form Filter; Internal forward w/ suffix: {} ", options.getReplaceSuffix()); } slingRequest.getRequestDispatcher(formResource, options).forward(slingRequest, slingResponse); }
From source file:com.activecq.experiments.activedecorator.resourcedecorators.impl.base.AbstractPrimaryTypeResourceDecorator.java
/** * Abstract Methods *// ww w . j a va 2 s .c o m */ protected boolean accepts(Resource resource, HttpServletRequest request) { if (resource == null) { return false; } for (final String resourceType : this.primaryTypes) { final ValueMap properties = resource.adaptTo(ValueMap.class); if (properties == null) { return false; } final String slingResourceType = properties.get(JcrConstants.JCR_PRIMARYTYPE, ""); if (StringUtils.equals(resourceType, slingResourceType)) { return true; } } return false; }
From source file:jp.co.acroquest.endosnipe.perfdoctor.rule.code.ConcurrentAccessRule.java
/** * EVENT?javelin.concurrent.identifier?????? * * @param element {@link JavelinLogElement} * *//*w w w . ja v a 2 s .com*/ @Override public void doJudgeElement(final JavelinLogElement element) { //??"Event"??????? List<String> baseInfo = element.getBaseInfo(); String type = baseInfo.get(JavelinLogColumnNum.ID); if (MSG_EVENT.equals(type) == false) { return; } String eventName = baseInfo.get(JavelinLogColumnNum.EVENT_NAME); String eventLevel = baseInfo.get(JavelinLogColumnNum.EVENT_LEVEL); if (StringUtils.equals(this.level, eventLevel) == false) { return; } if (EventConstants.NAME_CONCURRENT_ACCESS.equals(eventName) == false) { return; } Map<String, String> eventInfoMap = JavelinLogUtil.parseDetailInfo(element, JavelinParser.TAG_TYPE_EVENTINFO); String identifer = eventInfoMap.get(EventConstants.PARAM_CONCURRENT_IDENTIFIER); if (identifer == null || "".equals(identifer)) { return; } int count = 0; StringBuilder builder = new StringBuilder(); while (true) { String thread = eventInfoMap.get(EventConstants.PARAM_CONCURRENT_THREAD + "." + count); if (thread == null) { break; } if (count != 0) { builder.append(","); } builder.append(thread); count++; } String stackTrace = eventInfoMap.get(EventConstants.PARAM_CONCURRENT_STACKTRACE + ".0"); //identifer?????? addError(true, stackTrace, element, identifer, builder.toString()); }
From source file:au.org.intersect.dms.wn.ConnectionParams.java
@Override public boolean equals(Object obj) { if (this == obj) { return true; }/*from ww w. jav a 2 s. c om*/ if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } ConnectionParams other = (ConnectionParams) obj; return StringUtils.equals(protocol, other.protocol) && StringUtils.equals(hostname, other.hostname) && StringUtils.equals(username, other.username) && StringUtils.equals(password, other.password); }
From source file:com.vmware.appfactory.recipe.model.RecipeCommand.java
@Override public int deepCopy(AbstractRecord record) { RecipeCommand other = (RecipeCommand) record; int numChanges = 0; if (!StringUtils.equals(getCommand(), other.getCommand())) { setCommand(other.getCommand());/* ww w. j ava 2 s. c om*/ numChanges++; } if (!StringUtils.equals(getLabel(), other.getLabel())) { setLabel(other.getLabel()); numChanges++; } return numChanges; }
From source file:net.me2day.async.processor.commcast.CommcastCreatePostSender.java
@Override public void process(List<Object> targets, EventProcessContext context) throws ReprocessableException { if (targets.size() == 0) { return;/*from w ww . ja v a 2 s . co m*/ } String fireUserId = context.getEvent().getEventFireUserId(); String fireNaverUserId = userBo.getNaverIdByMe2dayUserId(fireUserId); String eventId = ""; String linkDate = ""; if (StringUtils.isEmpty(fireNaverUserId)) { LOG.info("[COMMCAST] fireUserId(" + fireUserId + ") have NO naverId."); return; } Map<String, Object> resultMap = null; LOG.info("[COMMCAST] post event received ================"); try { linkDate = CommcastUtil.getLinkDate(context.getEvent().getEventOption("registered")); } catch (Exception e) { LOG.error("[COMMCAST-comment] linkDate : " + e.getMessage()); } Post post = new Post(Integer.parseInt(context.getEvent().getEventOption("authorId")), context.getEvent().getEventOption("authorUserId"), context.getEvent().getEventOption("body"), context.getEvent().getEventOption("authorName"), context.getEvent().getEventOption("bodyWithHtml"), context.getEvent().getEventOption("tag"), context.getEvent().getEventOption("replyKey"), context.getEvent().getEventOption("closeComment"), StringUtils.equals(context.getEvent().getEventOption("hasPhoto"), "true") ? true : false, linkDate); eventId = context.getEvent().getEventOption("eventId"); // ? ? ? ?? LOG.info("[COMMCAST] ?! : " + fireNaverUserId); resultMap = sendByPutMethod(post, targets, EventTarget.POST.getCatId(), MODE_MULTIPLE, eventId); LOG.info(String.format("[COMMCAST](100 ?, " + targets.size() + ") [%s]? ? ? , ? () [%s]? ? .", post.getAuthorUserId(), targets)); LOG.info("[COMMCAST] ===================================="); if (resultMap != null && StringUtils.equals((String) resultMap.get("result"), "1")) { // TODO // LOG.info(String.format("[COMMCAST] target name : %s, sending result : %s", target, // resultMap)); } }
From source file:de.csdev.ebus.command.datatypes.ext.EBusTypeTime.java
@Override public EBusDateTime decodeInt(byte[] data) throws EBusTypeException { Calendar calendar = new GregorianCalendar(1970, 0, 1, 0, 0, 0); BigDecimal second = null;//from w w w .j a v a 2 s. c om BigDecimal minute = null; BigDecimal hour = null; if (data.length != getTypeLength()) { throw new EBusTypeException("Input byte array must have a length of %d bytes!", getTypeLength()); } if (StringUtils.equals(variant, SHORT)) { IEBusType<BigDecimal> bcdType = types.getType(EBusTypeBCD.TYPE_BCD); minute = bcdType.decode(new byte[] { data[0] }); hour = bcdType.decode(new byte[] { data[1] }); } else if (StringUtils.equals(variant, DEFAULT)) { IEBusType<BigDecimal> bcdType = types.getType(EBusTypeBCD.TYPE_BCD); second = bcdType.decode(new byte[] { data[0] }); minute = bcdType.decode(new byte[] { data[1] }); hour = bcdType.decode(new byte[] { data[2] }); } else if (StringUtils.equals(variant, HEX)) { IEBusType<BigDecimal> charType = types.getType(EBusTypeChar.TYPE_CHAR); second = charType.decode(new byte[] { data[0] }); minute = charType.decode(new byte[] { data[1] }); hour = charType.decode(new byte[] { data[2] }); } else if (StringUtils.equals(variant, HEX_SHORT)) { IEBusType<BigDecimal> charType = types.getType(EBusTypeChar.TYPE_CHAR); minute = charType.decode(new byte[] { data[0] }); hour = charType.decode(new byte[] { data[1] }); } else if (StringUtils.equals(variant, MINUTES) || StringUtils.equals(variant, MINUTES_SHORT)) { BigDecimal minutesSinceMidnight = null; if (StringUtils.equals(variant, MINUTES_SHORT)) { IEBusType<BigDecimal> type = types.getType(EBusTypeUnsignedNumber.TYPE_UNUMBER, IEBusType.LENGTH, 1); minutesSinceMidnight = type.decode(data); } else { IEBusType<BigDecimal> type = types.getType(EBusTypeUnsignedNumber.TYPE_UNUMBER, IEBusType.LENGTH, 2); minutesSinceMidnight = type.decode(data); } minutesSinceMidnight = minutesSinceMidnight.multiply(minuteMultiplier); if (minutesSinceMidnight.intValue() > 1440) { throw new EBusTypeException("Value 'minutes since midnight' to large!"); } calendar.add(Calendar.MINUTE, minutesSinceMidnight.intValue()); } if (second != null) { calendar.set(Calendar.SECOND, second.intValue()); } if (minute != null) { calendar.set(Calendar.MINUTE, minute.intValue()); } if (hour != null) { calendar.set(Calendar.HOUR_OF_DAY, hour.intValue()); } return new EBusDateTime(calendar, true, false); }
From source file:com.prowidesoftware.swift.io.parser.MxNodeContentHandler.java
public void startElement(final String uri, final String localName, final String qName, final org.xml.sax.Attributes atts) throws org.xml.sax.SAXException { if (log.isLoggable(Level.FINEST)) { log.finest("uri: " + uri + "\nlocalName: " + localName + "\nqName: " + qName + (atts == null ? "" : "\natts(" + atts.getLength() + "): ...")); }/*from ww w .j a va 2 s . co m*/ final MxNode node = new MxNode(currentNode, localName); if (atts != null) { for (int i = 0; i < atts.getLength(); i++) { node.addAttribute(atts.getLocalName(i), atts.getValue(i)); } } /* * set uri as xmlns attribute for the first node in namespace */ if (uri != null && (node.getParent() == null || !StringUtils.equals(node.getParent().getAttribute("xmlns"), uri))) { node.addAttribute("xmlns", uri); } currentNode = node; }