List of usage examples for org.apache.commons.collections ListUtils EMPTY_LIST
List EMPTY_LIST
To view the source code for org.apache.commons.collections ListUtils EMPTY_LIST.
Click Source Link
From source file:com.emergya.persistenceGeo.web.RestZoneController.java
/** * Get all zones with a specific parent/*from w w w .j a v a2 s . com*/ * * @param Parent id (a zone) * * @return all zones of the specified parent */ @RequestMapping(value = "/persistenceGeo/getZonesByParent", method = RequestMethod.GET) public @ResponseBody Map<String, Object> getZonesByParent( @RequestParam(value = "parentId", required = true) Long parentId) { Map<String, Object> result = new HashMap<String, Object>(); List<ZoneDto> zones = null; try { zones = (List<ZoneDto>) zoneAdminService.findByParent(parentId, true); result.put(SUCCESS, true); } catch (Exception e) { result.put(SUCCESS, false); } result.put(RESULTS, zones != null ? zones.size() : 0); result.put(ROOT, zones != null ? zones : ListUtils.EMPTY_LIST); return result; }
From source file:com.cybernostics.jsp2thymeleaf.api.elements.JspTagElementConverter.java
public JspTagElementConverter renamesAttribute(String oldName, String newName, Namespace namespace) { removesAttributes(oldName);// www . j ava 2 s. c o m addsAttributes((currentValues) -> currentValues.containsKey(oldName) ? Arrays.asList(new Attribute(newName, currentValues.get(oldName).toString(), namespace)) : ListUtils.EMPTY_LIST); return this; }
From source file:com.emergya.persistenceGeo.web.RestTreeFolderController.java
/** * Returns the children of a specific container node. The container type is * specified using the type parameter. The condition the returned nodes has * to meet is specified using the filter parameter. * //w ww .jav a 2 s . c o m * @param node * The node id * @param type * The type of the node (zone, folder) * @param filter * The condition the returned nodes has to meet * * @return JSON file with success */ @RequestMapping(value = "/persistenceGeo/tree/treeServiceMap", produces = { MediaType.APPLICATION_JSON_VALUE }) public @ResponseBody Map<String, Object> treeServiceMap( @RequestParam(value = "node", required = false) String nodeId, @RequestParam(value = "type", required = false) String type, @RequestParam(value = "filter", required = false) String filter) { Map<String, Object> result = new HashMap<String, Object>(); List<Treeable> nodes = new LinkedList<Treeable>(); try { nodes = treeService(nodeId, type, filter); result.put(SUCCESS, true); } catch (Exception e) { LOG.error(e); result.put(SUCCESS, false); } result.put(RESULTS, nodes != null ? nodes.size() : 0); result.put(ROOT, nodes != null ? nodes : ListUtils.EMPTY_LIST); return result; }
From source file:com.emergya.persistenceGeo.web.RestLayersAdminController.java
/** * This method loads layers.json related with a user * // www .ja v a2 s. c om * @param username * * @return JSON file with layers */ @SuppressWarnings("unchecked") @RequestMapping(value = "/persistenceGeo/loadLayers/{username}", method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE }) public @ResponseBody Map<String, Object> loadLayers(@PathVariable String username) { Map<String, Object> result = new HashMap<String, Object>(); List<LayerDto> layers = null; try { /* //TODO: Secure with logged user String username = ((UserDetails) SecurityContextHolder.getContext() .getAuthentication().getPrincipal()).getUsername(); */ if (username != null) { layers = new LinkedList<LayerDto>(); UserDto userDto = userAdminService.obtenerUsuario(username); if (userDto.getId() != null) { layers = layerAdminService.getLayersByUser(userDto.getId()); } else { layers = ListUtils.EMPTY_LIST; } for (LayerDto layer : layers) { if (layer.getId() != null && layer.getData() != null) { loadedLayers.put(layer.getId(), layer.getData()); layer.setData(null); layer.setServer_resource("rest/persistenceGeo/getLayerResource/" + layer.getId()); } } } result.put(SUCCESS, true); } catch (Exception e) { e.printStackTrace(); result.put(SUCCESS, false); } result.put(RESULTS, layers.size()); result.put(ROOT, layers); return result; }
From source file:com.emergya.persistenceGeo.web.RestUserAdminController.java
@SuppressWarnings("unchecked") @RequestMapping(value = "/persistenceGeo/getAllUsers", method = RequestMethod.GET) public @ResponseBody Map<String, Object> getAllUsers() { Map<String, Object> result = new HashMap<String, Object>(); //TODO: get user by authority group of user logged List<UserDto> users = (List<UserDto>) userAdminService.getAll(); result.put(RESULTS, users != null ? users.size() : 0); result.put(ROOT, users != null ? users : ListUtils.EMPTY_LIST); return result; }
From source file:com.emergya.persistenceGeo.web.RestUserAdminController.java
@RequestMapping(value = "/persistenceGeo/getUsersByGroup/{idGroup}", method = RequestMethod.GET) public @ResponseBody Map<String, Object> getUsersByGroup(@PathVariable String idGroup) { Map<String, Object> result = new HashMap<String, Object>(); List<UserDto> users = null; try {// ww w . j ava2s.co m //TODO: get user by authority group of user logged users = (List<UserDto>) userAdminService.getUsersByGroup(Long.decode(idGroup)); } catch (Exception e) { //Nothing } result.put(RESULTS, users != null ? users.size() : 0); result.put(ROOT, users != null ? users : ListUtils.EMPTY_LIST); return result; }
From source file:com.emergya.persistenceGeo.web.RestUserAdminController.java
@RequestMapping(value = "/persistenceGeo/getAllGroups", method = RequestMethod.GET) public @ResponseBody Map<String, Object> getAllGroups() { Map<String, Object> result = new HashMap<String, Object>(); List<AuthorityDto> groups = (List<AuthorityDto>) userAdminService.obtenerGruposUsuarios(); result.put(RESULTS, groups != null ? groups.size() : 0); result.put(ROOT, groups != null ? groups : ListUtils.EMPTY_LIST); return result; }
From source file:com.emergya.persistenceGeo.web.RestLayersAdminController.java
/** * This method loads layers.json related with a user * //from w w w . j av a 2s . com * @param username * * @return JSON file with layers */ @SuppressWarnings("unchecked") @RequestMapping(value = "/persistenceGeo/loadLayersByGroup/{groupId}", produces = { MediaType.APPLICATION_JSON_VALUE }) public @ResponseBody Map<String, Object> loadLayersByGroup(@PathVariable String groupId) { Map<String, Object> result = new HashMap<String, Object>(); List<LayerDto> layers = null; try { if (groupId != null && canAccess(Long.decode(groupId))) { layers = layerAdminService.getLayersByAuthority(Long.decode(groupId)); } else { layers = ListUtils.EMPTY_LIST; } for (LayerDto layer : layers) { if (layer.getId() != null && layer.getData() != null) { loadedLayers.put(layer.getId(), layer.getData()); layer.setData(null); layer.setServer_resource("rest/persistenceGeo/getLayerResource/" + layer.getId()); } } result.put(SUCCESS, true); } catch (Exception e) { e.printStackTrace(); result.put(SUCCESS, false); } result.put(RESULTS, layers.size()); result.put(ROOT, layers); return result; }
From source file:net.mikaboshi.intra_mart.tools.log_stats.formatter.TemplateFileReportFormatter.java
/** * ??/*from w w w.j av a 2 s . com*/ * @param report * @param rootMap */ private void setLogFiles(Report report, Map<String, Object> rootMap) { Map<String, Object> logFiles = new HashMap<String, Object>(); rootMap.put("logFiles", logFiles); logFiles.put("requestLogFiles", report.getRequestLogFiles() != null ? report.getRequestLogFiles() : ListUtils.EMPTY_LIST); logFiles.put("transitionLogFiles", report.getTransitionLogFiles() != null ? report.getTransitionLogFiles() : ListUtils.EMPTY_LIST); logFiles.put("exceptionLogFiles", report.getExceptionLogFiles() != null ? report.getExceptionLogFiles() : ListUtils.EMPTY_LIST); logFiles.put("transitionLogOnly", CollectionUtils.isEmpty(report.getRequestLogFiles())); }
From source file:com.emergya.persistenceGeo.web.RestFoldersAdminController.java
/** * Returns all the folders of a specific zone and optionaly with a specific * parent folder.//from w w w .j a v a 2s . com * * @param zone * Zone the folder belongs to * @param parent * Folder parent id * * @return JSON file with success */ @RequestMapping(value = "/persistenceGeo/loadFoldersByZone", produces = { MediaType.APPLICATION_JSON_VALUE }) public @ResponseBody Map<String, Object> loadFoldersByZone( @RequestParam(value = "zone", required = true) String zoneId, @RequestParam(value = "parent", required = false) String parentId) { Map<String, Object> result = new HashMap<String, Object>(); List<FolderDto> folders = null; try { if (parentId == null) { folders = (List<FolderDto>) foldersAdminService.findByZone(new Long(zoneId), Boolean.TRUE); } else { folders = (List<FolderDto>) foldersAdminService.findByZone(new Long(zoneId), new Long(parentId), Boolean.TRUE); } result.put(SUCCESS, true); } catch (Exception e) { result.put(SUCCESS, false); } result.put(RESULTS, folders != null ? folders.size() : 0); result.put(ROOT, folders != null ? folders : ListUtils.EMPTY_LIST); return result; }