List of usage examples for org.apache.commons.lang3 StringUtils contains
public static boolean contains(final CharSequence seq, final CharSequence searchSeq)
Checks if CharSequence contains a search CharSequence, handling null .
From source file:com.cognifide.qa.bb.aem.dialog.classic.field.image.AemImage.java
/** * Checks if there is an image set in image field. * * @return true if image is set.// w w w . j a v a2 s . c o m */ public boolean hasImageSet() { return !StringUtils.contains(currentScope.getAttribute(HtmlTags.Attributes.CLASS), "cq-upload-hint"); }
From source file:com.glaf.activiti.mail.SendSimpleMailTaskBean.java
public void sendRunningTasks(String actorId) { User user = IdentityFactory.getUser(actorId); if (StringUtils.isNotEmpty(user.getMail()) && StringUtils.contains(user.getMail(), "@")) { this.sendRunningTasks(user); }//from w w w. j a v a2s . com }
From source file:com.xpn.xwiki.user.impl.xwiki.MyBasicAuthenticator.java
public boolean processLogin(String username, String password, String rememberme, SecurityRequestWrapper request, HttpServletResponse response, XWikiContext context) throws Exception { Principal principal = authenticate(username, password, context); if (principal != null) { // login successful request.getSession().removeAttribute(LOGIN_ATTEMPTS); // make sure the Principal contains wiki name information if (!StringUtils.contains(principal.getName(), ':')) { principal = new SimplePrincipal(context.getDatabase() + ":" + principal.getName()); }//from w w w . j ava 2s. c o m request.setUserPrincipal(principal); return false; } else { // login failed // show the basic authentication window again. showLogin(request.getCurrentRequest(), response); return true; } }
From source file:com.thoughtworks.go.matchers.ConsoleOutMatcher.java
public static TypeSafeMatcher<String> printedUploadingInfo(final Object jobIdentifer) { return new TypeSafeMatcher<String>() { private String consoleOut; public String stdout; public boolean matchesSafely(String consoleOut) { this.consoleOut = consoleOut; stdout = format("Start to upload %s", jobIdentifer.toString()); return StringUtils.contains(consoleOut, stdout); }/*from w w w.j a v a2 s . co m*/ public void describeTo(Description description) { description.appendText("expected console to contain [" + stdout + "]" + " but was " + consoleOut); } }; }
From source file:com.glaf.jbpm.business.SendPastDueMailTaskBean.java
public void sendAllPastDueTasks() { ISysTodoService todoService = ContextFactory.getBean("sysTodoService"); List<Todo> todoList = todoService.getTodoList(); if (todoList != null && !todoList.isEmpty()) { Map<String, User> userMap = IdentityFactory.getUserMap(); Iterator<User> iterator = userMap.values().iterator(); while (iterator.hasNext()) { User user = iterator.next(); if (StringUtils.isNotEmpty(user.getMail()) && StringUtils.contains(user.getMail(), "@")) { this.sendPastDueTasks(user, todoList); }/*from w ww . j a va2 s . co m*/ } } }
From source file:com.jeans.iservlet.service.fts.impl.FtsServiceImpl.java
@Override public Map<String, List<FtsResultView>> search(String catalog, String keyword, User user) { Map<String, List<FtsResultView>> results = new LinkedHashMap<String, List<FtsResultView>>(); if (StringUtils.contains(catalog, "S")) { // TODO ??? }/* w w w .j a v a2 s .co m*/ if (StringUtils.contains(catalog, "A")) { // ?? List<Asset> assets = assetSearch(keyword, user.getCompany().getId()); if (null != assets && assets.size() > 0) { // ? List<FtsResultView> items = new ArrayList<FtsResultView>(); for (Asset asset : assets) { FtsResultView item = new FtsResultView(); item.setId(asset.getId()); item.setTitle(asset.getFullName()); if (asset instanceof Hardware) { item.setType(FTS_ASSET_HARDWARE); } else { item.setType(FTS_ASSET_SOFTWARE); } items.add(item); } results.put("?", items); } } if (StringUtils.contains(catalog, "W")) { // ???ITSystem, Post List<FtsResultView> items = new ArrayList<FtsResultView>(); List<ITSystem> systems = systemSearch(keyword); Company company = user.getCompany(); for (ITSystem system : systems) { if (system.getOwner().equals(company)) { items.add(wrapSystem(system)); continue; } boolean branched = false; Set<SystemBranch> branches = system.getBranches(); for (SystemBranch branch : branches) { if (branch.getCompany().equals(company)) { branched = true; items.add(wrapSystem(system)); break; } } if (branched) { continue; } if (system.getScope() == SystemScope.Custom) { if (system.getCompaniesInScope().contains(company)) { items.add(wrapSystem(system)); continue; } } else { if (company.getLevel() != Company.PROVINCE) { if (system.getOwner().equals(company.getSuperior()) && system.getScope() != SystemScope.Private) { items.add(wrapSystem(system)); continue; } if (company.getLevel() == Company.BRANCH && system.getOwner().equals(company.getSuperior().getSuperior()) && (system.getScope() == SystemScope.PrivateAndInferiors || system.getScope() == SystemScope.Inferiors)) { items.add(wrapSystem(system)); continue; } } } } List<Post> posts = wikiSearch(keyword); Set<Page> pages = new HashSet<Page>(); for (Post post : posts) { if (null == post.getPage()) { Page p = pageDao.getById(Page.class, post.getId()); if (p.getWiki().getCompanies().contains(company) || (company.getLevel() == Company.BRANCH && p.getWiki().getCompanies().contains(company.getSuperior()))) { System.out.println("id=" + p.getId()); pages.add(p); } } else { if (post.getPage().getWiki().getCompanies().contains(company) || (company.getLevel() == Company.BRANCH && post.getPage().getWiki().getCompanies().contains(company.getSuperior()))) { pages.add(post.getPage()); } } } for (Page page : pages) { items.add(wrapPage(page)); } if (!items.isEmpty()) { results.put("?", items); } } if (StringUtils.contains(catalog, "P")) { // ?? List<Project> projects = projectSearch(keyword); if (null != projects && projects.size() > 0) { List<FtsResultView> items = new ArrayList<FtsResultView>(); for (Project project : projects) { if (project.getProjectTeam().getStaff().contains(user.getEmployee())) { FtsResultView item = new FtsResultView(); item.setId(project.getId()); item.setTitle(project.getName()); item.setType(FTS_PROJECT); items.add(item); } } results.put("", items); } } if (StringUtils.contains(catalog, "M")) { // TODO ??? } if (StringUtils.contains(catalog, "D")) { // ?? List<CloudUnit> units = cloudSearch(keyword); if (null != units && units.size() > 0) { List<FtsResultView> items = new ArrayList<FtsResultView>(); for (CloudUnit unit : units) { // ? FtsResultView item = new FtsResultView(); item.setId(unit.getId()); if (unit instanceof CloudFile) { item.setTitle(unit.getOwner().getName() + " - " + ((CloudFile) unit).getVersionFilename()); item.setType(FTS_CLOUD_FILE); } else { item.setTitle(unit.getOwner().getName() + " - " + unit.getName()); item.setType(FTS_CLOUD_LIST); } items.add(item); } results.put("", items); } } return results; }
From source file:com.nridge.core.ds.rdbms.SQLSequence.java
/** * Returns a schema name for sequence objects based on the DB name * assigned to the bag and the data field. * * @param aBag Field bag with DB name assigned. * @param aFieldName Name of field to base sequence on. * * @return Schema name of the index object. * * @throws NSException Catch-all exception for any SQL related issue. *///from w w w.j a va 2 s . c o m public String schemaName(DataBag aBag, String aFieldName) throws NSException { String dbName = aBag.getName(); if (StringUtils.isEmpty(dbName)) throw new NSException("The name for the data bag is undefined."); String sequenceName; if (mSQLConnection.isAutoNamingEnabled()) { if (StringUtils.startsWith(dbName, NS_SEQUENCE_PREFIX)) { if (StringUtils.contains(dbName, aFieldName)) sequenceName = dbName; else sequenceName = String.format("%s_%s_%s", NS_SEQUENCE_PREFIX, dbName, aFieldName); } else sequenceName = String.format("%s_%s_%s", NS_SEQUENCE_PREFIX, dbName, aFieldName); } else sequenceName = String.format("%s_%s", dbName, aFieldName); return sequenceName; }
From source file:com.erudika.para.persistence.CassandraDAO.java
@Override public <P extends ParaObject> String create(String appid, P so) { if (so == null) { return null; }//from w w w . jav a 2 s .co m if (!StringUtils.contains(so.getId(), Config.SEPARATOR)) { if (StringUtils.isBlank(so.getId())) { so.setId(Utils.getNewId()); logger.debug("Generated new id: " + so.getId()); } } if (so.getTimestamp() == null) { so.setTimestamp(Utils.timestamp()); } so.setAppid(appid); createRow(so.getId(), appid, toRow(so, null)); logger.debug("DAO.create() {}", so.getId()); return so.getId(); }
From source file:com.adguard.filter.rules.CssFilterRule.java
/** * Creates CSS filter rule/*from w w w . ja v a2 s. c o m*/ * * @param ruleText Rule text */ public CssFilterRule(String ruleText) { super(ruleText); String mask; boolean styleInject = false; boolean whiteListRule = false; if (StringUtils.contains(ruleText, MASK_CSS_INJECT_EXCEPTION_RULE)) { mask = MASK_CSS_INJECT_EXCEPTION_RULE; whiteListRule = true; styleInject = true; } else if (StringUtils.contains(ruleText, MASK_CSS_INJECT_RULE)) { mask = MASK_CSS_INJECT_RULE; styleInject = true; } else if (StringUtils.contains(ruleText, MASK_CSS_EXCEPTION_RULE)) { mask = MASK_CSS_EXCEPTION_RULE; whiteListRule = true; } else if (StringUtils.contains(ruleText, MASK_CSS_RULE)) { mask = MASK_CSS_RULE; } else { throw new IllegalArgumentException("ruleText"); } int indexOfMask = StringUtils.indexOf(ruleText, mask); if (indexOfMask > 0) { // domains are specified, parsing String domains = StringUtils.substring(ruleText, 0, indexOfMask); loadDomains(domains); } this.styleInject = styleInject; this.whiteListRule = whiteListRule; cssContent = ruleText.substring(indexOfMask + mask.length()); }
From source file:net.gplatform.sudoor.server.security.model.DefaultPermissionEvaluator.java
/** * Find the expression string recursively from the config file * /*from www. j a v a 2 s. c o m*/ * @param name * @param permission * @return */ public String getExpressionString(String name, Object permission) { String expression = properties.getProperty(CONFIG_EXPRESSION_PREFIX + name + "." + permission); //Get generic permit if (expression == null) { expression = properties.getProperty(CONFIG_EXPRESSION_PREFIX + name); } //Get parent permit if (expression == null && StringUtils.contains(name, ".")) { String parent = StringUtils.substringBeforeLast(name, "."); expression = getExpressionString(parent, permission); } LOG.debug("Get Expression String: [{}] for name: [{}] permission: [{}]", expression, name, permission); return expression; }