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:com.evolveum.midpoint.web.util.StringResourceChoiceRenderer.java
@Override public String getObject(String id, IModel<? extends List<? extends String>> choices) { return StringUtils.isNotBlank(id) ? choices.getObject().get(Integer.parseInt(id)) : null; }
From source file:com.egt.core.util.VelocityEngineer.java
private static Properties getProperties(String propsFilename) throws Exception { Bitacora.trace(VelocityEngineer.class, "getProperties", propsFilename); Properties p = new Properties(); try (FileInputStream inStream = new FileInputStream(propsFilename)) { p.load(inStream);/*www. j a v a 2s . co m*/ } String comma = System.getProperties().getProperty("path.separator"); String slash = System.getProperties().getProperty("file.separator"); String VFRLP = "$" + EAC.VELOCITY_FILE_RESOURCE_LOADER_PATH; String vfrlp = EA.getString(EAC.VELOCITY_FILE_RESOURCE_LOADER_PATH); vfrlp = vfrlp.replace(comma, ", "); vfrlp = vfrlp.replace(slash, "/"); String key; String value; for (Enumeration e = p.propertyNames(); e.hasMoreElements();) { key = (String) e.nextElement(); value = p.getProperty(key); if (StringUtils.isNotBlank(value) && value.contains(VFRLP)) { value = value.replace(VFRLP, vfrlp); p.setProperty(key, value); } Bitacora.trace(key + "=" + value); } return p; }
From source file:com.healthcit.cacure.web.interceptor.BreadCrumbsSupportInterceptor.java
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { if (handler instanceof BreadCrumbsSupporter) { String nameAllJson = request.getParameter("name_all_json"); if (StringUtils.isNotBlank(nameAllJson) && "true".equalsIgnoreCase(nameAllJson)) { BreadCrumbsSupporter controller = (BreadCrumbsSupporter) handler; List<BreadCrumb.Link> links = controller.getAllLinks(request); response.setContentType("application/json"); PrintWriter writer = response.getWriter(); try { String contextPath = request.getContextPath(); JSONArray linksArray = new JSONArray(); for (BreadCrumb.Link link : links) { JSONObject obj = new JSONObject(); obj.put("name", link.getName()); obj.put("url", contextPath + link.getUrl()); linksArray.add(obj); }//from w w w . ja v a 2s. c o m writer.write(linksArray.toString()); } finally { writer.close(); } return false; } } return super.preHandle(request, response, handler); }
From source file:com.cognifide.slice.cq.TemplateManager.java
public String getPath(final String pagePath) { String templateName = null;/*w w w. j a va 2s. c o m*/ if (StringUtils.isNotBlank(pagePath)) { Page page = pageManager.getPage(pagePath); templateName = getPath(page); } return templateName; }
From source file:com.googlecode.t7mp.configuration.LocalMavenRepositoryArtifactResolver.java
private File createLocalMavenRepository() { String mavenRepositoryPath = System.getProperty("maven.repo.home"); if (StringUtils.isNotBlank(mavenRepositoryPath)) { return createLocalMavenRepository(new File(mavenRepositoryPath)); } else {//from w ww. ja v a2s . c o m return createLocalMavenRepository( new File(new File(System.getProperty("user.home")), "/.m2/repository")); } }
From source file:com.photon.maven.plugins.android.common.DeviceHelper.java
/** * Get a device identifier string that is suitable for filenames as well as log messages. * This means it is human readable and contains no spaces. * Used for instrumentation test report file names so see more at * AbstractInstrumentationMojo#testCreateReport javadoc since * that is the public documentation./* w w w. j a v a 2 s. co m*/ */ public static String getDescriptiveName(IDevice device) { // if any of this logic changes update javadoc for // AbstractInstrumentationMojo#testCreateReport String SEPARATOR = "_"; StringBuilder identfier = new StringBuilder().append(device.getSerialNumber()); if (device.getAvdName() != null) { identfier.append(SEPARATOR).append(device.getAvdName()); } String manufacturer = getManufacturer(device); if (StringUtils.isNotBlank(manufacturer)) { identfier.append(SEPARATOR).append(manufacturer); } String model = getModel(device); if (StringUtils.isNotBlank(model)) { identfier.append(SEPARATOR).append(model); } return FileNameHelper.fixFileName(identfier.toString()); }
From source file:com.adanac.module.blog.dynamic.ArticleManager.java
@Override public void putCustomData(Map<String, Object> data, HttpServletRequest request, HttpServletResponse response) { String currentString = request.getParameter("current"); int current = 1; if (StringUtils.isNotBlank(currentString)) { current = Integer.valueOf(currentString); }//w w w. j a v a2 s .c o m ArticleListHelper.putDataMapForManager(data, VIEW_MODE, current); }
From source file:com.thalesgroup.hudson.plugins.klocwork.util.KloMetricUtil.java
public static boolean isValid(final String threshold) { if (StringUtils.isNotBlank(threshold)) { try {// ww w . j a v a 2 s . c o m return Integer.valueOf(threshold) >= 0; } catch (NumberFormatException exception) { // not valid } } return false; }
From source file:com.adanac.module.blog.dynamic.RecordManager.java
@Override public void putCustomData(Map<String, Object> data, HttpServletRequest request, HttpServletResponse response) { String currentString = request.getParameter("current"); int current = 1; if (StringUtils.isNotBlank(currentString)) { current = Integer.valueOf(currentString); }/*from w w w .ja va2s .c om*/ int total = DaoFactory.getDao(RecordDao.class).getTotal(); int page = (total % 10 == 0) ? (total / 10) : (total / 10 + 1); Map<String, Integer> pager = new HashMap<String, Integer>(); pager.put("current", current); pager.put("total", total); pager.put("page", page); data.put("pageRecords", DaoFactory.getDao(RecordDao.class).getRecords(pager, ViewMode.DYNAMIC)); data.put("pager", pager); data.put("firstArticleListUrl", "/admin/article_manager.ftl?current=1"); data.put("preArticleListUrl", "/admin/article_manager.ftl?current=" + (current - 1)); data.put("nextArticleListUrl", "/admin/article_manager.ftl?current=" + (current + 1)); data.put("lastArticleListUrl", "/admin/article_manager.ftl?current=" + (page)); }
From source file:com.marvelution.jira.plugins.hudson.services.servers.HudsonServerUtils.java
/** * Check method to see if a {@link HudsonServer} is secured or anonymous * /*from w w w . j a va 2 s . com*/ * @param server the {@link HudsonServer} to check * @return <code>true</code> if username and password are set (secured), <code>false</code> (anonymous) otherwise */ public static boolean isServerSecured(HudsonServer server) { return StringUtils.isNotBlank(server.getUsername()) && StringUtils.isNotBlank(server.getPassword()); }