/** * Get the names of all the Workspaces. * <BR> * This is a shortcut call: These info could be retrieved using {@link #getWorkspaces getWorkspaces} * @return the list of the names of all Workspaces or an empty list. */ public List<String> getWorkspaceNames() { RESTWorkspaceList list = getWorkspaces(); if(list==null){ return Collections.emptyList(); } List<String> names = new ArrayList<String>(list.size()); for (RESTWorkspaceList.RESTShortWorkspace item : list) { names.add(item.getName()); } return names; }
public RESTShortWorkspace next() { return new RESTShortWorkspace(iter.next()); }
public PagingLoadResult<WorkspaceModel> getWorkspaces(int offset, int limit, String remoteURL, GSInstanceModel gsInstance) throws ApplicationException { List<WorkspaceModel> workspacesListDTO = new ArrayList<WorkspaceModel>(); workspacesListDTO.add(new WorkspaceModel("*")); if ((remoteURL != null) && !remoteURL.equals("*") && !remoteURL.contains("?")) { try { GeoServerRESTReader gsreader = new GeoServerRESTReader(remoteURL, gsInstance.getUsername(), gsInstance.getPassword()); RESTWorkspaceList workspaces = gsreader.getWorkspaces(); if ((workspaces != null) && !workspaces.isEmpty()) { Iterator<RESTShortWorkspace> wkIT = workspaces.iterator(); while (wkIT.hasNext()) { RESTShortWorkspace workspace = wkIT.next(); workspacesListDTO.add(new WorkspaceModel(workspace.getName())); } } } catch (MalformedURLException e) { logger.error(e.getLocalizedMessage(), e); throw new ApplicationException(e.getLocalizedMessage(), e); } } return new RpcPageLoadResult<WorkspaceModel>(workspacesListDTO, 0, workspacesListDTO.size()); }
public RESTShortWorkspace get(int index) { return new RESTShortWorkspace(wsList.get(index)); }
@CliCommand(value = "workspace default get", help = "Get the default workspace.") public String getDefault() throws Exception { String result = HTTPUtils.get(geoserver.getUrl() + "/rest/workspaces/default.xml", geoserver.getUser(), geoserver.getPassword()); Element elem = JDOMBuilder.buildElement(result); RESTWorkspaceList.RESTShortWorkspace w = new RESTWorkspaceList.RESTShortWorkspace(elem); return w.getName(); }