View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.ext.scimv2.api.service;
20  
21  import javax.validation.constraints.NotNull;
22  import javax.ws.rs.Consumes;
23  import javax.ws.rs.DELETE;
24  import javax.ws.rs.GET;
25  import javax.ws.rs.POST;
26  import javax.ws.rs.PUT;
27  import javax.ws.rs.Path;
28  import javax.ws.rs.PathParam;
29  import javax.ws.rs.Produces;
30  import javax.ws.rs.QueryParam;
31  import javax.ws.rs.core.Response;
32  import org.apache.cxf.jaxrs.ext.PATCH;
33  import org.apache.syncope.ext.scimv2.api.SCIMConstants;
34  import org.apache.syncope.ext.scimv2.api.data.ListResponse;
35  import org.apache.syncope.ext.scimv2.api.data.SCIMPatchOp;
36  import org.apache.syncope.ext.scimv2.api.data.SCIMResource;
37  import org.apache.syncope.ext.scimv2.api.data.SCIMSearchRequest;
38  import org.apache.syncope.ext.scimv2.api.type.SortOrder;
39  
40  public interface SCIMResourceService<R extends SCIMResource> {
41  
42      @GET
43      @Path("{id}")
44      @Produces({ SCIMConstants.APPLICATION_SCIM_JSON })
45      R get(@NotNull @PathParam("id") String id,
46              @QueryParam("attributes") String attributes,
47              @QueryParam("excludedAttributes") String excludedAttributes);
48  
49      @GET
50      @Produces({ SCIMConstants.APPLICATION_SCIM_JSON })
51      ListResponse<R> search(
52              @QueryParam("attributes") String attributes,
53              @QueryParam("excludedAttributes") String excludedAttributes,
54              @QueryParam("filter") String filter,
55              @QueryParam("sortBy") String sortBy,
56              @QueryParam("sortOrder") SortOrder sortOrder,
57              @QueryParam("startIndex") Integer startIndex,
58              @QueryParam("count") Integer count);
59  
60      @POST
61      @Path(".search")
62      @Produces({ SCIMConstants.APPLICATION_SCIM_JSON })
63      @Consumes({ SCIMConstants.APPLICATION_SCIM_JSON })
64      ListResponse<R> search(SCIMSearchRequest request);
65  
66      @POST
67      @Produces({ SCIMConstants.APPLICATION_SCIM_JSON })
68      @Consumes({ SCIMConstants.APPLICATION_SCIM_JSON })
69      Response create(R resource);
70  
71      @PATCH
72      @Path("{id}")
73      @Produces({ SCIMConstants.APPLICATION_SCIM_JSON })
74      @Consumes({ SCIMConstants.APPLICATION_SCIM_JSON })
75      Response update(@NotNull @PathParam("id") String id, SCIMPatchOp patch);
76  
77      @PUT
78      @Path("{id}")
79      @Produces({ SCIMConstants.APPLICATION_SCIM_JSON })
80      @Consumes({ SCIMConstants.APPLICATION_SCIM_JSON })
81      Response replace(@NotNull @PathParam("id") String id, R resource);
82  
83      @DELETE
84      @Path("{id}")
85      @Produces({ SCIMConstants.APPLICATION_SCIM_JSON })
86      Response delete(@NotNull @PathParam("id") String id);
87  }