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.activecq.samples.workflow.impl.SampleProcessWorkflow.java
/** * Work flow execute method */*from w w w. j a va 2 s . c o m*/ */ @Override public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap args) throws WorkflowException { // Get the Workflow data (the data that is being passed through for this work item) final WorkflowData workflowData = workItem.getWorkflowData(); final String type = workflowData.getPayloadType(); // Check if the payload is a path in the JCR if (!StringUtils.equals(type, "JCR_PATH")) { return; } Session session = workflowSession.getSession(); // Get the path to the JCR resource from the payload final String path = workflowData.getPayload().toString(); // Get data from a previous WF Step String previouslySetVal = getPersistedData(workItem, "set-in-previous-wf-step", "a default value"); try { // Get the node in the JCR the payload points to Node node = session.getNode(path); // Do things to the node } catch (PathNotFoundException ex) { java.util.logging.Logger.getLogger(SampleProcessWorkflow.class.getName()).log(Level.SEVERE, null, ex); } catch (RepositoryException ex) { java.util.logging.Logger.getLogger(SampleProcessWorkflow.class.getName()).log(Level.SEVERE, null, ex); } // Standard Arguments metadata String argument = args.get("PROCESS_ARGS", "default value"); // No parse "argument" as needed to extract delimited values // Custom WF inputs stored under ./metaData/argSingle and ./metadata/argMulti String singleValue = args.get("argSingle", "not set"); String[] multiValue = args.get("argMulti", new String[] { "not set" }); log.debug("Single Value: {}", singleValue); log.debug("Multi Value: {}", Arrays.toString(multiValue)); // Save data for use in a subsequent Workflow step persistData(workItem, workflowSession, "set-for-next-workflow", "whatever data you want"); throw new UnsupportedOperationException("Not supported yet."); }
From source file:com.fengduo.bee.web.controller.account.UserController.java
/** * ??//from ww w .ja v a2 s. co m * * @return */ @RequestMapping(value = "/savepwd", method = RequestMethod.POST) @ResponseBody public JsonResult savepwd(String oldPassword, String password, String confirmPwd) { password = StringUtils.trim(password); confirmPwd = StringUtils.trim(confirmPwd); oldPassword = StringUtils.trim(oldPassword); if (StringUtils.isEmpty(password) || StringUtils.isEmpty(confirmPwd) || StringUtils.isEmpty(oldPassword)) { return JsonResultUtils.error("?!"); } if (!StringUtils.equals(password, confirmPwd)) { return JsonResultUtils.error("??,?!"); } if (!StringUtils.equals(oldPassword, getCurrentUser().getPasswordDesc())) { return JsonResultUtils.error("??!"); } Long userId = getCurrentUserId(); User userById = userService.getUserById(userId); if (null == userById) { return JsonResultUtils.error(""); } userService.updateUserPwd(userId, password); // ?? SecurityUtils.getSubject().logout(); return JsonResultUtils.error("??"); }
From source file:hydrograph.ui.common.util.WorkbenchWidgetsUtils.java
/** * Returns tool-item of tool-bar//from w ww. ja va 2 s .co m * * @param toolBarId * @param toolItemId * @return * ToolItem of given id. */ public ToolItem getToolItemFromToolBarManger(String toolBarId, String toolItemId) { ToolBarContributionItem toolBarContributionItem = getToolBarMangerOrMenuManagerFromCoolBar(toolBarId); if (toolBarContributionItem != null && toolBarContributionItem.getToolBarManager() != null) { for (IContributionItem contributionItem : toolBarContributionItem.getToolBarManager().getItems()) { if (contributionItem instanceof HandledContributionItem && StringUtils.equals(toolItemId, contributionItem.getId())) { ToolItem item = (ToolItem) ((HandledContributionItem) contributionItem).getWidget(); return item; } } } return null; }
From source file:com.mozilla.bagheera.elasticsearch.NodeClient.java
public boolean indexDocument(String indexString, String documentId) { boolean success = true; try {//from w w w .ja va 2 s. c o m IndexResponse response = client.prepareIndex(indexName, typeName, documentId).setSource(indexString) .execute().actionGet(); if (!StringUtils.equals(documentId, response.getId())) { LOG.error("error indexing documentId: " + documentId); success = false; } else { if (LOG.isDebugEnabled()) { LOG.debug("successfully indexed documentId: " + documentId); } } } catch (ElasticSearchException e) { success = false; LOG.error("ElasticSearchException while indexing document: " + e.getMessage(), e); } return success; }
From source file:edu.monash.merc.wsclient.biomart.CSVProbGeneCreator.java
public ProbeGeneBean createProbeGeneBean() { ProbeGeneBean probeGeneBean = new ProbeGeneBean(); for (CSVColumn csvColumn : columns) { String columnName = csvColumn.getColumnName(); String columnValue = csvColumn.getColumnValue(); if (StringUtils.equalsIgnoreCase(columnName, ProbeConsts.ENSG_ACCESSION)) { if (StringUtils.isNotBlank(columnValue) && !StringUtils.equals("\t", columnValue)) { probeGeneBean.setEnsgAccession(columnValue); }/*from w w w .j a va2s .com*/ } else { if (StringUtils.isNotBlank(columnValue) && !StringUtils.equals("\t", columnValue)) { probeGeneBean.setProbeId(columnValue); } } } return probeGeneBean; }
From source file:hydrograph.ui.graph.schema.propagation.SchemaPropagation.java
/** * This method propagates component's schema-map to its successor components. * /*from ww w. jav a2s . c o m*/ * @param component * @param schemaMap */ public void continuousSchemaPropagation(Component component, Map<String, ComponentsOutputSchema> schemaMap) { LOGGER.debug("Initiating recursive schema propagation"); if (component != null && schemaMap != null) if (StringUtils.equals(Constants.SUBJOB_COMPONENT_CATEGORY, component.getCategory())) appplySchemaToTargetComponentsFromSchemaMap(component, schemaMap, Constants.FIXED_OUTSOCKET_ID, false); else appplySchemaToTargetComponentsFromSchemaMap(component, schemaMap, null, false); flushLinkLists(); }
From source file:com.mozilla.bagheera.dao.ElasticSearchDao.java
public boolean indexDocument(String indexString, String documentId) { boolean success = true; try {/*from ww w . ja v a2 s. c o m*/ String indexName = prefixIndexName + "_" + getIndexSalt(documentId); IndexResponse response = client.prepareIndex(indexName, typeName, documentId).setSource(indexString) .execute().actionGet(); if (!StringUtils.equals(documentId, response.getId())) { LOG.error("error indexing documentId: " + documentId); success = false; } else { if (LOG.isDebugEnabled()) { LOG.debug("successfully indexed documentId: " + documentId); } } } catch (ElasticSearchException e) { success = false; LOG.error("ElasticSearchException while indexing document: " + e.getMessage(), e); } return success; }
From source file:gemlite.core.webapp.tools.ClusterController.java
@RequestMapping(value = "", method = RequestMethod.GET) public ModelAndView index() { ModelAndView view = new ModelAndView("tools/cluster_manage"); ConfigService service = JpaContext.getService(ConfigService.class); Map<String, String> map = service.getConfig(ConfigTypes.clusterconfig.getValue()); String cluster_list = map.get(ConfigKeys.cluster_list.getValue()); String ips[] = StringUtils.split(cluster_list, ","); String cluster_primaryip = map.get(ConfigKeys.cluster_primaryip.getValue()); List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); for (String ip : ips) { Map<String, Object> obj = new HashMap<String, Object>(); obj.put("ip", ip); if (StringUtils.equals(cluster_primaryip, ip)) obj.put("isP", true); else//ww w .jav a 2 s . c o m obj.put("isP", false); list.add(obj); } view.addObject("list", list); return view; }
From source file:com.adobe.acs.commons.forms.impl.FormsRouterImpl.java
@Override public final boolean hasValidSuffix(final SlingHttpServletRequest slingRequest) { final String requestSuffix = slingRequest.getRequestPathInfo().getSuffix(); if (StringUtils.equals(requestSuffix, this.getSuffix()) || StringUtils.startsWith(requestSuffix, this.getSuffix() + "/")) { return true; }// ww w . jav a 2s . c om return false; }
From source file:com.googlecode.markuputils.MarkupBuilderUnitTest.java
@Test(dataProvider = "elements", dependsOnMethods = { "markupBuilder", "startOpenElement" }) public void endOpenElement(String element) { String expected = "<" + element + ">"; MarkupBuilder builder = new MarkupBuilder(); builder.startOpenElement(element);//from w ww. ja v a 2 s. c o m builder.endOpenElement(); String testValue = builder.toMarkup(); String msg = new StringBuilder().append("Expected: ").append(expected).append(", Found: ").append(testValue) .toString(); logger.info(msg); assert StringUtils.equals(expected, testValue) : msg; }