/** * Helper method that just returns the current local workspace if available. * * @return current local workspace or NULL */ private WorkspaceInfo getLocalWorkspace() { return LocalWorkspace.get(); }
@Override public void collect(Map<String, Object> storage) { WorkspaceInfo wi = LocalWorkspace.get(); storage.put(KEY, wi); }
public boolean hideStyle(StyleInfo style) { if (style.getWorkspace() == null) { // global style, hide it if a local workspace style shars the same name, ie overrides it if (LocalWorkspace.get() != null) { if (catalog.getStyleByName(LocalWorkspace.get(), style.getName()) != null) { return true; } } return false; } return hideWorkspace(style.getWorkspace()); }
private Filter inWorkspace() { WorkspaceInfo localWS = LocalWorkspace.get(); if (localWS == null) return Predicates.acceptAll(); return Predicates.equal("workspace.id", localWS.getId()); }
@Override public LayerInfo getLayerByName(Name name) { if (LocalWorkspace.get() != null) { // if local workspace active drop the prefix return getLayerByName(name.getLocalPart()); } else { return super.getLayerByName(name); } }
private void testApply() { transfer.apply(); // check all thread locals have been applied to the current thread assertSame(request, Dispatcher.REQUEST.get()); assertSame(myState, AdminRequest.get()); assertSame(layer, LocalPublished.get()); assertSame(ws, LocalWorkspace.get()); assertSame( auth, SecurityContextHolder.getContext().getAuthentication()); }
@Test public void testInitRequest_LayerGroupExists() { this.request.setContext("LayerGroup1/ows"); this.callback.init(this.request); assertNull(LocalWorkspace.get()); assertNotNull(LocalPublished.get()); }
@Test public void testInitRequest_LayerExists() { this.request.setContext("cite/BasicPolygons/ows"); this.callback.init(this.request); assertNotNull(LocalWorkspace.get()); assertNotNull(LocalPublished.get()); }
@Test public void testInitRequest_LayerMissing() { this.request.setContext("cite/MissingLayer/ows"); this.callback.init(this.request); assertNotNull(LocalWorkspace.get()); assertNull(LocalPublished.get()); }
@Test public void testInitRequest_WorkspacedLayerGroupMissing() { this.request.setContext("cite/lg/ows"); this.callback.init(this.request); assertNotNull(LocalWorkspace.get()); assertNull(LocalPublished.get()); }
@Test public void testInitRequest_WorkspaceExists() { this.request.setContext("cite/ows"); this.callback.init(this.request); assertNotNull(LocalWorkspace.get()); assertNull(LocalPublished.get()); }
@Test public void testInitRequest_LayerMissingInWorkspace() { this.request.setContext("cite/Fifteen/ows"); this.callback.init(this.request); assertNotNull(LocalWorkspace.get()); assertNull(LocalPublished.get()); }