public List<Map<String,Object>> getTreeMinInfoByHostId (String hostId) throws DotRuntimeException, PortalException, SystemException, DotDataException, DotSecurityException {
UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI();
WebContext ctx = WebContextFactory.get();
User user = userWebAPI.getLoggedInUser(ctx.getHttpServletRequest());
FolderAPI folderAPI = APILocator.getFolderAPI();
Host newHost = new Host();
List<Host> hosts = new ArrayList<Host>();
Role[] roles = new Role[]{};
try {
roles = com.dotmarketing.business.APILocator.getRoleAPI().loadRolesForUser(user.getUserId()).toArray(new Role[0]);
} catch (DotDataException e1) {
Logger.error(BrowserAjax.class,e1.getMessage(),e1);
}
List<Map<String,Object>> toReturn = new ArrayList<Map<String,Object>>();
if(UtilMethods.isSet(hostId)&& hostId.equalsIgnoreCase("fullTree")) {
hosts = hostAPI.findAll(user, false);
} else if(InodeUtils.isSet(hostId)) {
newHost = hostAPI.find(hostId, user, false);
hosts.add(newHost);
} else {
newHost = hostWebAPI.getCurrentHost(ctx.getHttpServletRequest());
hosts.add(newHost);
}
Collections.sort(hosts, new HostNameComparator()); // DOTCMS JIRA - 4354
for (Host host : hosts) {
if(host.isSystemHost())
continue;
if(host.isArchived()==false){
String currentPath = host.getHostname();
Map<String,Object> hostMap = new HashMap<String, Object>();
hostMap.put("type", "host");
hostMap.put("name", host.getHostname());
hostMap.put("id", host.getIdentifier());
hostMap.put("fullPath", currentPath);
hostMap.put("absolutePath", currentPath);
List<Map<String, Object>> children = new ArrayList<Map<String,Object>>();
List<Folder> subFolders = folderAPI.findSubFolders(host,user,false);
for (Folder f : subFolders) {
List permissions = new ArrayList();
try {
permissions = permissionAPI.getPermissionIdsFromRoles(f, roles, user);