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:net.rptools.maptool.client.AppUtil.java
/** * Returns a {@link File} path that points to the AppHome base directory along with the subpath denoted in the * "subdir" argument./* w ww . j ava2 s .c o m*/ * <p> * For example <code>getAppHome("cache")</code> will return the path <code>{APPHOME}/cache</code>. * <p> * As a side-effect the function creates the directory pointed to by File. * * @param subdir * of the maptool home directory * @return the maptool data directory name subdir * @see getAppHome() */ public static File getAppHome(String subdir) { File path = getDataDir(); if (!StringUtils.isEmpty(subdir)) { path = new File(path.getAbsolutePath(), subdir); } // Now check for characters known to cause problems. See getDataDir() for details. if (path.getAbsolutePath().matches("!")) throw new RuntimeException(I18N.getText("msg.error.unusableDir", path.getAbsolutePath())); if (!path.exists()) { path.mkdirs(); // Now check our work if (!path.exists()) { RuntimeException re = new RuntimeException( I18N.getText("msg.error.unableToCreateDataDir", path.getAbsolutePath())); if (log.isInfoEnabled()) log.info("msg.error.unableToCreateDataDir", re); throw re; } } return path; }
From source file:com.aimluck.eip.modules.screens.ProjectMemberJSONScreen.java
@Override protected String getJSONString(RunData rundata, Context context) throws Exception { String projectId = rundata.getParameters().getString("projectId"); if (StringUtils.isEmpty(projectId) || !StringUtils.isNumeric(projectId)) { return ""; }/* w ww. jav a 2s . c o m*/ Map<String, String> map = ProjectUtils.getProjectMemberMap(Integer.valueOf(projectId)); return JSONArray.fromObject(map).toString(); }
From source file:com.clican.pluto.cms.ui.ext.converter.DataModelConverter.java
public Object getAsObject(FacesContext context, UIComponent component, String value) { if (StringUtils.isEmpty(value)) { return null; } else {//from www .j a v a 2 s . c o m DataModelService dataModelService = (DataModelService) Constants.ctx.getBean("dataModelService"); return dataModelService.loadDataModel(modelClass, new Long(value)); } }
From source file:com.evolveum.midpoint.web.security.MidPointAuthenticationSuccessHandler.java
@Override protected String determineTargetUrl(HttpServletRequest request, HttpServletResponse response) { if (StringUtils.isEmpty(defaultTargetUrl)) { return super.determineTargetUrl(request, response); }//from w w w. ja v a 2s . c o m return defaultTargetUrl; }
From source file:com.intel.cosbench.driver.web.WorkersPageController.java
@Override protected ModelAndView process(HttpServletRequest req, HttpServletResponse res) throws Exception { String id = req.getParameter("id"); if (StringUtils.isEmpty(id)) throw new BadRequestException(); MissionInfo info = driver.getMissionInfo(id); if (info == null) throw new NotFoundException(); return createResult(info); }
From source file:com.thoughtworks.go.server.security.LdapContextSourceConfigurator.java
public void configure(AbstractContextSource contextSource) { String managerDn = ldapConfig.managerDn(); if (!StringUtils.isEmpty(managerDn)) { contextSource.setUserDn(managerDn); contextSource.setPassword(ldapConfig.managerPassword()); }//from www .j a v a 2 s .c o m }
From source file:com.fanxian.commons.udas.UdasServiceFactory.java
public UdasService getUdasService(String name) { if (StringUtils.isEmpty(name)) { return null; }/*w w w . j a va 2s. c o m*/ UdasService udasService = map.get(name); if (udasService != null) { return udasService; } UdasServiceImpl impl; if (useInnerMemCache) { impl = new UdasServiceImpl(CacheEnum.inner_mem, name, CONFIGKEY); impl.init(); } else { impl = new UdasServiceImpl(CacheEnum.remote_memcached, name, CONFIGKEY); impl.init(); } map.put(name, impl); return impl; }
From source file:edu.cornell.mannlib.vitro.webapp.edit.n3editing.PersonHasPublicationValidatorOld.java
@Override public Map<String, String> validate(EditConfiguration editConfig, EditSubmission editSub) { Map<String, String> urisFromForm = editSub.getUrisFromForm(); Map<String, Literal> literalsFromForm = editSub.getLiteralsFromForm(); Map<String, String> errors = new HashMap<String, String>(); // If there's a pubUri, then we're done. The other fields are disabled and so don't get submitted. String pubUri = urisFromForm.get("pubUri"); if (!StringUtils.isEmpty(pubUri)) { return null; }//from w w w . j a va 2 s .c om String pubType = urisFromForm.get("pubType"); if ("".equals(pubType)) { pubType = null; } Literal title = literalsFromForm.get("title"); if (title != null) { String titleValue = title.getLexicalForm(); if (StringUtils.isEmpty(titleValue)) { title = null; } } if (pubType == null) { errors.put("pubType", MISSING_PUB_TYPE_ERROR); } if (title == null) { errors.put("title", MISSING_PUB_TITLE_ERROR); } return errors.size() != 0 ? errors : null; }
From source file:com.clican.pluto.dataprocess.dpl.parser.object.SubDpl.java
/** * ?????/* w w w . j a va 2 s .c o m*/ * * @param subDplStr * ?dpl * @param alias * ?? * @param result * ? */ public void addSubDpl(String subDplStr, String alias, Object result) { if (StringUtils.isEmpty(alias)) { alias = "dual." + "s" + UUID.randomUUID().toString().replaceAll("\\-", ""); } aliasResultMap.put(alias, result); subDplStrAliasMap.put(subDplStr, alias); }
From source file:au.org.ala.delta.editor.ui.validator.ItemValidator.java
/** * Ensures that the item description is not empty. *//*from www . j a v a 2 s. co m*/ @Override public ValidationResult validate(Object toValidate) { String unformattedDescription = RTFUtils.stripFormatting((String) toValidate).trim(); ValidationResult result = null; if (StringUtils.isEmpty(unformattedDescription)) { result = new ValidationResult(NO_ITEM_DESCRIPTION, 0); } else { result = validateComments(unformattedDescription); } return result; }