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.resolver.RemoteStudyResolverTest.java
public void testPopulateIND_NIH_NCI_CoppaResponse() throws Exception { String xml = IOUtils.toString(getClass().getResourceAsStream("indide_with_nci_nih_coppa_response.xml")); EasyMock.expect(messageBroadcastService.broadcastCOPPA((List<String>) EasyMock.anyObject(), (Metadata) EasyMock.anyObject())).andReturn(xml); replayMocks();/*from w w w . java2 s . c o m*/ RemoteStudy remoteStudy = new RemoteStudy(); studyResolver.populateIND(studyProtocol, remoteStudy); assertNotNull(remoteStudy.getInvestigationalNewDrugList()); assertEquals(2, remoteStudy.getInvestigationalNewDrugList().size()); assertTrue( remoteStudy.getInvestigationalNewDrugList().get(0).getINDHolder() instanceof OrganizationHeldIND); assertTrue( remoteStudy.getInvestigationalNewDrugList().get(1).getINDHolder() instanceof OrganizationHeldIND); assertTrue(!StringUtils .equals(((OrganizationHeldIND) remoteStudy.getInvestigationalNewDrugList().get(0).getINDHolder()) .getOrganization().getNciInstituteCode(), "DUMMY")); assertTrue(!StringUtils .equals(((OrganizationHeldIND) remoteStudy.getInvestigationalNewDrugList().get(1).getINDHolder()) .getOrganization().getNciInstituteCode(), "DUMMY")); assertEquals(new Integer("46211"), remoteStudy.getInvestigationalNewDrugList().get(0).getIndNumber()); assertEquals(new Integer("98765"), remoteStudy.getInvestigationalNewDrugList().get(1).getIndNumber()); verifyMocks(); }
From source file:com.atlassian.jira.imports.project.parser.AttachmentParserImpl.java
public boolean isUsingOriginalKeyPath(final ExternalProject project) { return StringUtils.isNotEmpty(project.getOriginalKey()) && !StringUtils.equals(project.getKey(), project.getOriginalKey()); }
From source file:com.zb.app.external.wechat.service.WeiXinResponseHandler.java
/** * ????? ???/*from ww w. j a v a2 s . c om*/ * * @param signature ?? * @param timestamp * @param nonce ? * @return */ public boolean validateSignature(String signature, String timestamp, String nonce) { String[] authStrs = new String[] { weixinConfig.getToken(), timestamp, nonce }; Arrays.sort(authStrs); String validateSignature = DigestUtils.shaHex(StringUtils.join(authStrs, "")); return StringUtils.equals(signature, validateSignature); }
From source file:gov.nih.nci.cabig.caaers.web.ae.RoutingAndReviewResolverController.java
private ModelAndView handleReportingPeriodRequest(HttpServletRequest request, HttpServletResponse response, String reportingPeriodId) { AdverseEventReportingPeriod reportingPeriod = adverseEventReportingPeriodDao .getById(Integer.parseInt(reportingPeriodId)); Integer studyId = reportingPeriod.getStudy().getId(); Integer participantId = reportingPeriod.getParticipant().getId(); String redirectUrl = ""; // Check if the course is active. // If the course is inactive (isRetired) then the user will be directed to the routing and review page. if (reportingPeriod.isRetired()) { redirectUrl = "routingAndReview?study=" + studyId + "&participant=" + participantId + "&retiredReportingPeriod=true&paginationAction=firstPage&numberOfResultsPerPage=15"; } else {/*from w w w . j a va 2s .com*/ boolean fromRoutingAndReview = StringUtils.equals(request.getParameter("src"), "RoutingReview"); if (fromRoutingAndReview && SecurityUtils.checkAuthorization(UserGroupType.ae_study_data_reviewer) && reportingPeriod.getReviewStatus() == ReviewStatus.DATA_COORDINATOR_REVIEW) { redirectUrl = "reconcileAe?rpId=" + reportingPeriod.getId(); AdverseEventReconciliationController.clearCommandObject(request); } else { redirectUrl = "captureRoutine?adverseEventReportingPeriod=" + reportingPeriodId + "&study=" + studyId + "&participant=" + participantId + "&_page=0&_target1=1&displayReportingPeriod=true&addReportingPeriodBinder=true"; // Only ae_reporter will be taken to the edit flow of adverse events ie the url mentioned above. For all other roles, the user will be redirected to the read-only page. if (!SecurityUtils.checkAuthorization(UserGroupType.ae_reporter)) { redirectUrl = "reviewEvaluationPeriod?adverseEventReportingPeriod=" + reportingPeriodId; } } } ModelAndView mv = new ModelAndView(new RedirectView(redirectUrl)); return mv; }
From source file:com.adobe.acs.commons.workflow.bulk.execution.impl.ConfigResourceVisitor.java
@Override protected void visit(final Resource resource) { final ValueMap properties = resource.adaptTo(ValueMap.class); // Ensure jcr:primaryType = cq:PageContent and // that the sling:resourceType is that of Bulk Workflow Manager Page if (NT_PAGE_CONTENT.equals(properties.get(JcrConstants.JCR_PRIMARYTYPE, String.class)) && StringUtils.equals(BulkWorkflowEngine.SLING_RESOURCE_TYPE, properties.get(JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY, String.class))) { this.configurations.add(resource); }//from w w w. j av a 2 s. c o m }
From source file:com.glaf.core.db.DataServiceBean.java
/** * ????/*from ww w. jav a2 s .c om*/ * * @param sysData * ? * @param loginContext * * @param ipAddress * IP? */ public void checkPermission(SysData sysData, LoginContext loginContext, String ipAddress) { boolean hasPermission = false; /** * ?????? */ if (!StringUtils.equals(sysData.getAccessType(), "PUB")) { /** * IP??? */ if (StringUtils.isNotEmpty(sysData.getAddressPerms())) { List<String> addressList = StringTools.split(sysData.getAddressPerms()); for (String addr : addressList) { if (StringUtils.equals(ipAddress, addr)) { hasPermission = true; } if (StringUtils.equals(ipAddress, "127.0.0.1")) { hasPermission = true; } if (StringUtils.equals(ipAddress, "localhost")) { hasPermission = true; } if (addr.endsWith("*")) { String tmp = addr.substring(0, addr.indexOf("*")); if (StringUtils.contains(ipAddress, tmp)) { hasPermission = true; } } } if (!hasPermission) { throw new RuntimeException("Permission denied."); } } /** * ??? */ if (StringUtils.isNotEmpty(sysData.getPerms()) && !StringUtils.equalsIgnoreCase(sysData.getPerms(), "anyone")) { if (loginContext.hasSystemPermission() || loginContext.hasAdvancedPermission()) { hasPermission = true; } List<String> permissions = StringTools.split(sysData.getPerms()); for (String perm : permissions) { if (loginContext.getPermissions().contains(perm)) { hasPermission = true; } if (loginContext.getRoles().contains(perm)) { hasPermission = true; } if (StringUtils.isNotEmpty(perm) && StringUtils.isNumeric(perm)) { if (loginContext.getRoleIds().contains(Long.parseLong(perm))) { hasPermission = true; } } } if (!hasPermission) { throw new RuntimeException("Permission denied."); } } } }
From source file:com.activecq.experiments.activedecorator.resourcedecorators.impl.base.AbstractResourceTypeResourceDecorator.java
/** * Abstract Methods */*from w w w . j ava2 s. c o m*/ */ protected boolean accepts(Resource resource, HttpServletRequest request) { if (resource == null) { return false; } for (final String resourceType : this.resourceTypes) { final ValueMap properties = resource.adaptTo(ValueMap.class); if (properties == null) { return false; } final String slingResourceType = properties.get(JcrResourceConstants.SLING_RESOURCE_TYPE_PROPERTY, ""); if (StringUtils.equals(resourceType, slingResourceType)) { return true; } } return false; }
From source file:com.glaf.core.web.resource.WebResource.java
public static void removeFile(String file) { Iterator<String> iterator = concurrentMap.keySet().iterator(); while (iterator.hasNext()) { String key = iterator.next(); if (StringUtils.equals(key, file)) { if (conf.getBoolean(DISTRIBUTED_ENABLED, false)) { ResourceFactory.remove(getWebResourceRegin(), key); } else { concurrentMap.remove(key); }//w w w. j a v a2s . c o m countConcurrentMap.remove(key); } } }
From source file:com.iyonger.apm.web.controller.AgentManagerController.java
/** * Get the agents.//from ww w. ja v a 2 s. com * * @param region the region to search. If null, it returns all the attached * agents. * @param model model * @return agent/list */ @RequestMapping({ "", "/", "/list" }) public String getAll(@RequestParam(value = "region", required = false) final String region, ModelMap model) { List<GrinderAgentInfo> agents = agentManagerService.getAllVisible(); model.addAttribute("agents", Collections2.filter(agents, new Predicate<GrinderAgentInfo>() { @Override public boolean apply(GrinderAgentInfo grinderAgentInfo) { final String eachAgentRegion = grinderAgentInfo.getRegion(); //noinspection SimplifiableIfStatement if (StringUtils.equals(region, "all") || StringUtils.isEmpty(region)) { return true; } return eachAgentRegion.startsWith(region + "_owned") || region.equals(eachAgentRegion); } })); model.addAttribute("region", region); model.addAttribute("regions", regionService.getAllVisibleRegionNames()); File agentPackage = null; if (isClustered()) { if (StringUtils.isNotBlank(region)) { final RegionInfo regionInfo = regionService.getOne(region); agentPackage = agentPackageService.createAgentPackage(region, regionInfo.getIp(), regionInfo.getControllerPort(), null); } } else { agentPackage = agentPackageService.createAgentPackage("", "", getConfig().getControllerPort(), null); } if (agentPackage != null) { model.addAttribute("downloadLink", "/agent/download/" + agentPackage.getName()); } return "agent/list"; }
From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.PropertyChangeXmlSerializer.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"); }/*w ww.ja va 2s . c om*/ StringBuffer errorMessageStringBuffer = super.validateElement(change, eChange); String expectedPropertyName = ((PropertyChange) change).getPropertyName(); String oldValue = ((PropertyChange) change).getOldValue(); String newValue = ((PropertyChange) change).getNewValue(); if (oldValue == null) { oldValue = ""; } if (newValue == null) { newValue = ""; } if (!StringUtils.equals(expectedPropertyName, eChange.attributeValue(PROPERTY_NAME))) { errorMessageStringBuffer.append( String.format("property name is different. expected:%s , found (in imported document) :%s \n", expectedPropertyName, eChange.attributeValue(PROPERTY_NAME))); } else if (!StringUtils.equals(oldValue, eChange.attributeValue(OLD_VALUE))) { errorMessageStringBuffer.append( String.format("old value is different. expected:%s , found (in imported document) :%s \n", oldValue, eChange.attributeValue(OLD_VALUE))); } else if (!StringUtils.equals(newValue, eChange.attributeValue(NEW_VALUE))) { errorMessageStringBuffer.append( String.format("new value is different. expected:%s , found (in imported document) :%s \n", newValue, eChange.attributeValue(NEW_VALUE))); } return errorMessageStringBuffer; }