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.cyclopsgroup.waterview.ui.view.pub.DefaultNavigationNode.java
/** * Overwrite or implement method execute() * * @see com.cyclopsgroup.waterview.Module#execute(com.cyclopsgroup.waterview.RuntimeData, com.cyclopsgroup.waterview.Context) *//*from ww w . java2 s . c om*/ public void execute(RuntimeData data, Context context) throws Exception { RuntimeTreeNode navigationNode = null; String nodeId = data.getParameters().getString("node_id"); if (StringUtils.isNotEmpty(nodeId)) { NavigatorService nav = (NavigatorService) lookup(NavigatorService.ROLE); navigationNode = nav.getRuntimeNode(data).getNodeById(nodeId); } if (navigationNode == null) { navigationNode = (RuntimeTreeNode) context.get("navigationNode"); } if (navigationNode == null) { throw new IllegalArgumentException("No node is specified"); } context.put("navigationNode", navigationNode); String action = data.getParameters().getString("node_action"); if (StringUtils.equals("expand", action)) { navigationNode.expand(data); } else if (StringUtils.equals("collapse", action)) { navigationNode.collapse(); } }
From source file:com.dp2345.controller.admin.ProfileController.java
/** * // ww w . j a va2 s .co m */ @RequestMapping(value = "/update", method = RequestMethod.POST) public String update(String currentPassword, String password, String email, RedirectAttributes redirectAttributes) { if (!isValid(Admin.class, "email", email)) { return ERROR_VIEW; } Admin pAdmin = adminService.getCurrent(); if (StringUtils.isNotEmpty(currentPassword) && StringUtils.isNotEmpty(password)) { if (!isValid(Admin.class, "password", password)) { return ERROR_VIEW; } if (!StringUtils.equals(DigestUtils.md5Hex(currentPassword), pAdmin.getPassword())) { return ERROR_VIEW; } pAdmin.setPassword(DigestUtils.md5Hex(password)); } pAdmin.setEmail(email); adminService.update(pAdmin); addFlashMessage(redirectAttributes, SUCCESS_MESSAGE); return "redirect:edit.jhtml"; }
From source file:com.thoughtworks.go.server.web.IgnoreResolver.java
private boolean isDownloadAgentJar(HttpServletRequest request) { return StringUtils.equals(request.getRequestURI(), request.getContextPath() + "/admin/agent"); }
From source file:com.cloudera.nav.sdk.model.custom.MetaClass.java
@Override public boolean equals(Object other) { if (other != null && other instanceof MetaClass) { MetaClass o = (MetaClass) other; return StringUtils.equals(getName(), o.getName()) && StringUtils.equals(getPackageName(), o.getPackageName()); }/*ww w.j av a2s .co m*/ return false; }
From source file:at.tuwien.ifs.feature.ContentType.java
@Override public boolean equals(Object obj) { if (obj instanceof ContentType) { ContentType ct = (ContentType) obj; return StringUtils.equals(mainType, ct.mainType) && StringUtils.equals(subType, ct.subType); } else {// ww w. ja v a 2 s. c o m return false; } }
From source file:com.cyclopsgroup.waterview.ui.DefaultLayout.java
/** * Overwrite or implement method execute() * * @see com.cyclopsgroup.waterview.Module#execute(com.cyclopsgroup.waterview.RuntimeData, com.cyclopsgroup.waterview.Context) *//*from w w w . jav a 2 s . c o m*/ public void execute(RuntimeData data, Context context) throws Exception { RuntimeNavigatorNode root = RuntimeNavigatorNode.getRoot(data); TreeNode[] tabNodes = root.getChildrenNodes(); context.put("tabNodes", tabNodes); NavigatorHome navigator = (NavigatorHome) lookupComponent(NavigatorHome.ROLE); context.put("currentNavigatorNode", navigator.getNodeByPage(data.getPage().getFullPath())); RuntimeNavigatorNode selectedNode = null; for (int i = 0; i < tabNodes.length; i++) { RuntimeNavigatorNode runtimeNode = (RuntimeNavigatorNode) 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:io.kamax.mxisd.lookup.provider.DnsLookupProvider.java
private Optional<String> findIdentityServerForDomain(String domain) { if (StringUtils.equals(mxCfg.getDomain(), domain)) { log.info("We are authoritative for {}, no remote lookup", domain); return Optional.empty(); }/*from w ww . j a v a2 s . c om*/ return IdentityServerUtils.findIsUrlForDomain(domain); }
From source file:com.google.code.configprocessor.maven.MavenExpressionResolver.java
/** * Resolves the given text replacing any placeholders if necessary. * //ww w .ja va 2s. co m * @param value Value to resolve. * @param isPropertiesValue True is the value will be used in .properties files and should be escaped. * @return Resolved value with values replaced as necessary. */ public String resolve(String value, boolean isPropertiesValue) { String resolvedValue; if (replacePlaceholders) { try { Object aux = evaluator.evaluate(value); if ((aux != null) && !(aux instanceof String)) { throw new IllegalArgumentException("Expression [" + value + "] did not resolve to String"); } resolvedValue = (String) aux; if (isPropertiesValue && !StringUtils.equals(value, resolvedValue)) { resolvedValue = PropertiesUtils.escapePropertyValue(resolvedValue); } } catch (ExpressionEvaluationException e) { throw new RuntimeException("Error resolving expression [" + value + "]", e); } } else { resolvedValue = value; } return resolvedValue; }
From source file:gov.nih.nci.cabig.caaers.web.study.SitesTab.java
@Override public void postProcess(HttpServletRequest request, StudyCommand command, Errors errors) { String action = request.getParameter("_action"); Object isAjax = request.getAttribute("_isAjax"); if (isAjax != null) return;/*from w ww .j a v a 2 s . co m*/ if (StringUtils.equals(action, "removeSite")) { int index = Integer.parseInt(request.getParameter("_selected")); StudySite site = command.getStudy().getStudySites().get(index); if (site.getId() != null) { if (CollectionUtils.isNotEmpty(site.getActiveStudyInvestigators())) { errors.reject("STU_013", "The site is associated to investigators, so unable to delete"); site.setRetiredIndicator(false); } if (CollectionUtils.isNotEmpty(site.getActiveStudyPersonnel())) { errors.reject("STU_014", "The site is associated to research staffs, so unable to delete"); site.setRetiredIndicator(false); } } //remove site, if no investigator or research person is associated to site. if (!errors.hasErrors()) { command.deleteStudySiteAtIndex(index); command.setStudySiteIndex(-1); } } request.setAttribute("tabFlashMessage", messageSource.getMessage( String.format("MSG_study.%s.flash_message", this.getClass().getSimpleName()), null, Locale.getDefault())); }
From source file:com.autentia.tnt.tracking.TrackChanges.java
public EntityChange getEntityChange(String field, String oldValue, String newValue, String keyAux) { if (this.isTrackingActive()) { if (!StringUtils.equals(oldValue, newValue)) { final EntityChange change = new EntityChange(); change.setField(field);/*from w w w .j a va2 s . c o m*/ change.setOldValue(oldValue); change.setNewValue(newValue); change.setEntityName(dto.getClass().getCanonicalName()); change.setEntityId(dto.getId()); change.setUser(AuthenticationManager.getDefault().getCurrentPrincipal().getUser()); change.setInsertDate(new Date()); change.setAuxKey(StringUtils.defaultIfEmpty(keyAux, "")); return change; } } return null; }