List of usage examples for java.util Map putAll
void putAll(Map<? extends K, ? extends V> m);
From source file:com.astamuse.asta4d.web.dispatch.RedirectUtil.java
public static void redirectToUrlWithSavedFlashScopeData(HttpServletResponse response, int status, String url) { // regulate status if (status == HttpURLConnection.HTTP_MOVED_PERM || status == HttpURLConnection.HTTP_MOVED_TEMP) { ////from www . j av a 2 s . c om } else { status = HttpURLConnection.HTTP_MOVED_TEMP; } // check illegal url if (url.indexOf('\n') >= 0 || url.indexOf('\r') >= 0) { throw new RuntimeException("illegal redirct url:" + url); } // before redirect task Map<String, RedirectInterceptor> interceptorMap = Context.getCurrentThreadContext() .getData(RedirectInterceptorMapKey); if (interceptorMap != null) { for (RedirectInterceptor interceptor : interceptorMap.values()) { interceptor.beforeRedirect(); } addFlashScopeData(RedirectInterceptorMapKey, interceptorMap); } // create flash data map Map<String, Object> dataMap = new HashMap<String, Object>(); WebApplicationContext context = Context.getCurrentThreadContext(); List<Map<String, Object>> dataList = context.getData(FlashScopeDataListKey); if (dataList != null) { for (Map<String, Object> map : dataList) { dataMap.putAll(map); } } // save flash data map if (!dataMap.isEmpty()) { String flashScopeId = SecureIdGenerator.createEncryptedURLSafeId(); WebApplicationConfiguration.getWebApplicationConfiguration().getExpirableDataManager().put(flashScopeId, dataMap, DATA_EXPIRE_TIME_MILLI_SECONDS); // create target url if (url.contains("?")) { url = url + '&' + KEY_FLASH_SCOPE_ID + '=' + flashScopeId; } else { url = url + '?' + KEY_FLASH_SCOPE_ID + '=' + flashScopeId; } } // do redirection response.setStatus(status); response.addHeader("Location", url); }
From source file:adalid.commons.util.FilUtils.java
public static Map<String, File> directoriesMap(File file) { Map<String, File> map = new LinkedHashMap<>(); if (isVisibleDirectory(file)) { map.put(file.getPath(), file);//from ww w . j a v a 2 s. co m for (File sub : file.listFiles(visibleDirectoryFilter())) { map.putAll(directoriesMap(sub)); } } return map; }
From source file:adalid.commons.util.FilUtils.java
public static Map<String, File> directoriesMap(File directory, String[] pathnames, File top) { Map<String, File> map = new LinkedHashMap<>(); File file;//from ww w .ja va 2s. co m for (String pathname : pathnames) { file = new File(directory, pathname); if (isVisibleDirectory(top)) { map.putAll(parentDirectoriesMap(file, top)); } map.putAll(directoriesMap(file)); } return map; }
From source file:com.playersun.jbf.common.utils.reflex.Reflections.java
public static Map<String, Object> bean2Map(Object... objects) { Map<String, Object> map = new HashMap<String, Object>(); for (Object object : objects) { if (object == null) continue; if (object instanceof Map) { map.putAll((Map) object); } else {/*from w ww .ja v a 2s . c om*/ Validate.notNull(object, "object can't be null"); for (Class<?> superClass = object.getClass(); superClass != Object.class; superClass = superClass .getSuperclass()) { try { for (Field field : superClass.getDeclaredFields()) { makeAccessible(field); if (field.get(object) != null) { map.put(field.getName(), field.get(object)); } } } catch (Exception e) {//NOSONAR // Field??,? continue;// new add } } } } return map; }
From source file:org.zkoss.spring.security.SecurityUtil.java
private static void initializeIfRequired() { if (_applicationContext != null) { return;//from www . j av a 2 s . com } _applicationContext = SpringUtil.getApplicationContext(); Map map = new HashMap(); ApplicationContext context = _applicationContext; while (context != null) { map.putAll(context.getBeansOfType(AclService.class)); context = context.getParent(); } if (map.size() != 1) { throw new UiException( "Found incorrect number of AclService instances in application context - you must have only have one!"); } _aclService = (AclService) map.values().iterator().next(); map = _applicationContext.getBeansOfType(SidRetrievalStrategy.class); if (map.size() == 0) { _sidRetrievalStrategy = new SidRetrievalStrategyImpl(); } else if (map.size() == 1) { _sidRetrievalStrategy = (SidRetrievalStrategy) map.values().iterator().next(); } else { throw new UiException("Found incorrect number of SidRetrievalStrategy instances in application " + "context - you must have only have one!"); } map = _applicationContext.getBeansOfType(ObjectIdentityRetrievalStrategy.class); if (map.size() == 0) { _objectIdentityRetrievalStrategy = new ObjectIdentityRetrievalStrategyImpl(); } else if (map.size() == 1) { _objectIdentityRetrievalStrategy = (ObjectIdentityRetrievalStrategy) map.values().iterator().next(); } else { throw new UiException("Found incorrect number of ObjectIdentityRetrievalStrategy instances in " + "application context - you must have only have one!"); } map = _applicationContext.getBeansOfType(PermissionFactory.class); if (map.size() == 0) { permissionFactory = new DefaultPermissionFactory(); } else if (map.size() == 1) { permissionFactory = (PermissionFactory) map.values().iterator().next(); } else { throw new UiException("Found incorrect number of PermissionFactory instances in " + "application context - you must have only have one!"); } }
From source file:com.erudika.para.core.ParaObjectUtils.java
/** * Returns a map of all registered types. * @param app the app to search for custom types * @return a map of plural - singular form of type names *///from w w w . jav a2s . com public static Map<String, String> getAllTypes(App app) { Map<String, String> map = new HashMap<String, String>(getCoreTypes()); if (app != null) { map.putAll(app.getDatatypes()); } return map; }
From source file:com.github.vseguip.sweet.contacts.SweetConflictResolveActivity.java
/** * Retreive the list of conflicting contacts to avoid having to serialize * within the intent//w w w. j a v a 2 s .com * * @param _conflictingLocalContacts * Map of local contacts * @param _conflictingSugarContacts * Map of remote contacts * * */ public static synchronized void retreiveConflicts(Map<String, ISweetContact> localContacts, Map<String, ISweetContact> sugarContacts) { localContacts.putAll(conflictingLocalContacts); sugarContacts.putAll(conflictingSugarContacts); }
From source file:com.epam.reportportal.jbehave.JBehaveUtils.java
private static Map<String, String> metasToMap(Meta... metas) { if (null != metas && metas.length > 0) { Map<String, String> metaMap = new HashMap<String, String>(); for (Meta meta : metas) { metaMap.putAll(metaToMap(meta)); }//from w w w. j ava 2s. c om return metaMap; } else { return Collections.emptyMap(); } }
From source file:com.brighttag.trident.kairos.KairosState.java
private static Map<String, String> toTags(List<Object> objs) { Map<String, String> tags = Maps.newHashMap(); for (Object o : objs) { if (o instanceof Map) { @SuppressWarnings("unchecked") Map<String, String> m = (Map<String, String>) o; tags.putAll(m); }/* w w w . j ava 2 s .c o m*/ } return tags; }
From source file:com.alibaba.jstorm.ui.UIUtils.java
public static ColumnData getConnectionColumnData(Map<String, String> paramMap, String connectionName) { ColumnData columnData = new ColumnData(); LinkData linkData = new LinkData(); columnData.addLinkData(linkData);//from w ww. j ava 2s. com linkData.setUrl(UIDef.LINK_WINDOW_TABLE); linkData.setText(connectionName); Map<String, String> linkDataParam = new HashMap<String, String>(); linkData.setParamMap(linkDataParam); linkDataParam.putAll(paramMap); linkDataParam.remove(UIDef.POS); try { int pos = connectionName.indexOf(":"); if (pos > 0) { String source = connectionName.substring(0, pos); linkDataParam.put(UIDef.HOST, source); } } catch (Exception e) { } return columnData; }