More methods definitions for CategoriesApi

Jens Pelzetter 2020-06-04 20:27:02 +02:00
parent 39a5da0c04
commit 6388ca7c62
1 changed files with 158 additions and 46 deletions

View File

@ -18,8 +18,23 @@
*/ */
package org.libreccm.api.admin.categorization; package org.libreccm.api.admin.categorization;
import org.libreccm.api.admin.categorization.dto.CategoryData;
import org.libreccm.api.dto.ListView;
import org.libreccm.core.CoreConstants;
import org.libreccm.security.AuthorizationRequired;
import org.libreccm.security.RequiresPrivilege;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.transaction.Transactional;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
/** /**
* *
@ -29,63 +44,160 @@ import javax.ws.rs.Path;
@Path("/categories") @Path("/categories")
public class CategoriesApi { public class CategoriesApi {
// GET (sub-)categories for path @Path("/{domain-identifier}/{path} @GET
@Path("/{domainIdentifier}/{path:^[\\w\\-/]+$}")
@Produces(MediaType.APPLICATION_JSON)
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public ListView<CategoryData> getCategories(
@PathParam("domainIdentifier") final String domainIdentifierParam,
@PathParam("path") final String categoryPathTokens
) {
throw new UnsupportedOperationException();
}
// POST add (sub-) category @Path("/{domain-identifier}/{path} @POST
@Path("/{domainIdentifier}/{path:^[\\w\\-/]+$}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public ListView<CategoryData> addNewSubCategory(
@PathParam("domainIdentifier") final String domainIdentifierParam,
@PathParam("path") final String categoryPathTokens,
final CategoryData categoryData
) {
throw new UnsupportedOperationException();
}
// GET categoryById @Path("/ID-{categoryId}") @GET
@Path("/{domainIdentifier}/{path:^[\\w\\-/]+$}")
@Produces(MediaType.APPLICATION_JSON)
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public CategoryData getCategory(
@PathParam("domainIdentifier") final String domainIdentifierParam,
@PathParam("path") final String categoryPathTokens
) {
throw new UnsupportedOperationException();
}
// GET categoryByUuid @Path("UUID-{categoryId}") @GET
@Path("/ID-{categoryId}")
@Produces(MediaType.APPLICATION_JSON)
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public CategoryData getCategory(
@PathParam("categoryId") final long categoryId
) {
throw new UnsupportedOperationException();
}
// GET category @Path("/{domain-identifier}/{path} @GET
@Path("/UUID-{categoryId}")
@Produces(MediaType.APPLICATION_JSON)
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public CategoryData getCategory(
@PathParam("categoryId") final String categoryUuid
) {
throw new UnsupportedOperationException();
}
// PUT update category @Path("/{domain-identifier}/{path} @PUT
@Path("/{domainIdentifier}/{path:^[\\w\\-/]+$}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public CategoryData updateCategory(
@PathParam("domainIdentifier") final String domainIdentifierParam,
@PathParam("path") final String categoryPathTokens,
final CategoryData categoryData
) {
throw new UnsupportedOperationException();
}
// PUT update category by id @Path("/ID-{categoryId}") @PUT
@Path("/ID-{categoryId}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public CategoryData updateCategory(
@PathParam("catgoryId") final long categoryIdParam,
final CategoryData categoryData
) {
throw new UnsupportedOperationException();
}
// PUT update category by uuid @Path("/UUID-{categoryUuid}") @PUT
@Path("/UUID-{categoryUuid}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public CategoryData updateCategory(
@PathParam("catgoryUid") final String categoryIdParam,
final CategoryData categoryData
) {
throw new UnsupportedOperationException();
}
// delete only for empty categories!!! @DELETE
// delete category @Path("/{domain-identifier}/{path} @Path("/{domainIdentifier}/{path:^[\\w\\-/]+$}")
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public CategoryData deleteCategory(
@PathParam("domainIdentifier") final String domainIdentifierParam,
@PathParam("path") final String categoryPathTokens
) {
// Delete only empty categories!!!
throw new UnsupportedOperationException();
}
// delete update category by id @Path("/ID-{categoryId}") // delete update category by id @Path("/ID-{categoryId}")
@DELETE
@Path("/ID-{categoryId}")
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public CategoryData deleteCategory(
@PathParam("categoryId") final long categoryIdParam
) {
// Delete only empty categories!!!
throw new UnsupportedOperationException();
}
// delete update category by uuid @Path("/UUID-{categoryId}") @DELETE
@Path("/UUID-{categoryUuid}")
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public CategoryData deleteCategory(
@PathParam("categoryId") final String categoryUuidParam
) {
// Delete only empty categories!!!
throw new UnsupportedOperationException();
}
// GET object in category @Path("/{domain-identifier}/{path}/objects // GET object in category @Path("/{domain-identifier}/{path}/objects
// GET object in category @Path("/ID-{categoryId} // GET object in category @Path("/ID-{categoryId}
// GET object in category @Path("/UUID-{categoryUuid} // GET object in category @Path("/UUID-{categoryUuid}
// PUT object in category @Path("/{domain-identifier}/{path}/objects/{objectIdentifier} // PUT object in category @Path("/{domain-identifier}/{path}/objects/{objectIdentifier}
// PUT object in category @Path("/ID-{categoryId}/{objectIdentifier} // PUT object in category @Path("/ID-{categoryId}/{objectIdentifier}
// PUT object in category @Path("/UUID-{categoryUuid}/{objectIdentifier} // PUT object in category @Path("/UUID-{categoryUuid}/{objectIdentifier}
// DELETE object in category @Path("/{domain-identifier}/{path}/objects/{objectIdentifier} // DELETE object in category @Path("/{domain-identifier}/{path}/objects/{objectIdentifier}
// DELETE object in category @Path("/ID-{categoryId}/{objectIdentifier} // DELETE object in category @Path("/ID-{categoryId}/{objectIdentifier}
// DELETE object in category @Path("/UUID-{categoryUuid}/{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}
} }