List of usage examples for java.util Collections EMPTY_LIST
List EMPTY_LIST
To view the source code for java.util Collections EMPTY_LIST.
Click Source Link
From source file:net.netheos.pcsapi.providers.StorageProviderFactory.java
/** * junit factory for injection of storage object into test constructors. * * @return collection of storage providers * @throws IOException/*from w w w. j a v a 2s. c om*/ */ public static Collection<Object[]> storageProviderFactory() throws IOException { String path = System.getProperty("pcsapiRepositoryDir"); if (path == null) { path = System.getenv("PCS_API_REPOSITORY_DIR"); } if (path == null) { path = "../repositories"; } File repository = new File(path); String providers = System.getProperty("pcsapiProviders"); boolean allProviders = false; if (providers == null) { allProviders = true; } File appRepoFile = new File(repository, "app_info_data.txt"); if (!appRepoFile.exists()) { LOGGER.warn("No app info file found for functional tests: {}" + " Set PCS_API_REPOSITORY_DIR environment variable," + " or set pcsapiRepositoryDir system property", appRepoFile); LOGGER.warn("No functional test will be run"); return Collections.EMPTY_LIST; // list of providers to be tested } appRepo = new AppInfoFileRepository(appRepoFile); File credRepoFile = new File(repository, "user_credentials_data.txt"); credRepo = new UserCredentialsFileRepository(credRepoFile); Collection<Object[]> values = new ArrayList<Object[]>(); for (String providerName : StorageFacade.getRegisteredProviders()) { if (allProviders || providers.contains(providerName)) { HttpClient httpClient = buildDedicatedHttpClient(providerName); addProvider(values, providerName, httpClient); } } return values; }
From source file:cn.mypandora.util.MyExcelUtil.java
/** * ?Excel List<Map<String K,String V>>? * * @param excelFile ?/* www . ja v a 2s . c o m*/ * @param fieldNames Key * @param sheetName sheet?? * @return */ public static List<Map<String, String>> readExcelToMap(InputStream excelFile, String fieldNames, String... sheetName) { List<Map<String, String>> list = Collections.EMPTY_LIST; try { Workbook workbook = WorkbookFactory.create(excelFile); list = execRead(workbook, fieldNames, sheetName); } catch (Exception e) { logger.error("?:" + e); } return list; }
From source file:com.exxonmobile.ace.hybris.core.actions.replenishment.CloneCartAction.java
@Override public void executeAction(final ReplenishmentProcessModel process) throws Exception { final CartToOrderCronJobModel cartToOrderCronJob = process.getCartToOrderCronJob(); final CartModel cronJobCart = cartToOrderCronJob.getCart(); getUserService().setCurrentUser(cronJobCart.getUser()); final CartModel clone = getCartService().clone(getTypeService().getComposedTypeForClass(CartModel.class), getTypeService().getComposedTypeForClass(CartEntryModel.class), cronJobCart, getGuidKeyGenerator().generate().toString()); clone.setPaymentAddress(cartToOrderCronJob.getPaymentAddress()); clone.setDeliveryAddress(cartToOrderCronJob.getDeliveryAddress()); clone.setPaymentInfo(cartToOrderCronJob.getPaymentInfo()); clone.setStatus(OrderStatus.CREATED); clone.setAllPromotionResults(Collections.EMPTY_SET); clone.setPaymentTransactions(Collections.EMPTY_LIST); clone.setPermissionResults(Collections.EMPTY_LIST); clone.setGuid(getGuidKeyGenerator().generate().toString()); this.modelService.save(clone); processParameterHelper.setProcessParameter(process, "cart", clone); }
From source file:mitm.djigzo.web.common.security.Authorizer.java
private Collection getPrincipalAuthorities() { Authentication currentUser = null;//from ww w .j a v a 2s . c om currentUser = SecurityContextHolder.getContext().getAuthentication(); if (null == currentUser) { return Collections.EMPTY_LIST; } if ((null == currentUser.getAuthorities()) || (currentUser.getAuthorities().length < 1)) { return Collections.EMPTY_LIST; } Collection granted = Arrays.asList(currentUser.getAuthorities()); return granted; }
From source file:net.sourceforge.fenixedu.applicationTier.Servico.manager.organizationalStructureManagement.MergeExternalUnits.java
@Atomic public static void run(Unit fromUnit, Unit destinationUnit, Boolean sendMail) { check(RolePredicates.MANAGER_PREDICATE); if (fromUnit != null && destinationUnit != null) { String fromUnitName = fromUnit.getName(); String fromUnitID = fromUnit.getExternalId(); Unit.mergeExternalUnits(fromUnit, destinationUnit); if (sendMail != null && sendMail.booleanValue()) { String emails = FenixConfigurationManager.getConfiguration().getMergeUnitsEmails(); if (!StringUtils.isEmpty(emails)) { Set<String> resultEmails = new HashSet<String>(); String[] splitedEmails = emails.split(","); for (String email : splitedEmails) { resultEmails.add(email.trim()); }/*w w w . j av a 2s .c o m*/ // Foi efectuado um merge de unidades externas por {0}[{1}] // : Unidade Origem -> {2} [{3}] Unidade Destino -> {4}[{5}] final Person person = AccessControl.getPerson(); final String subject = BundleUtil.getString(Bundle.GLOBAL, "mergeExternalUnits.email.subject"); final String body = BundleUtil.getString(Bundle.GLOBAL, "mergeExternalUnits.email.body", new String[] { person.getName(), person.getUsername(), fromUnitName, fromUnitID, destinationUnit.getName(), destinationUnit.getExternalId().toString() }); SystemSender systemSender = Bennu.getInstance().getSystemSender(); new Message(systemSender, systemSender.getConcreteReplyTos(), Collections.EMPTY_LIST, subject, body, resultEmails); } } } }
From source file:org.apigw.authserver.x509.CertifiedClientAuthenticationUserDetailsServiceTest.java
@SuppressWarnings("unchecked") @Test// www. jav a 2 s . c om public void loadUserDetailsByIssuerDnAndSubjectDn() { String subjectDN = "CN=dianne,OU=Spring Security,O=Spring Framework,C=AU"; String issuerDN = "CN=Spring Security Test CA,OU=Spring Security,O=Spring Framework,L=Glasgow,ST=Scotland,C=GB"; CertifiedClient client = new CertifiedClient(); client.setClientId("clientA"); client.setCertifiedClientRoles(Collections.EMPTY_LIST); X509ClientPrincipal principal = new X509ClientPrincipal(subjectDN, issuerDN); when(token.getPrincipal()).thenReturn(principal); when(token.getName()).thenReturn("clientA"); when(service.loadClientByX509Cert(issuerDN, subjectDN)).thenReturn(client); UserDetails user = uut.loadUserDetails(token); assertEquals(user.getUsername(), client.getClientId()); verify(service).loadClientByX509Cert(issuerDN, subjectDN); }
From source file:com.appdynamicspilot.persistence.CartPersistence.java
/** * Get all the items from cart based on user * * @param userId// ww w . jav a 2 s . c om * @return List of items */ public List<Item> getAllItemsByUser(Long userId) { Query q = getEntityManager().createQuery("SELECT c FROM Cart c where c.user.id = :userid"); q.setParameter("userid", userId); List<Cart> carts = q.getResultList(); if ((carts == null) || (carts.size() == 0)) { return Collections.EMPTY_LIST; } Cart cart = carts.get(0); return cart.getItems(); }
From source file:jef.database.query.function.NoArgSQLFunction.java
@SuppressWarnings("unchecked") public Expression renderExpression(List<Expression> args) { if (args.size() > 0) { throw new PersistenceException("function takes no arguments: " + name); }// ww w. jav a 2s . c o m Function func = new Function(name); if (hasParenthesesIfNoArguments) { func.setParameters(new ExpressionList(Collections.EMPTY_LIST)); } return func; }
From source file:org.maodian.flyingcat.im.repository.AccountRepositoryImpl.java
@Override public Collection<SimpleUser> getUnreadSubscription(String username) { String kPendingIn = Account.CONTACTS + "." + SimpleUser.PENDING_IN; Query query = Query.query(Criteria.where(Account.USERNAME).is(username).and(kPendingIn).is(true)); query.fields().include(Account.CONTACTS + ".$").exclude("_id"); Account account = getMongoTemplate().findOne(query, Account.class); return account == null ? Collections.EMPTY_LIST : account.getContactList(); }
From source file:ams.fwk.customtag.AmsUploadTag.java
/** * @return int/*from www. j av a 2 s. co m*/ * @throws JspException */ public int doEndTag() throws JspException { try { List uploads = Collections.EMPTY_LIST; if (fileSeqNo != null && fileSeqNo.trim().length() > 0) { uploads = getUploads(); } JspWriter out = pageContext.getOut(); out.print(listOpen); int count = 0; for (Iterator all = uploads.iterator(); all.hasNext();) { Map each = (Map) all.next(); if ("N/A".equals(typeId) || typeId.equals(each.get("TYPE_ID"))) { String temp = StringUtils.replace(listItem, "$filename$", (String) each.get("FILE_NAME")); temp = StringUtils.replace(temp, "$max$", "" + max); temp = StringUtils.replace(temp, "$typeId$", typeId); temp = StringUtils.replace(temp, "$fileId$", (String) each.get("FILE_ID")); temp = StringUtils.replace(temp, "$filepath$", StringEscapeUtils.escapeJavaScript((String) each.get("FILE_PATH"))); out.print(temp); count++; } } if (max > count) { String requiredTemp = ""; String temp = ""; if ("Y".equals(isRequired)) { requiredTemp = StringUtils.replace(requiredTag, "$requiredMsg$", StringUtils.isEmpty(requiredMsg) ? "" : requiredMsg); temp = StringUtils.replace(fileItem, "$requiredTag$", "" + requiredTemp); } else { temp = StringUtils.replace(fileItem, "$requiredTag$", "" + ""); } temp = StringUtils.replace(temp, "$max$", "" + max); temp = StringUtils.replace(temp, "$typeId$", typeId); if ("Y".equals(eachSeqNoFlag)) { temp += StringUtils.replace(hiddenTag, "$id$", "eachSeqNoFlag"); temp = StringUtils.replace(temp, "$name$", "eachSeqNoFlag"); temp = StringUtils.replace(temp, "$value$", "" + "Y"); } out.print(temp); } out.print(listClose); return EVAL_PAGE; } catch (IOException e) { throw new JspException(e); } finally { fileSeqNo = null; typeId = "N/A"; max = 1; } }