public NamespaceInfo getNamespaceByURI(String uri) { NamespaceInfo result = namespaces.findFirst(NamespaceInfo.class, ns -> uri.equals(ns.getURI())); return wrapInModificationProxy(result, NamespaceInfo.class); }
public StyleInfo getStyleByName(String name) { StyleInfo match = styles.findByName(new NameImpl(null, name), StyleInfo.class); if (match == null) { match = styles.findFirst(StyleInfo.class, s -> name.equals(s.getName())); } return wrapInModificationProxy(match, StyleInfo.class); }
public <T extends StoreInfo> T getStoreByName( WorkspaceInfo workspace, String name, Class<T> clazz) { T result; if (workspace == ANY_WORKSPACE) { result = stores.findFirst(clazz, s -> name.equals(s.getName())); } else { Name qname = new NameImpl((workspace != null) ? workspace.getId() : null, name); result = stores.findByName(qname, clazz); } return wrapInModificationProxy(result, clazz); }
public <T extends ResourceInfo> T getResourceByName( NamespaceInfo namespace, String name, Class<T> clazz) { T result; if (namespace == ANY_NAMESPACE) { result = resources.findFirst(clazz, r -> name.equals(r.getName())); } else { Name qname = new NameImpl(namespace != null ? namespace.getId() : null, name); result = resources.findByName(qname, clazz); } return wrapInModificationProxy(result, clazz); }
@Override public LayerGroupInfo getLayerGroupByName(WorkspaceInfo workspace, String name) { LayerGroupInfo match; if (workspace == NO_WORKSPACE) { match = layerGroups.findByName(new NameImpl(null, name), LayerGroupInfo.class); } else if (ANY_WORKSPACE == workspace) { match = layerGroups.findFirst(LayerGroupInfo.class, lg -> name.equals(lg.getName())); } else { match = layerGroups.findByName( new NameImpl(workspace.getId(), name), LayerGroupInfo.class); } return wrapInModificationProxy(match, LayerGroupInfo.class); }
public <T extends ResourceInfo> T getResourceByStore( StoreInfo store, String name, Class<T> clazz) { T resource = null; NamespaceInfo ns = null; if (store.getWorkspace() != null && store.getWorkspace().getName() != null && (ns = getNamespaceByPrefix(store.getWorkspace().getName())) != null) { resource = resources.findByName(new NameImpl(ns.getId(), name), clazz); if (resource != null && !(store.equals(resource.getStore()))) { return null; } } else { // should not happen, but some broken test code sets up namespaces without equivalent // workspaces // or stores without workspaces resource = resources.findFirst( clazz, r -> name.equals(r.getName()) && store.equals(r.getStore())); } return wrapInModificationProxy(resource, clazz); }