List of usage examples for org.apache.commons.lang3 StringUtils trim
public static String trim(final String str)
Removes control characters (char <= 32) from both ends of this String, handling null by returning null .
The String is trimmed using String#trim() .
From source file:nl.imvertor.common.Configurator.java
/** * Set parameter for a particular XML configuration. * //from ww w . jav a2s. c o m * @param xmlConfig * @param group * @param name * @param value * @param replace Replace the property if already exists. * * @throws ConfiguratorException */ private void setParm(XMLConfiguration xmlConfig, String group, String name, Object value, boolean replace) throws ConfiguratorException { String gn = group + "/" + name; String svalue = (value == null) ? "" : StringUtils.trim(value.toString()); if (replace) xmlConfig.setProperty(gn, svalue); else xmlConfig.addProperty(gn, svalue); // if this is a debug parameter, set debug level if (gn.equals("cli/debug") && isTrue(svalue)) { Logger.getRootLogger().setLevel(Level.DEBUG); getRunner().debug(logger, "Debugging started."); } }
From source file:nl.imvertor.common.Configurator.java
/** * Set a file parameter. This resolves the path as a canonical file path. * File doesn't have to exist./* www.j ava2 s.com*/ * This replaces any existing file parameters. * * @param name name of the parameter * @param subpath Subpath of the file, e.g. "etc" * @param rootFile Path to the root folder for the subpath. When null, assume user folder. * @throws IOException * @throws ConfiguratorException */ private void setFileParm(XMLConfiguration xmlConfig, String type, String name, String subpath, File rootFile) throws IOException, ConfiguratorException { subpath = StringUtils.trim(subpath); if (rootFile == null) rootFile = new File(System.getProperty("user.dir")); File f = isFullPath(subpath) ? new File(subpath) : new File(rootFile, subpath); setParm(xmlConfig, type, name, f.getCanonicalPath(), true); }
From source file:nz.net.orcon.kanban.tools.DateInterpreter.java
public boolean isSimpleTodayExpression(String expressionIn) { return TODAY_DESCRIPTIOR.equalsIgnoreCase(StringUtils.trim(expressionIn)); }
From source file:nz.net.orcon.kanban.tools.NowDateConverter.java
@Override public boolean doMatches(String formula) { return NOW_DESCRIPTIOR.equalsIgnoreCase(StringUtils.trim(formula)); }
From source file:org.activiti.app.rest.editor.AbstractModelsResource.java
protected String makeValidFilterText(String filterText) { String validFilter = null;/*from ww w. j a va 2s . co m*/ if (filterText != null) { String trimmed = StringUtils.trim(filterText); if (trimmed.length() >= MIN_FILTER_LENGTH) { validFilter = "%" + trimmed.toLowerCase() + "%"; } } return validFilter; }
From source file:org.activiti.web.rest.client.JobClientResource.java
/** * GET /rest/activiti/jobs/{jobId}/exception-stracktrace -> return job stacktrace *//*ww w. java 2 s . co m*/ @RequestMapping(value = "/rest/activiti/jobs/{jobId}/stacktrace", method = RequestMethod.GET, produces = "text/plain") public String getJobStacktrace(@PathVariable String jobId) throws BadRequestException { ServerConfig serverConfig = retrieveServerConfig(EndpointType.PROCESS); try { String trace = clientService.getJobStacktrace(serverConfig, jobId); if (trace != null) { trace = StringUtils.trim(trace); } return trace; } catch (ActivitiServiceException e) { throw new BadRequestException(e.getMessage()); } }
From source file:org.adorsys.waguia.lightxls.loader.FieldToColumnComparator.java
public int compare(String argOne, String argTwo) { if (StringUtils.isBlank(argOne) || StringUtils.isBlank(argTwo)) return -1; StringUtils.trim(argOne); StringUtils.trim(argTwo);//from w ww . ja va 2s .co m if (argOne.equalsIgnoreCase(argTwo)) return 0; if (argOne.startsWith(argTwo) || argTwo.startsWith(argOne)) return 0; return -1; }
From source file:org.alfresco.po.share.admin.ActionsSet.java
/** * Checks if the menu contains a named action * /*from www. j a v a2 s . co m*/ * @param actionName the action name * @return true, if successful */ public boolean hasActionByName(String actionName) { // Iterate over the menuRows and return true if we find an item that matches the named action for (WebElement menuRow : getMenuRows()) { if (actionName.equalsIgnoreCase(StringUtils.trim(menuRow.findElement(MENU_LABEL).getText()))) { return true; } } return false; }
From source file:org.alfresco.po.share.admin.ActionsSet.java
/** * Click action by name./*from w ww . j av a2 s. c o m*/ * * @param actionName the action name */ public HtmlPage clickActionByName(String actionName) { // Iterate over the menuRows and click the control that matches the named action for (WebElement menuRow : getMenuRows()) { if (actionName.equalsIgnoreCase(StringUtils.trim(menuRow.findElement(MENU_LABEL).getText()))) { menuRow.click(); return getCurrentPage(); } } throw new PageException("Action can not be found in the dropdown, " + actionName); }
From source file:org.alfresco.po.share.admin.ActionsSet.java
/** * Click and dialog action by name.// w w w .j a va 2s . c o m * * @param actionName the action name * @param dialogButtonName the name of the dialog button to click */ public HtmlPage clickActionByNameAndDialogByButtonName(String actionName, String dialogButtonName) { // Click the action clickActionByName(actionName); // Find the dialog WebElement dialog = this.driver.findElement(DIALOG); if (PageUtils.usableElement(dialog)) { // Within the dialog find the buttons List<WebElement> dialogButtons = dialog.findElements(DIALOG_BUTTONS); // Find the dialog // Iterate over the dialogButtons and click the button that matches the named dialog button name for (WebElement button : dialogButtons) { if (dialogButtonName.equalsIgnoreCase(StringUtils.trim(button.getText()))) { button.click(); break; } } } return getCurrentPage(); }