List of usage examples for org.apache.commons.lang StringUtils isNotBlank
public static boolean isNotBlank(String str)
Checks if a String is not empty (""), not null and not whitespace only.
From source file:gov.nih.nci.protexpress.data.interceptor.ProtExpressHibernateInterceptor.java
/** * {@inheritDoc}/*from w w w . ja v a 2 s . c o m*/ */ @Override public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { if (entity instanceof Auditable) { for (int i = 0; i < propertyNames.length; i++) { if ("auditInfo".equals(propertyNames[i]) && StringUtils.isNotBlank(UserHolder.getUsername())) { AuditInfo ai = (AuditInfo) state[i]; ai.setCreator(UserHolder.getUsername()); ai.setCreationDate(Calendar.getInstance()); ai.setLastModifiedDate(Calendar.getInstance()); } } return true; } return false; }
From source file:com.hp.autonomy.aci.content.identifier.reference.Reference.java
/** * Creates a new {@code Reference} instance for the specified string reference. * * @param reference The document reference *//* w w w .j a v a 2 s.c o m*/ public Reference(final String reference) { Validate.isTrue(StringUtils.isNotBlank(reference), "Reference must not be blank"); this.reference = reference; section = -1; }
From source file:com.fibon.maven.confluence.model.PageDescriptor.java
public boolean isRelative() { return StringUtils.isNotBlank(space) && StringUtils.isNotBlank(title); }
From source file:com.dattack.dbtools.TemplateHelper.java
private static Configuration getConfiguration() throws IOException, ConfigurationException { Configuration result = cfg;/*from w w w.j a v a 2s. com*/ if (result == null) { synchronized (TemplateHelper.class) { result = cfg; if (result == null) { result = new Configuration(Configuration.VERSION_2_3_23); final String templatesDir = GlobalConfiguration .getProperty(GlobalConfiguration.TEMPLATES_DIRECTORY_KEY); if (StringUtils.isNotBlank(templatesDir)) { result.setDirectoryForTemplateLoading(new File(templatesDir)); } else { result.setDirectoryForTemplateLoading(new File(".")); } result.setDefaultEncoding("UTF-8"); result.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); cfg = result; } } } return result; }
From source file:com.ms.commons.test.database.tool.JdbcTemplateTool.java
public JdbcTemplateTool clearSingleTable(String table, String whereSql) { StringBuilder sql = new StringBuilder(); sql.append("delete from " + table); if (StringUtils.isNotBlank(whereSql)) { sql.append(" where ").append(whereSql); }/*from w w w . java 2s. c o m*/ getJdbcTemplate().execute(sql.toString()); return this; }
From source file:com.watchrabbit.scanner.supervisor.model.Field.java
public boolean isFilled() { return StringUtils.isNotBlank(value); }
From source file:br.com.nordestefomento.jrimum.bopepo.campolivre.AbstractCLCaixaEconomicaFederal.java
static CampoLivre create(Titulo titulo) throws NotSupportedCampoLivreException { CampoLivre campoLivre = null;// www .java2 s. co m String nossoNumero = titulo.getNossoNumero(); if (StringUtils.isNotBlank(nossoNumero)) { switch (nossoNumero.length()) { case NOSSO_NUMERO_SINCO: campoLivre = new CLCaixaEconomicaFederalSINCO(titulo); break; } } if (isNull(campoLivre)) { throw new NotSupportedCampoLivreException("Campo livre disponvel somente para ttulos com " + " comprimento de " + NOSSO_NUMERO_SINCO + " " + "(SINCO) caracteres"); } else { return campoLivre; } }
From source file:com.deerYac.util.Copyright.java
private static String getAllowLicenseByMac() { String licenseKey = null;//w w w . j av a2 s .com if ((StringUtils.isNotBlank(user)) && (StringUtils.isNotBlank(licStr_mac))) { String need = user.substring(0, 1) + licStr_mac; String dx = need + "Decompiling this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright jundu of 2009. Under section 1204 of the DMCA, penalties range up to a $200,000 fine or up to five years imprisonment for a first offense. Think about it; pay for a license, avoid prosecution, and feel better about yourself." + user; int suf = A.decode(dx); String code = need + suf; licenseKey = "SN" + C.change(code); } return licenseKey; }
From source file:com.epam.cme.storefront.forms.validation.PaymentDetailsValidator.java
@Override public void validate(final Object object, final Errors errors) { final PaymentDetailsForm form = (PaymentDetailsForm) object; if (StringUtils.isNotBlank(form.getStartMonth()) && StringUtils.isNotBlank(form.getStartYear()) && StringUtils.isNotBlank(form.getExpiryMonth()) && StringUtils.isNotBlank(form.getExpiryYear())) { final Calendar start = Calendar.getInstance(); start.set(Calendar.DAY_OF_MONTH, 0); start.set(Calendar.MONTH, Integer.parseInt(form.getStartMonth()) - 1); start.set(Calendar.YEAR, Integer.parseInt(form.getStartYear()) - 1); final Calendar expiration = Calendar.getInstance(); expiration.set(Calendar.DAY_OF_MONTH, 0); expiration.set(Calendar.MONTH, Integer.parseInt(form.getExpiryMonth()) - 1); expiration.set(Calendar.YEAR, Integer.parseInt(form.getExpiryYear()) - 1); if (start.after(expiration)) { errors.rejectValue("startMonth", "payment.startDate.invalid"); }//from ww w. j a v a2s . c om } final boolean editMode = StringUtils.isNotBlank(form.getPaymentId()); if (editMode || Boolean.TRUE.equals(form.getNewBillingAddress())) { ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.titleCode", "address.title.invalid"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.firstName", "address.firstName.invalid"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.lastName", "address.lastName.invalid"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.line1", "address.line1.invalid"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.townCity", "address.townCity.invalid"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.postcode", "address.postcode.invalid"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.countryIso", "address.country.invalid"); // ValidationUtils.rejectIfEmptyOrWhitespace(errors, "billingAddress.line2", // "address.line2.invalid"); // for some addresses this field is required by cybersource } }
From source file:de.hybris.platform.commercefacades.search.solrfacetsearch.converters.populator.SolrSearchQueryEncoderPopulator.java
@Override public void populate(final SolrSearchQueryData source, final SearchQueryData target) { final StringBuilder builder = new StringBuilder(); if (source != null) { if (StringUtils.isNotBlank(source.getFreeTextSearch())) { builder.append(source.getFreeTextSearch()); }//from w w w . j a v a 2 s. com builder.append(':'); if (StringUtils.isNotBlank(source.getSort())) { builder.append(source.getSort()); } final List<SolrSearchQueryTermData> terms = source.getFilterTerms(); if (terms != null && !terms.isEmpty()) { for (final SolrSearchQueryTermData term : terms) { if (StringUtils.isNotBlank(term.getKey()) && StringUtils.isNotBlank(term.getValue())) { builder.append(':').append(term.getKey()).append(':').append(term.getValue()); } } } } final String result = builder.toString(); // Special case for empty query if (":".equals(result)) { target.setValue(""); } else { target.setValue(result); } }