List of usage examples for org.apache.commons.lang StringUtils isNotEmpty
public static boolean isNotEmpty(String str)
Checks if a String is not empty ("") and not null.
From source file:com.acube.security.service.UserServiceImpl.java
@Override public void addUser(User user) { if (StringUtils.isNotEmpty(user.getIpAddress())) { userRepository.usedIpAddress(user); } userRepository.addUser(user); }
From source file:com.liusoft.util.hsqldb.HSQLEngineServlet.java
/** * HSQLDB??/*w ww . j av a 2 s . c om*/ */ public void init() throws ServletException { String tPath = getInitParameter("path"); if (StringUtils.isNotEmpty(tPath)) path = tPath; String tDatabase = getInitParameter("database"); if (StringUtils.isNotEmpty(tDatabase)) database = tDatabase; String tPort = getInitParameter("port"); if (StringUtils.isNumeric(tPort)) { int nPort = Integer.parseInt(tPort); if (nPort > 1024 && nPort < 65536) port = nPort; } String dataPath; if (path.startsWith("/")) dataPath = getServletContext().getRealPath(path); else dataPath = path; //? engine = HSQLEngine.getEngine(dataPath, port, database); engine.start(); while (!engine.isRunning()) { try { Thread.sleep(200); } catch (Exception e) { } } log("HSQLEngine of DLOG4J started."); }
From source file:com.cognifide.cq.cache.plugins.statistics.action.ShowKeysAction.java
@Override public void exectue() { String cacheName = request.getParameter(Statistics.CACHE_NAME_PARAMETER); if (StringUtils.isNotEmpty(cacheName)) { logger.info("Keys from {} cache will be collected", cacheName); try {//from w w w . java 2 s. c om readKeysFrom(cacheName); } catch (IOException x) { logger.error("Error while generating markup.", x); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); } } else { logger.error("Request does not contain [cacheName] parameter."); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); } }
From source file:AWSClientFactory.java
public AWSClientFactory(String proxyHost, String proxyPort, String awsAccessKey, String awsSecretKey, String region) throws InvalidInputException { // Priority is IAM credential > Credentials provided by the default AWS credentials provider if (StringUtils.isNotEmpty(awsAccessKey) && StringUtils.isNotEmpty(awsSecretKey)) { defaultCredentialsUsed = false;/*from ww w. j a va 2s .c o m*/ awsCredentialsProvider = new AWSStaticCredentialsProvider( new BasicAWSCredentials(awsAccessKey, awsSecretKey)); } else { defaultCredentialsUsed = true; awsCredentialsProvider = DefaultAWSCredentialsProviderChain.getInstance(); // validate if credentials can be loaded from any provider try { awsCredentialsProvider.getCredentials(); } catch (SdkClientException e) { throw new InvalidInputException(Validation.invalidKeysError); } } Validation.checkAWSClientFactoryRegionConfig(region); this.region = region; clientConfig = new ClientConfiguration(); clientConfig.setUserAgentPrefix("CodeBuild-Jenkins-Plugin"); //tags all calls made from Jenkins plugin. Validation.checkAWSClientFactoryProxyConfig(proxyHost, proxyPort); clientConfig.setProxyHost(proxyHost); if (Validation.parseInt(proxyPort) != null) { clientConfig.setProxyPort(Validation.parseInt(proxyPort)); } }
From source file:com.googlecode.jtiger.modules.ecside.table.cell.RadioBoxHeaderCell.java
public String getHtmlDisplay(TableModel model, Column column) { HtmlBuilder html = new HtmlBuilder(); //String tableId = model.getTable().getTableId(); //String selectableControlName = column.getAlias(); html.td(2).valign("middle").append(" columnName=\"").append(column.getAlias()).append("\" "); if ("true".equalsIgnoreCase(column.getGroup())) { html.append(" group=\"true\" "); }/* www. ja v a 2s . c om*/ if (StringUtils.isNotEmpty(column.getWidth())) { html.width(column.getWidth()); } String headerClass = column.getHeaderClass(); StringBuffer styleClass = new StringBuffer(); if (StringUtils.isNotEmpty(headerClass)) { styleClass.append(headerClass); } if (StringUtils.isNotEmpty(column.getHeaderStyleClass())) { styleClass.append(" ").append(column.getHeaderStyleClass()); } html.styleClass(styleClass.toString().trim()); if (StringUtils.isNotEmpty(column.getHeaderStyle())) { html.style(column.getHeaderStyle()); } html.onmouseover( ECSideConstants.UTIL_FUNCTION_NAME + ".lightHeader(this,'" + model.getTable().getTableId() + "');"); html.onmouseout(ECSideConstants.UTIL_FUNCTION_NAME + ".unlightHeader(this,'" + model.getTable().getTableId() + "');"); html.close(); //String tid = model.getTable().getTableId(); html.span(); String cstyle = "columnSeparator"; html.styleClass(cstyle); html.close().append(" "); html.spanEnd(); html.div().styleClass("headerTitle").close(); // String value = column.getValueAsString(); String value = ""; String radioBoxName = column.getAlias(); //if (StringUtils.isNotBlank(value)) { html.input("radio").name(radioBoxName).value(value); html.title(""); if (column.getStyleClass() != null) { html.styleClass(column.getStyleClass()); } else { html.styleClass("radio"); } html.xclose(); //} html.divEnd(); html.tdEnd(); return html.toString(); }
From source file:jp.co.opentone.bsol.framework.web.view.util.MessageTable.java
/** * 1???./* www. j ava 2 s . c o m*/ * @param key * @param message ? */ public void addMessage(String key, Message message) { if (StringUtils.isNotEmpty(key) && null != message) { List<Message> messageList = messageTable.get(key); if (null == messageList) { messageList = new ArrayList<Message>(); } messageList.add(message); messageTable.put(key, messageList); lastAddMessageKey = key; } }
From source file:com.haulmont.cuba.gui.xml.layout.loaders.CurrencyFieldLoader.java
protected void loadCurrencyLabelPosition(CurrencyField resultComponent, Element element) { String currencyLabelPosition = element.attributeValue("currencyLabelPosition"); if (StringUtils.isNotEmpty(currencyLabelPosition)) { resultComponent//from w w w .j a va2 s .com .setCurrencyLabelPosition(CurrencyField.CurrencyLabelPosition.valueOf(currencyLabelPosition)); } }
From source file:info.magnolia.cms.taglibs.util.ConvertNewLineTag.java
/** * @see javax.servlet.jsp.tagext.Tag#doEndTag() *///ww w .ja va 2 s . co m public int doEndTag() throws JspException { String bodyText = bodyContent.getString(); if (StringUtils.isNotEmpty(bodyText)) { StringTokenizer bodyTk = new StringTokenizer(bodyText, "\n", false); //$NON-NLS-1$ JspWriter out = pageContext.getOut(); try { if (this.para) { // wrap text in p while (bodyTk.hasMoreTokens()) { out.write("<p>"); //$NON-NLS-1$ out.write(StringUtils.replaceChars(bodyTk.nextToken(), (char) 63, '\'')); out.write("</p>"); //$NON-NLS-1$ } } else { // add newlines while (bodyTk.hasMoreTokens()) { out.write(StringUtils.replaceChars(bodyTk.nextToken(), (char) 63, '\'')); if (bodyTk.hasMoreTokens()) { out.write("<br/>"); //$NON-NLS-1$ } } } } catch (IOException e) { throw new JspTagException(e.getMessage()); } } return EVAL_PAGE; }
From source file:edu.ku.brc.af.ui.forms.formatters.DataObjDataFieldWrapper.java
public String toString() { if (StringUtils.isNotEmpty(fmtField.getDataObjFormatterName())) { // data obj switch formatter return fmtField.getDataObjFormatterName() + " (display format)"; }/*from w w w .jav a2 s .c o m*/ // try and get the field formatter from static instance if (fmtField.getUiFieldFormatter() == null && StringUtils.isNotEmpty(fmtField.getUiFieldFormatterName())) { UIFieldFormatterIFace fmt = UIFieldFormatterMgr.getInstance() .getFormatter(fmtField.getUiFieldFormatterName()); fmtField.setUiFieldFormatter(fmt); } // field DBFieldInfo fieldInfo = fmtField.getFieldInfo(); DBRelationshipInfo relInfo = fmtField.getRelInfo(); String result = (relInfo != null) ? relInfo.getTitle() + "." : ""; String pattern = (fmtField.getUiFieldFormatter() != null) ? " (" + fmtField.getUiFieldFormatter().toPattern() + ")" : ""; return (fieldInfo != null) ? result + fieldInfo.getTitle() + pattern : result + pattern; }
From source file:net.shopxx.entity.SpecificationItem.java
public boolean isValid(SpecificationValue specificationValue) { if (specificationValue != null && specificationValue.getId() != null && StringUtils.isNotEmpty(specificationValue.getValue()) && CollectionUtils.isNotEmpty(getEntries())) { for (SpecificationItem.Entry entry : getEntries()) { if (entry != null && entry.getIsSelected() && specificationValue.getId().equals(entry.getId()) && StringUtils.equals(entry.getValue(), specificationValue.getValue())) { return true; }//from w w w .j a v a 2s.com } } return false; }