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.wechat.client.business.controller.CarController.java
@RequestMapping("/sel") public String select(HttpServletRequest request, HttpServletResponse response) { String backurl = request.getParameter("backurl"); if (StringUtils.isNotEmpty(backurl)) { backurl = backurl.replaceAll("_1q1_", "?").replaceAll("_2q2_", "&"); }/* www . ja va 2 s . com*/ request.setAttribute("backurl", backurl); return "car_model_sel"; }
From source file:com.haulmont.cuba.gui.xml.layout.loaders.SuggestionFieldQueryLoader.java
protected void loadQuery(SuggestionField suggestionField, Element element) { Element queryElement = element.element("query"); if (queryElement != null) { final boolean escapeValue; String stringQuery = queryElement.getStringValue(); String searchFormat = queryElement.attributeValue("searchStringFormat"); String view = queryElement.attributeValue("view"); String escapeValueForLike = queryElement.attributeValue("escapeValueForLike"); if (StringUtils.isNotEmpty(escapeValueForLike)) { escapeValue = Boolean.valueOf(escapeValueForLike); } else {// w w w. j av a 2 s . c o m escapeValue = false; } String entityClassName = queryElement.attributeValue("entityClass"); if (StringUtils.isNotEmpty(entityClassName)) { suggestionField.setSearchExecutor((searchString, searchParams) -> { DataSupplier supplier = suggestionField.getFrame().getDsContext().getDataSupplier(); Class<Entity> entityClass = ReflectionHelper.getClass(entityClassName); if (escapeValue) { searchString = QueryUtils.escapeForLike(searchString); } searchString = applySearchFormat(searchString, searchFormat); LoadContext loadContext = LoadContext.create(entityClass); if (StringUtils.isNotEmpty(view)) { loadContext.setView(view); } loadContext.setQuery( LoadContext.createQuery(stringQuery).setParameter("searchString", searchString)); //noinspection unchecked return supplier.loadList(loadContext); }); } else { throw new GuiDevelopmentException( String.format("Field 'entityClass' is empty in component %s.", suggestionField.getId()), getContext().getFullFrameId()); } } }
From source file:com.photon.phresco.framework.param.impl.Html5ThemesListImpl.java
@Override public PossibleValues getValues(Map<String, Object> paramMap) throws PhrescoException { try {/*from w w w . jav a2s .co m*/ String rootModulePath = ""; String subModuleName = ""; PossibleValues possibleValues = new PossibleValues(); ApplicationInfo applicationInfo = (ApplicationInfo) paramMap.get(KEY_APP_INFO); String rootModule = (String) paramMap.get(KEY_ROOT_MODULE); if (StringUtils.isNotEmpty(rootModule)) { rootModulePath = Utility.getProjectHome() + rootModule; subModuleName = applicationInfo.getAppDirName(); } else { rootModulePath = Utility.getProjectHome() + applicationInfo.getAppDirName(); } File file = new File(getResourcesPath(rootModulePath, subModuleName).toString()); if (file.exists()) { File[] listFiles = file.listFiles(); if (!ArrayUtils.isEmpty(listFiles)) { for (File listFile : listFiles) { if (!listFile.getName().startsWith(".")) { Value value = new Value(); value.setValue(listFile.getName()); value.setDependency("defaultTheme"); possibleValues.getValue().add(value); } } } } return possibleValues; } catch (Exception e) { throw new PhrescoException(e); } }
From source file:com.evolveum.midpoint.repo.sql.DataSourceFactory.java
public DataSource createDataSource() throws RepositoryServiceFactoryException { LOGGER.info("Loading datasource."); if (configuration == null) { throw new RepositoryServiceFactoryException("SQL configuration is null, couldn't create datasource."); }// w w w .j a va2s . co m try { if (StringUtils.isNotEmpty(configuration.getDataSource())) { LOGGER.info("JDNI datasource present in configuration, looking for '{}'.", new Object[] { configuration.getDataSource() }); return createJNDIDataSource(); } LOGGER.info("Constructing default C3P0 datasource with connection pooling."); dataSource = createC3P0DataSource(); return dataSource; } catch (Exception ex) { throw new RepositoryServiceFactoryException( "Couldn't initialize datasource, reason: " + ex.getMessage(), ex); } }
From source file:com.cloudera.nav.sdk.model.entities.DatasetField.java
/** * */* ww w .ja v a2 s. c om*/ * @param parentId */ public void setParentId(String parentId) { Preconditions.checkArgument(StringUtils.isNotEmpty(parentId), "DatasetField parent must have valid identity"); this.parentId = parentId; }
From source file:com.github.dbourdette.glass.tools.UtilsTool.java
public boolean isNotEmpty(String string) { return StringUtils.isNotEmpty(string); }
From source file:ee.pri.rl.blog.web.page.common.EntryListPanel.java
public EntryListPanel(String id, String title, IModel<List<Entry>> model) { super(id);/*from w ww.j ava 2 s. c om*/ add(new Label("title", StringUtils.defaultIfEmpty(title, "")).setVisible(StringUtils.isNotEmpty(title))); add(new EntryListView("entries", model)); }
From source file:com.fengduo.bee.model.cons.ItemTagEnum.java
public static ItemTagEnum getAction(String value) { for (ItemTagEnum state : values()) { if (StringUtils.isNotEmpty(value) && StringUtils.equals(value, state.getValue() + "")) return state; }/*from w w w . ja v a2s .c o m*/ return MOBILE_INTERNET; }
From source file:com.mmj.app.lucene.search.utils.CustomSolrQueryConvert.java
public static SolrQuery to(TopicSearchQuery query) { // ?/*from w w w . j a va 2 s . c om*/ List<String> params = new ArrayList<String>(); // ? if (Argument.isNotEmpty(query.getWordList())) { String q = StringUtils.join(query.getWordList().toArray(new String[0]), " "); if (StringUtils.isNotBlank(q)) { if (q.length() == 1 || StringFormatter.matchsRegex(q, "^[a-zA-Z]+$") || StringFormatter.matchsRegex(q, "^\\d+$")) { params.add("topicSearch:*" + q + "*"); } else { params.add(filterQuery(q)); } } } // List<String> fiter = new ArrayList<String>(); TimeSearchEnum timeSearch = query.getTime(); if (timeSearch != null && timeSearch.getStartTimeLong() != null) { fiter.add(String.format("topicGmtCreate:[%s TO *]", timeSearch.getStartTimeLong())); } // ? SortSearchEnum sortSearch = query.getSort(); if (sortSearch != null && StringUtils.isNotEmpty(sortSearch.getSort())) { query.setSortFiled(sortSearch.getSort()); } return createSearchQuery(params, fiter, query, "/browse"); }
From source file:com.acc.storefront.util.MetaSanitizerUtil.java
/** * Removes all HTML tags and double quotes and returns a String * //from ww w.jav a2 s.c o m * @param description * Description to be sanitized * @return String object */ public static String sanitizeDescription(final String description) { if (StringUtils.isNotEmpty(description)) { final String clean = Jsoup.parse(description).text(); return clean.replace("\"", ""); } else { return ""; } }