diff --git a/src/main/java/org/ligoj/app/plugin/id/resource/CompanyResource.java b/src/main/java/org/ligoj/app/plugin/id/resource/CompanyResource.java index 17094ae..885f3be 100644 --- a/src/main/java/org/ligoj/app/plugin/id/resource/CompanyResource.java +++ b/src/main/java/org/ligoj/app/plugin/id/resource/CompanyResource.java @@ -5,6 +5,7 @@ import jakarta.transaction.Transactional; import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.Context; @@ -137,6 +138,24 @@ public TableItem findAll(@Context final UriInfo uriInfo) { }); } + /** + * Create the given company. Concrete re-declaration of the inherited + * {@code @POST create(V)} from {@link AbstractContainerResource} so JAX-RS + * registers the route on the concrete bean — the parent annotation isn't + * picked up because of type erasure on the generic parameter V. + * + *

Produces {@code text/plain} (not the class-level JSON default): the + * returned identifier is a raw string, not a JSON document, so clients can + * read it via {@code response.text()} instead of failing to parse an + * unquoted scalar as JSON. + */ + @POST + @Produces(MediaType.TEXT_PLAIN) + @Override + public String create(final ContainerEditionVo container) { + return super.create(container); + } + @Override protected void checkForDeletion(final ContainerOrg container) { super.checkForDeletion(container); diff --git a/src/main/java/org/ligoj/app/plugin/id/resource/GroupResource.java b/src/main/java/org/ligoj/app/plugin/id/resource/GroupResource.java index 188f9ad..c324181 100644 --- a/src/main/java/org/ligoj/app/plugin/id/resource/GroupResource.java +++ b/src/main/java/org/ligoj/app/plugin/id/resource/GroupResource.java @@ -113,6 +113,24 @@ public boolean exists(@PathParam(GROUP_ATTRIBUTE) final String group) { return findById(group) != null; } + /** + * Create the given group. Concrete re-declaration of the inherited + * {@code @POST create(V)} from {@link AbstractContainerResource} so JAX-RS + * registers the route on the concrete bean — the parent annotation isn't + * picked up because of type erasure on the generic parameter V. + * + *

Produces {@code text/plain} (not the class-level JSON default): the + * returned identifier is a raw string, not a JSON document, so clients can + * read it via {@code response.text()} instead of failing to parse an + * unquoted scalar as JSON. + */ + @POST + @Produces(MediaType.TEXT_PLAIN) + @Override + public String create(final GroupEditionVo container) { + return super.create(container); + } + @Override protected String toDn(final GroupEditionVo container, final ContainerScope scope) { var parentDn = scope.getDn();