List of usage examples for org.apache.commons.lang StringUtils isEmpty
public static boolean isEmpty(String str)
Checks if a String is empty ("") or null.
From source file:com.bstek.dorado.view.registry.ComponentTypeRegisterInfo.java
/** * @param classType/*w w w. j ava 2 s .co m*/ */ public void setClassType(Class<? extends Component> classType) { this.classType = classType; if (StringUtils.isEmpty(name)) { name = ClassUtils.getShortClassName(classType); } }
From source file:com.clican.pluto.dataprocess.spring.parser.DeployParser.java
public BeanDefinition parse(Element element, ParserContext parserContext) { BeanDefinitionRegistry bdr = parserContext.getRegistry(); RootBeanDefinition beanDef = new RootBeanDefinition(); beanDef.setAbstract(false);// w w w. java2 s .co m beanDef.setBeanClass(Deploy.class); beanDef.setLazyInit(false); beanDef.setAutowireMode(Autowire.BY_NAME.value()); String id = element.getAttribute("id"); if (StringUtils.isEmpty(id)) { id = "dplDeploy#" + element.hashCode(); } bdr.registerBeanDefinition(id, beanDef); this.setBeanDefinitionStringProperty("name", beanDef, element); this.setBeanDefinitionStringProperty("url", beanDef, element); this.setBeanDefinitionStringProperty("propertyResources", beanDef, element); return beanDef; }
From source file:com.nec.harvest.service.impl.MessageServiceImpl.java
/** {@inheritDoc} */ @Override//ww w . j a v a2 s . com public Message findByMsgCode(String msgCode) throws ServiceException { if (StringUtils.isEmpty(msgCode)) { throw new IllegalArgumentException("Message's Id must not be null or empty"); } final Session session = HibernateSessionManager.getSession(); Transaction tx = null; Message message = null; try { tx = session.beginTransaction(); message = repository.get(session, msgCode); // Release transaction tx.commit(); if (message == null) { throw new ObjectNotFoundException("Could not found any message matches with Id " + msgCode); } } catch (JDBCConnectionException ex) { if (tx != null) { tx.rollback(); } throw new ConnectionException( "Database access problem. Killing off all remaining connections in the connection pool.", ex); } catch (HibernateException ex) { if (tx != null) { tx.rollback(); } throw new ServiceException("Could not find any message matches with code " + msgCode, ex); } finally { HibernateSessionManager.closeSession(session); } return message; }
From source file:lince.modelo.InstrumentoObservacional.Categoria.java
public Categoria(String nombre) { this.nombre = nombre; if (StringUtils.isEmpty(this.codigo)) { String codeName = StringUtils.EMPTY; for (String item : nombre.split(" ")) { codeName += item.substring(0, 1); }//from ww w .j a v a 2 s . c o m this.codigo = codeName; } }
From source file:eu.eidas.auth.engine.metadata.Contact.java
public void setCompany(String company) { if (!StringUtils.isEmpty(company)) { this.company = company; } }
From source file:com.greenline.guahao.biz.manager.hrs.impl.DictManagerImpl.java
/** * ?//from w ww.ja v a2 s .c om * * @param dictId * @return List<DictDO> */ @Override public List<DictDO> listDicts(String dictId) { if (StringUtils.isEmpty(dictId)) { return null; } return covert2DOList(dictService.listDicts(dictId)); }
From source file:com.lewisd.maven.lint.rules.opensource.MissingLicenseRule.java
@Override public void invoke(MavenProject mavenProject, Map<String, Object> models, ResultCollector resultCollector) { final List<License> licenses = mavenProject.getLicenses(); if (licenses.isEmpty()) { InputLocation location = mavenProject.getOriginalModel().getLocation("licences"); resultCollector.addViolation(mavenProject, this, "missing <licenses/> information", location == null ? getEmptyLocation(mavenProject) : location); } else {//w w w. j a v a 2 s.c o m for (License license : licenses) { if (StringUtils.isEmpty(license.getName())) { resultCollector.addViolation(mavenProject, this, "missing <name> in <license/> information", license.getLocation("")); } if (StringUtils.isEmpty(license.getUrl())) { resultCollector.addViolation(mavenProject, this, "missing <url> in <license/> information", license.getLocation("")); } } } }
From source file:be.fedict.eid.pkira.blm.model.certificatedomain.validation.ValidCertificateDomainDnExpressionValidator.java
@Override public boolean isValid(Object value) { if (StringUtils.isEmpty((String) value)) { return true; }//from www . ja va 2s .c o m DistinguishedNameManager distinguishedNameManager = (DistinguishedNameManager) Component .getInstance(DistinguishedNameManager.NAME); // Create the DN try { distinguishedNameManager.createDistinguishedNameExpression((String) value); } catch (InvalidDistinguishedNameException e) { return false; } return true; }
From source file:net.jforum.core.events.post.BadWordEvent.java
/** * @see net.jforum.events.EmptyPostEvent#beforeAdd(net.jforum.entities.Post) */// ww w. jav a2 s.c o m @Override public void beforeAdd(Post post) { List<BadWord> words = this.repository.getAll(); for (BadWord word : words) { Pattern pattern = Pattern.compile("\\b" + word.getWord() + "\\b", Pattern.CASE_INSENSITIVE); post.setText(this.applyFilter(post.getText(), word.getReplacement(), pattern)); if (!StringUtils.isEmpty(post.getSubject())) { post.setSubject(this.applyFilter(post.getSubject(), word.getReplacement(), pattern)); } if (!StringUtils.isEmpty(post.getTopic().getSubject())) { post.getTopic() .setSubject(this.applyFilter(post.getTopic().getSubject(), word.getReplacement(), pattern)); } } }
From source file:com.pedra.storefront.forms.validation.PasswordValidator.java
@Override public void validate(final Object object, final Errors errors) { final UpdatePasswordForm passwordForm = (UpdatePasswordForm) object; final String currPasswd = passwordForm.getCurrentPassword(); final String newPasswd = passwordForm.getNewPassword(); final String checkPasswd = passwordForm.getCheckNewPassword(); if (StringUtils.isEmpty(currPasswd)) { errors.rejectValue("currentPassword", "profile.currentPassword.invalid"); }// www .ja v a 2 s . c om if (StringUtils.isEmpty(newPasswd)) { errors.rejectValue("newPassword", "updatePwd.pwd.invalid"); } else if (StringUtils.length(newPasswd) < 6 || StringUtils.length(newPasswd) > 255) { errors.rejectValue("newPassword", "updatePwd.pwd.invalid"); } if (StringUtils.isEmpty(checkPasswd)) { errors.rejectValue("checkNewPassword", "updatePwd.pwd.invalid"); } else if (StringUtils.length(checkPasswd) < 6 || StringUtils.length(checkPasswd) > 255) { errors.rejectValue("checkNewPassword", "updatePwd.pwd.invalid"); } }