List of usage examples for java.util List contains
boolean contains(Object o);
From source file:com.infinities.keystone4j.AbstractAction.java
public static Hints buildDriverHints(ContainerRequestContext context, String[] filters) { Hints hints = new Hints(); MultivaluedMap<String, String> queryDict = context.getUriInfo().getQueryParameters(); if (queryDict == null || queryDict.isEmpty()) { return hints; }//from ww w . j a v a2 s.c o m List<String> supportedFilters = Arrays.asList(filters); for (String key : queryDict.keySet()) { if (supportedFilters == null || supportedFilters.contains(key)) { String val = queryDict.getFirst(key); Object value = queryDict.getFirst(key); if ("enabled".equals(key)) { value = Boolean.parseBoolean(val); } hints.addFilter(key, value); continue; } // TODO ignore query_String } return hints; }
From source file:com.microfocus.application.automation.tools.uft.utils.UftToolUtils.java
/** * Updates the list of current tests based on the updated list of build tests * * @param buildTests the list of build tests setup in the configuration * @param rerunSettingModels the list of current tests * @return the updated list of tests to rerun *///from w w w . j ava 2 s.c o m public static List<String> getTests(List<String> buildTests, List<RerunSettingsModel> rerunSettingModels) { List<String> rerunTests = new ArrayList<>(); if (buildTests == null || rerunSettingModels == null) { return rerunTests; } for (RerunSettingsModel rerun : rerunSettingModels) { rerunTests.add(rerun.getTest().trim()); } for (String test : buildTests) { if (!rerunTests.contains(test)) { rerunTests.add(test.trim()); } } for (Iterator<RerunSettingsModel> it = rerunSettingModels.iterator(); it.hasNext();) { RerunSettingsModel rerunSettingsModel1 = it.next(); if (!buildTests.contains(rerunSettingsModel1.getTest().trim())) { rerunTests.remove(rerunSettingsModel1.getTest()); it.remove(); } } return rerunTests; }
From source file:com.evozon.evoportal.my_account.util.MyAccountUtil.java
private static String findPMReportsAssociatedDepartment(AccountModelHolder newModel, User selectedUser) { List<String> userDepartments = newModel.getUserDepartments(); // if the user is part of the HR Department if (userDepartments.contains(HR_DEPARTMENT_NAME)) { return pmReportsDepartmentsAssociations.get(HR_DEPARTMENT_NAME); }/* w w w . ja v a 2 s. c o m*/ // check user projects, ex. 'Navision' is a dep. in PM and a project in // EvoPortal. String pmReportsDepartmentName = StringPool.BLANK; if (selectedUser != null) { List<ProjectGroup> userProjects = ProjectGroupLocalServiceUtil .findProjectsByUser(selectedUser.getUserId()); for (ProjectGroup pGroup : userProjects) { String name = pGroup.getProjectGroupName(); if (pmReportsDepartmentsAssociations.containsKey(name)) { pmReportsDepartmentName = name; break; } } } if (!pmReportsDepartmentName.isEmpty()) { return pmReportsDepartmentName; } // last option check department names for (String departmentName : userDepartments) { if (pmReportsDepartmentsAssociations.containsKey(departmentName)) { pmReportsDepartmentName = pmReportsDepartmentsAssociations.get(departmentName); break; } } return pmReportsDepartmentName; }
From source file:org.springframework.hateoas.client.Traverson.java
private static final RestOperations createDefaultTemplate(List<MediaType> mediaTypes) { List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>(); converters.add(new StringHttpMessageConverter(Charset.forName("UTF-8"))); if (mediaTypes.contains(MediaTypes.HAL_JSON)) { converters.add(getHalConverter()); }/*from ww w . j a v a 2 s .c o m*/ RestTemplate template = new RestTemplate(); template.setMessageConverters(converters); return template; }
From source file:com.hangum.tadpole.session.manager.SessionManager.java
/** * is unlock db /*from w w w . ja v a 2 s .c o m*/ * @param userDB * @return */ public static boolean isUnlockDB(final UserDBDAO userDB) { HttpSession sStore = RWT.getRequest().getSession(); List<Integer> listUnlockDB = (List) sStore.getAttribute(NAME.UNLOCK_DB_LIST.name()); return listUnlockDB.contains(userDB.getSeq()); }
From source file:com.fluidops.iwb.widget.WidgetEmbeddingError.java
/** * Constructs and returns an FLabel component from the error type t. * /* w w w. ja va2 s .com*/ * @param t Type of the error * @param s String containing additional information * @return */ public static WidgetEmbeddingError getErrorLabel(String id, ErrorType t, String s) { String message; switch (t) { case NO_SELECT_QUERY: message = "Widget supports only SELECT queries."; break; case NO_QUERY: message = "No query defined."; break; case AGGREGATION_FAILED: message = "Could not perform aggregation in query."; break; case SETTINGS_FILE_NOT_FOUND: if (!StringUtil.isNullOrEmpty(s)) message = "Settings file '" + s + "' could not be resolved."; else message = "Settings file could not be resolved."; break; case SYNTAX_ERROR: if (!StringUtil.isNullOrEmpty(s)) message = "Query syntactically wrong:\n" + s; else message = "The query is syntactically wrong."; break; case QUERY_EVALUATION: if (!StringUtil.isNullOrEmpty(s)) message = "Query evaluation error:\n" + s; else message = "Query evaluation error."; break; case QUERY_TIMEOUT: StringBuilder messageBuilder = new StringBuilder("Query timed out"); List<String> roles = EndpointImpl.api().getUserManager().getRoles(null); if (roles == null || roles.isEmpty() || roles.contains(UserContext.ADMIN_ROLE)) { messageBuilder.append(" (timeout set in config.prop: "); messageBuilder.append(Config.getConfig().queryTimeout()); messageBuilder.append("s)"); } if (!StringUtil.isNullOrEmpty(s)) { messageBuilder.append(":\n"); messageBuilder.append(s); } message = messageBuilder.toString(); break; case QUERY_ENCODING_ERROR: if (!StringUtil.isNullOrEmpty(s)) message = "Query encoding error:\n" + s; else message = "Query encoding error."; break; case MISSING_INPUT_VARIABLE: message = "Input variable (parameter 'input') is not specified or empty."; break; case MISSING_OUTPUT_VARIABLE: message = "Output variable (parameter 'output') is not specified or empty."; break; case ILLEGAL_INPUT_VARIABLE: if (!StringUtil.isNullOrEmpty(s)) message = "The specified input variable '?" + s + "' does not occur in the query."; else message = "The specified output variable does not occur in the query."; break; case ILLEGAL_OUTPUT_VARIABLE: if (!StringUtil.isNullOrEmpty(s)) message = "The specified output variable '?" + s + "' does not occur in the query."; else message = "The specified output variable does not occur in the query."; break; case ILLEGAL_AGGREGATION_TYPE: if (!StringUtil.isNullOrEmpty(s)) message = "'" + s + "' is not a supported aggregation type."; else message = "The specified aggregation type is not supported."; break; case UNSUPPORTED_CHART_TYPE: if (!StringUtil.isNullOrEmpty(s)) message = "The engine does not support the specified chart type: " + s; else message = "The engine does not support the specified chart type."; break; case NOT_IMPLEMENTED: message = "The widget has not been implemented yet."; break; case GENERIC: message = s; break; case EXCEPTION: if (!StringUtil.isNullOrEmpty(s)) message = "An exception occurred: " + s; else message = "An exception occured. Widget construction failed."; break; case INVALID_WIDGET_CONFIGURATION: if (!StringUtil.isNullOrEmpty(s)) message = "Invalid widget configuration: " + s; else message = "Invalid widget configuration."; break; case NO_URI: message = "Widget not applicable (the current resource is not a URI)."; break; case EDITORIAL_WORKFLOW: message = "Editorial workflow is not enabled."; break; default: message = "Widget construction failed."; } return new WidgetEmbeddingError(id, LogLevel.ERROR, XssSafeHttpRequest.cleanXSS(message), null); }
From source file:de.langmi.spring.batch.examples.playground.file.resource.FiltersFoldersResourceFactory.java
public static Resource[] getInstance(final String filePath, final List<String> acceptedFolders) { final List<FileSystemResource> files = new ArrayList<FileSystemResource>(); runNestedDirs(new File(filePath), files, new FilenameFilter() { @Override/*from w w w. j ava 2 s . c o m*/ public boolean accept(File dir, String name) { // accept all files, made easy here, files shall contain a suffix separator if (name.contains(".")) { return true; } else if (acceptedFolders.contains(name)) { return true; } else { return false; } } }); return files.toArray(new Resource[0]); }
From source file:com.wavemaker.common.util.SystemUtils.java
public static void writePropertiesFile(OutputStream os, Properties props, List<String> includePropertyNames, String comment) {/*from ww w.j a va2 s . com*/ try { if (includePropertyNames != null) { Properties p = new Properties(); for (String key : CastUtils.<String>cast(props.keySet())) { if (includePropertyNames.contains(key)) { p.setProperty(key, props.getProperty(key)); } } props = p; } props.store(os, comment); } catch (IOException ex) { throw new RuntimeException(ex); } }
From source file:aurelienribon.gdxsetupui.Helper.java
public static String getSource(List<String> files, String file) { String path = FilenameUtils.getFullPath(file); String name = FilenameUtils.getBaseName(file); String ext = FilenameUtils.getExtension(file); if (files.contains(path + name + "-source." + ext)) return path + name + "-source." + ext; if (files.contains(path + name + "-sources." + ext)) return path + name + "-sources." + ext; if (files.contains(path + name + "-src." + ext)) return path + name + "-src." + ext; return null;// www. j a va 2 s.co m }
From source file:com.innoq.ldap.connector.Utils.java
public static Map<String, String> getTestUserAttributes(String uid) { List<String> ocs = Arrays.asList(HELPER.getUserObjectClasses()); Map<String, String> attributes = new HashMap<String, String>(); attributes.put("sn", uid.toUpperCase()); attributes.put(HELPER.getUserIdentifyer(), uid); attributes.put("description", uid); if (ocs.contains("inetOrgPerson")) { attributes.put("displayName", "Test2 Test1"); attributes.put("givenName", uid + "2"); }// w ww . ja v a 2s . c o m if (ocs.contains("posixAccount")) { attributes.put("cn", uid); attributes.put("uidNumber", "3"); attributes.put("gidNumber", "3"); attributes.put("homeDirectory", "/home/" + uid); attributes.put("gecos", "User " + uid); attributes.put("loginShell", "/bin/bash"); } if (ocs.contains("shadowAccount")) { attributes.put("shadowInactive", "0"); attributes.put("shadowLastChange", "15055"); attributes.put("shadowMax", "99999"); attributes.put("shadowWarning", "7"); } if (ocs.contains("inetOrgPerson")) { attributes.put("mail", "test@test.com"); attributes.put("l", "Berlin"); attributes.put("mobile", "+12345678910"); attributes.put("postalAddress", "a Street 123 17$12345 a City$NRW$Germany"); attributes.put("postalCode", "12345"); attributes.put("street", "a Street 123"); } return attributes; }