From 7f10899d45e468bb4de665289d00f607ca64aabe Mon Sep 17 00:00:00 2001 From: Jens Pelzetter Date: Wed, 3 Jun 2020 20:20:45 +0200 Subject: [PATCH] Prepared API for domains and categories --- .../java/org/libreccm/api/admin/AdminApi.java | 18 ++-- .../admin/categorization/CategoriesApi.java | 91 +++++++++++++++++++ .../api/admin/categorization/DomainsApi.java | 48 ++++++++++ 3 files changed, 150 insertions(+), 7 deletions(-) create mode 100644 ccm-core/src/main/java/org/libreccm/api/admin/categorization/CategoriesApi.java create mode 100644 ccm-core/src/main/java/org/libreccm/api/admin/categorization/DomainsApi.java diff --git a/ccm-core/src/main/java/org/libreccm/api/admin/AdminApi.java b/ccm-core/src/main/java/org/libreccm/api/admin/AdminApi.java index 4c346312a..a1a19b301 100644 --- a/ccm-core/src/main/java/org/libreccm/api/admin/AdminApi.java +++ b/ccm-core/src/main/java/org/libreccm/api/admin/AdminApi.java @@ -18,6 +18,8 @@ import javax.ws.rs.core.Application; import org.libreccm.api.CorsFilter; import org.libreccm.api.DefaultResponseHeaders; import org.libreccm.api.PreflightRequestFilter; +import org.libreccm.api.admin.categorization.CategoriesApi; +import org.libreccm.api.admin.categorization.DomainsApi; /** * @@ -29,19 +31,21 @@ public class AdminApi extends Application { @Override public Set> getClasses() { final Set> classes = new HashSet<>(); - + classes.add(CorsFilter.class); classes.add(DefaultResponseHeaders.class); classes.add(PreflightRequestFilter.class); - + + // Categorization API + classes.add(DomainsApi.class); + classes.add(CategoriesApi.class); + + // Security API classes.add(GroupsApi.class); classes.add(RolesApi.class); classes.add(UsersApi.class); - - + return classes; } - - - + } diff --git a/ccm-core/src/main/java/org/libreccm/api/admin/categorization/CategoriesApi.java b/ccm-core/src/main/java/org/libreccm/api/admin/categorization/CategoriesApi.java new file mode 100644 index 000000000..ef2dfd324 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/api/admin/categorization/CategoriesApi.java @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2020 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.libreccm.api.admin.categorization; + +import javax.enterprise.context.RequestScoped; +import javax.ws.rs.Path; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +@Path("/categories") +public class CategoriesApi { + + // GET (sub-)categories for path @Path("/{domain-identifier}/{path} + + // POST add (sub-) category @Path("/{domain-identifier}/{path} + + // GET categoryById @Path("/ID-{categoryId}") + + // GET categoryByUuid @Path("UUID-{categoryId}") + + // GET category @Path("/{domain-identifier}/{path} + + // PUT update category @Path("/{domain-identifier}/{path} + + // PUT update category by id @Path("/ID-{categoryId}") + + // PUT update category by uuid @Path("/UUID-{categoryUuid}") + + // delete only for empty categories!!! + // delete category @Path("/{domain-identifier}/{path} + + // delete update category by id @Path("/ID-{categoryId}") + + // delete update category by uuid @Path("/UUID-{categoryId}") + + + // GET object in category @Path("/{domain-identifier}/{path}/objects + + // GET object in category @Path("/ID-{categoryId} + + // GET object in category @Path("/UUID-{categoryUuid} + + // PUT object in category @Path("/{domain-identifier}/{path}/objects/{objectIdentifier} + + // PUT object in category @Path("/ID-{categoryId}/{objectIdentifier} + + // PUT object in category @Path("/UUID-{categoryUuid}/{objectIdentifier} + + // DELETE object in category @Path("/{domain-identifier}/{path}/objects/{objectIdentifier} + + // DELETE object in category @Path("/ID-{categoryId}/{objectIdentifier} + + // DELETE object in category @Path("/UUID-{categoryUuid}/{objectIdentifier} + + // GET subcategory in category @Path("/{domain-identifier}/{path}/subcategories + + // GET subcategory in category @Path("/ID-{categoryId} + + // GET subcategory in category @Path("/UUID-{categoryUuid} + + // PUT subcategory in category @Path("/{domain-identifier}/{path}/subcategories/{subcategoryIdentifier} + + // PUT subcategory in category @Path("/ID-{categoryId}/{subcategoryIdentifier} + + // PUT subcategory in category @Path("/UUID-{categoryUuid}/{subcategoryIdentifier} + + // DELETE subcategory in category @Path("/{domain-identifier}/{path}/subcategories/{subcategoryIdentifier} + + // DELETE subcategory in category @Path("/ID-{categoryId}/{subcategoryIdentifier} + + // DELETE subcategory in category @Path("/UUID-{categoryUuid}/{subcategoryIdentifier} +} diff --git a/ccm-core/src/main/java/org/libreccm/api/admin/categorization/DomainsApi.java b/ccm-core/src/main/java/org/libreccm/api/admin/categorization/DomainsApi.java new file mode 100644 index 000000000..77651dc8c --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/api/admin/categorization/DomainsApi.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2020 LibreCCM Foundation. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package org.libreccm.api.admin.categorization; + +import javax.enterprise.context.RequestScoped; +import javax.ws.rs.Path; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +@Path("/domains") +public class DomainsApi { + + // GET Domains @Path("/") + + // GET Domain @Path("/domain-identifier") + + // POST @Path("/") create new + + // PUT Domain @Path("/domain-identifier") + + + // DELETE Domain @Path("/domain-identifier") + + // GET owners @Path("/domain-identifier/owners") + + // PUT Add owner @Path("/domain-identifier/owners/owner-identifier") + + // DELETE Remove owner @Path("/domain-identifier/owners/owner-identifier") +}