List of usage examples for org.apache.commons.lang3 StringUtils equals
public static boolean equals(final CharSequence cs1, final CharSequence cs2)
Compares two CharSequences, returning true if they represent equal sequences of characters.
null s are handled without exceptions.
From source file:io.wcm.devops.conga.plugins.aem.util.ContentElementHandler.java
@Override public void resource(String path, Map<String, Object> properties) { if (StringUtils.equals(path, "/")) { root = new ContentElementImpl(null, properties); } else {/*from ww w . ja v a 2 s . c o m*/ if (root == null) { throw new RuntimeException("Root resource not set."); } Matcher matcher = PATH_PATTERN.matcher(path); if (!matcher.matches()) { throw new RuntimeException("Unexpected path:" + path); } String relativeParentPath = StringUtils.stripStart(matcher.group(1), "/"); String name = matcher.group(4); ContentElement parent; if (StringUtils.isEmpty(relativeParentPath)) { parent = root; } else { parent = root.getChild(relativeParentPath); } if (parent == null) { throw new RuntimeException("Parent '" + relativeParentPath + "' does not exist."); } parent.getChildren().put(name, new ContentElementImpl(name, properties)); } }
From source file:com.streamsets.pipeline.stage.origin.jdbc.cdc.SchemaAndTable.java
@Override public boolean equals(Object o) { if (o instanceof SchemaAndTable) { SchemaAndTable sat = (SchemaAndTable) o; return StringUtils.equals(sat.getSchema(), this.schema) && StringUtils.equals(sat.getTable(), this.table); }//from www .ja v a 2s. c o m return false; }
From source file:com.cognifide.qa.bb.aem.core.component.configuration.ComponentConfiguration.java
/** * @param tab Name of tab in the dialog window * @return a list of defined FieldConfigs under the provided tab * @throws IllegalArgumentException when no configuration is found *//*www.j ava 2s . c o m*/ public List<FieldConfig> getConfigurationForTab(String tab) { return data.stream().filter(t -> StringUtils.equals(t.getTabName(), tab)).findFirst() .orElseThrow(() -> new IllegalArgumentException("No configuration found for provided tab")) .getData(); }
From source file:com.google.mr4c.config.execution.ValueConfig.java
public boolean equals(Object obj) { if (this == obj) return true; if (!obj.getClass().equals(this.getClass())) return false; ValueConfig config = (ValueConfig) obj; if (!name.equals(config.name)) return false; if (!StringUtils.equals(mapTo, config.mapTo)) return false; return true;/*from ww w . j av a 2 s . c om*/ }
From source file:com.github.rvesse.airline.utils.predicates.restrictions.RequiredFromFinder.java
@Override public boolean evaluate(OptionRestriction restriction) { if (restriction instanceof RequireFromRestriction) { if (tag == null) return true; RequireFromRestriction requirement = (RequireFromRestriction) restriction; return StringUtils.equals(tag, requirement.getTag()); }//from ww w. ja v a 2 s . com return false; }
From source file:de.micromata.genome.gwiki.page.search.expr.SearchExpressionComandChilds.java
protected boolean isChildOf(GWikiContext ctx, GWikiElementInfo parent, GWikiElementInfo child) { if (StringUtils.equals(child.getParentId(), parent.getId()) == true) { return true; }//from w w w . j a va 2s . c o m if (StringUtils.isEmpty(child.getParentId()) == true) { return false; } GWikiElementInfo el = ctx.getWikiWeb().findElementInfo(child.getParentId()); if (el == null) return false; return isChildOf(ctx, parent, el); }
From source file:com.glaf.activiti.tasklistener.factory.TaskListenerFactory.java
public static void notify(String key, DelegateTask delegateTask) { String taskListenerType = "spring"; if (StringUtils.isNotEmpty(SystemProperties.getString(EXECUTION_LISTENER_FACTORY_TYPE))) { taskListenerType = SystemProperties.getString(EXECUTION_LISTENER_FACTORY_TYPE); }//from w w w .j a va 2s . c o m if (StringUtils.isNotEmpty(CustomProperties.getString(EXECUTION_LISTENER_FACTORY_TYPE))) { taskListenerType = CustomProperties.getString(EXECUTION_LISTENER_FACTORY_TYPE); } key = key.trim(); TaskListener taskListener = null; if (StringUtils.equals(taskListenerType, "spring")) { taskListener = (TaskListener) TaskListenerBeanFactory.getBean(key); if (taskListener != null) { try { taskListener.notify(delegateTask); } catch (Exception ex) { throw new RuntimeException(ex); } } } else { try { taskListener = (TaskListener) pool.borrowObject(key); if (taskListener != null) { taskListener.notify(delegateTask); } } catch (Exception ex) { throw new RuntimeException(ex); } finally { if (taskListener != null) { try { pool.returnObject(key, taskListener); } catch (Exception ex) { ex.printStackTrace(); } } } } }
From source file:com.glaf.activiti.executionlistener.factory.ExecutionListenerFactory.java
public static void notify(String key, DelegateExecution execution) { String executionListenerType = "spring"; if (StringUtils.isNotEmpty(SystemProperties.getString(EXECUTION_LISTENER_FACTORY_TYPE))) { executionListenerType = SystemProperties.getString(EXECUTION_LISTENER_FACTORY_TYPE); }/*from w w w.j a v a2s . c o m*/ if (StringUtils.isNotEmpty(CustomProperties.getString(EXECUTION_LISTENER_FACTORY_TYPE))) { executionListenerType = CustomProperties.getString(EXECUTION_LISTENER_FACTORY_TYPE); } key = key.trim(); ExecutionListener executionListener = null; if (StringUtils.equals(executionListenerType, "spring")) { executionListener = (ExecutionListener) ExecutionListenerBeanFactory.getBean(key); if (executionListener != null) { try { executionListener.notify(execution); } catch (Exception ex) { throw new RuntimeException(ex); } } } else { try { executionListener = (ExecutionListener) pool.borrowObject(key); if (executionListener != null) { executionListener.notify(execution); } } catch (Exception ex) { throw new RuntimeException(ex); } finally { if (executionListener != null) { try { pool.returnObject(key, executionListener); } catch (Exception ex) { if (LogUtils.isDebug()) { ex.printStackTrace(); } } } } } }
From source file:de.micromata.genome.tpsb.httpmockup.HttpClientRequestAcceptor.java
private HttpPost buildMethod(MockHttpServletRequest request) { HttpPost ret;//from w w w. j a va2 s.c o m if (StringUtils.equals(request.getMethod(), "POST") == true) { HttpPost pm = new HttpPost(baseUrl + request.getPathInfo()); pm.setEntity(new ByteArrayEntity(request.getRequestData())); ret = pm; } else { throw new UnsupportedOperationException("Currently only POST methods are supported"); } return ret; }
From source file:com.opensearchserver.client.ServerResource.java
@XmlTransient @JsonIgnore/*from ww w . ja v a2s .c o m*/ /** * Server resources are the same if both the URL and the name match. * Null are never identical. * * @param serverResouce1 * @param serverResource2 * @return if the server resources are identical */ public static boolean sameResource(ServerResource serverResource1, ServerResource serverResource2) { if (serverResource1 == null || serverResource2 == null) return false; if (!StringUtils.equals(serverResource1.url, serverResource2.url)) return false; return StringUtils.equals(serverResource1.name, serverResource2.name); }