View Javadoc
1   /*
2    * Copyright (c) 2002-2024, City of Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  package fr.paris.lutece.plugins.identitystore.v3.web.rs;
35  
36  import fr.paris.lutece.plugins.identitystore.service.IdentityStoreService;
37  import fr.paris.lutece.plugins.identitystore.v3.web.request.contract.ActiveServiceContractGetRequest;
38  import fr.paris.lutece.plugins.identitystore.v3.web.request.contract.ServiceContractCreateRequest;
39  import fr.paris.lutece.plugins.identitystore.v3.web.request.contract.ServiceContractGetRequest;
40  import fr.paris.lutece.plugins.identitystore.v3.web.request.contract.ServiceContractListGetAllRequest;
41  import fr.paris.lutece.plugins.identitystore.v3.web.request.contract.ServiceContractListGetRequest;
42  import fr.paris.lutece.plugins.identitystore.v3.web.request.contract.ServiceContractPutEndDateRequest;
43  import fr.paris.lutece.plugins.identitystore.v3.web.request.contract.ServiceContractUpdateRequest;
44  import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractChangeResponse;
45  import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDto;
46  import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractSearchResponse;
47  import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractsSearchResponse;
48  import fr.paris.lutece.plugins.identitystore.v3.web.rs.swagger.SwaggerConstants;
49  import fr.paris.lutece.plugins.identitystore.v3.web.rs.util.Constants;
50  import fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException;
51  import fr.paris.lutece.plugins.rest.service.RestConstants;
52  import io.swagger.annotations.Api;
53  import io.swagger.annotations.ApiOperation;
54  import io.swagger.annotations.ApiParam;
55  import io.swagger.annotations.ApiResponse;
56  import io.swagger.annotations.ApiResponses;
57  import org.apache.commons.lang3.StringUtils;
58  
59  import javax.ws.rs.Consumes;
60  import javax.ws.rs.DefaultValue;
61  import javax.ws.rs.GET;
62  import javax.ws.rs.HeaderParam;
63  import javax.ws.rs.POST;
64  import javax.ws.rs.PUT;
65  import javax.ws.rs.Path;
66  import javax.ws.rs.PathParam;
67  import javax.ws.rs.Produces;
68  import javax.ws.rs.core.MediaType;
69  import javax.ws.rs.core.Response;
70  
71  import static fr.paris.lutece.plugins.identitystore.v3.web.rs.error.UncaughtServiceContractNotFoundExceptionMapper.ERROR_NO_SERVICE_CONTRACT_FOUND;
72  import static fr.paris.lutece.plugins.rest.service.mapper.GenericUncaughtExceptionMapper.ERROR_DURING_TREATMENT;
73  
74  /**
75   * ServiceContractRest
76   */
77  @Path( RestConstants.BASE_PATH + Constants.PLUGIN_PATH + Constants.VERSION_PATH_V3 )
78  @Api( RestConstants.BASE_PATH + Constants.PLUGIN_PATH + Constants.VERSION_PATH_V3 )
79  public class ServiceContractRestService
80  {
81  
82      /**
83       * Get ServiceContract List
84       *
85       * @param clientCode
86       *            client code
87       * @return the ServiceContract
88       */
89      @Path( Constants.SERVICECONTRACTS_PATH )
90      @GET
91      @Produces( MediaType.APPLICATION_JSON )
92      @ApiOperation( value = "Get all service contract associated to the given client code", response = ServiceContractsSearchResponse.class )
93      @ApiResponses( value = {
94              @ApiResponse( code = 200, message = "Service contract Found" ),
95              @ApiResponse( code = 400, message = ERROR_DURING_TREATMENT + " with explanation message" ), @ApiResponse( code = 403, message = "Failure" ),
96              @ApiResponse( code = 404, message = ERROR_NO_SERVICE_CONTRACT_FOUND )
97      } )
98      public Response getAllServiceContractList(
99              @ApiParam( name = Constants.PARAM_CLIENT_CODE, value = SwaggerConstants.PARAM_CLIENT_CODE_DESCRIPTION ) @HeaderParam( Constants.PARAM_CLIENT_CODE ) String clientCode,
100             @ApiParam( name = Constants.PARAM_AUTHOR_NAME, value = SwaggerConstants.PARAM_AUTHOR_NAME_DESCRIPTION ) @HeaderParam( Constants.PARAM_AUTHOR_NAME ) String authorName,
101             @ApiParam( name = Constants.PARAM_AUTHOR_TYPE, value = SwaggerConstants.PARAM_AUTHOR_TYPE_DESCRIPTION ) @HeaderParam( Constants.PARAM_AUTHOR_TYPE ) String authorType,
102             @ApiParam( name = Constants.PARAM_APPLICATION_CODE, value = SwaggerConstants.PARAM_APPLICATION_CODE_DESCRIPTION ) @HeaderParam( Constants.PARAM_APPLICATION_CODE ) @DefaultValue( "" ) String strHeaderAppCode )
103             throws IdentityStoreException
104     {
105         // TODO paginer l'appel
106         final String trustedClientCode = IdentityStoreService.getTrustedClientCode( clientCode, StringUtils.EMPTY, strHeaderAppCode );
107         final ServiceContractListGetAllRequestb/request/contract/ServiceContractListGetAllRequest.html#ServiceContractListGetAllRequest">ServiceContractListGetAllRequest request = new ServiceContractListGetAllRequest( trustedClientCode, authorName, authorType );
108         final ServiceContractsSearchResponse entity = (ServiceContractsSearchResponse) request.doRequest( );
109         return Response.status( entity.getStatus( ).getHttpCode( ) ).entity( entity ).type( MediaType.APPLICATION_JSON_TYPE ).build( );
110     }
111 
112     /**
113      * Get ServiceContract List
114      *
115      * @param headerClientCode
116      *            client code
117      * @return the ServiceContract
118      */
119     @Path( Constants.SERVICECONTRACTS_PATH + "/list/{" + Constants.PARAM_TARGET_CLIENT_CODE + "}" )
120     @GET
121     @Produces( MediaType.APPLICATION_JSON )
122     @ApiOperation( value = "Get all service contract associated to the given client code", response = ServiceContractsSearchResponse.class )
123     @ApiResponses( value = {
124             @ApiResponse( code = 200, message = "Service contract Found" ),
125             @ApiResponse( code = 400, message = ERROR_DURING_TREATMENT + " with explanation message" ), @ApiResponse( code = 403, message = "Failure" ),
126             @ApiResponse( code = 404, message = ERROR_NO_SERVICE_CONTRACT_FOUND )
127     } )
128     public Response getServiceContractList(
129             @ApiParam( name = Constants.PARAM_TARGET_CLIENT_CODE, value = SwaggerConstants.PARAM_TARGET_CLIENT_CODE_DESCRIPTION ) @PathParam( Constants.PARAM_TARGET_CLIENT_CODE ) String strTargetClientCode,
130             @ApiParam( name = Constants.PARAM_CLIENT_CODE, value = SwaggerConstants.PARAM_CLIENT_CODE_DESCRIPTION ) @HeaderParam( Constants.PARAM_CLIENT_CODE ) String headerClientCode,
131             @ApiParam( name = Constants.PARAM_AUTHOR_NAME, value = SwaggerConstants.PARAM_AUTHOR_NAME_DESCRIPTION ) @HeaderParam( Constants.PARAM_AUTHOR_NAME ) String authorName,
132             @ApiParam( name = Constants.PARAM_AUTHOR_TYPE, value = SwaggerConstants.PARAM_AUTHOR_TYPE_DESCRIPTION ) @HeaderParam( Constants.PARAM_AUTHOR_TYPE ) String authorType,
133             @ApiParam( name = Constants.PARAM_APPLICATION_CODE, value = SwaggerConstants.PARAM_APPLICATION_CODE_DESCRIPTION ) @HeaderParam( Constants.PARAM_APPLICATION_CODE ) @DefaultValue( "" ) String strHeaderAppCode )
134             throws IdentityStoreException
135     {
136         final String trustedHeaderClientCode = IdentityStoreService.getTrustedClientCode( headerClientCode, StringUtils.EMPTY, strHeaderAppCode );
137         final ServiceContractListGetRequest/web/request/contract/ServiceContractListGetRequest.html#ServiceContractListGetRequest">ServiceContractListGetRequest request = new ServiceContractListGetRequest( strTargetClientCode, trustedHeaderClientCode, authorName, authorType );
138         final ServiceContractsSearchResponse entity = (ServiceContractsSearchResponse) request.doRequest( );
139         return Response.status( entity.getStatus( ).getHttpCode( ) ).entity( entity ).type( MediaType.APPLICATION_JSON_TYPE ).build( );
140     }
141 
142     /**
143      * Get ServiceContract
144      *
145      * @param headerClientCode
146      *            client code
147      * @return the ServiceContract
148      */
149     @Path( Constants.ACTIVE_SERVICE_CONTRACT_PATH + "/{" + Constants.PARAM_TARGET_CLIENT_CODE + "}" )
150     @GET
151     @Produces( MediaType.APPLICATION_JSON )
152     @ApiOperation( value = "Get the active service contract associated to the given client code", response = ServiceContractSearchResponse.class )
153     @ApiResponses( value = {
154             @ApiResponse( code = 200, message = "Service contract Found" ),
155             @ApiResponse( code = 400, message = ERROR_DURING_TREATMENT + " with explanation message" ), @ApiResponse( code = 403, message = "Failure" ),
156             @ApiResponse( code = 404, message = ERROR_NO_SERVICE_CONTRACT_FOUND )
157     } )
158     public Response getActiveServiceContract(
159             @ApiParam( name = Constants.PARAM_TARGET_CLIENT_CODE, value = SwaggerConstants.PARAM_TARGET_CLIENT_CODE_DESCRIPTION ) @PathParam( Constants.PARAM_TARGET_CLIENT_CODE ) String strTargetClientCode,
160             @ApiParam( name = Constants.PARAM_CLIENT_CODE, value = SwaggerConstants.PARAM_CLIENT_CODE_DESCRIPTION ) @HeaderParam( Constants.PARAM_CLIENT_CODE ) String headerClientCode,
161             @ApiParam( name = Constants.PARAM_AUTHOR_NAME, value = SwaggerConstants.PARAM_AUTHOR_NAME_DESCRIPTION ) @HeaderParam( Constants.PARAM_AUTHOR_NAME ) String authorName,
162             @ApiParam( name = Constants.PARAM_AUTHOR_TYPE, value = SwaggerConstants.PARAM_AUTHOR_TYPE_DESCRIPTION ) @HeaderParam( Constants.PARAM_AUTHOR_TYPE ) String authorType,
163             @ApiParam( name = Constants.PARAM_APPLICATION_CODE, value = SwaggerConstants.PARAM_APPLICATION_CODE_DESCRIPTION ) @HeaderParam( Constants.PARAM_APPLICATION_CODE ) @DefaultValue( "" ) String strHeaderAppCode )
164             throws IdentityStoreException
165     {
166         final String trustedHeaderClientCode = IdentityStoreService.getTrustedClientCode( headerClientCode, StringUtils.EMPTY, strHeaderAppCode );
167         final ActiveServiceContractGetRequesteb/request/contract/ActiveServiceContractGetRequest.html#ActiveServiceContractGetRequest">ActiveServiceContractGetRequest request = new ActiveServiceContractGetRequest( strTargetClientCode, trustedHeaderClientCode, authorName,
168                 authorType );
169         final ServiceContractSearchResponse entity = (ServiceContractSearchResponse) request.doRequest( );
170         return Response.status( entity.getStatus( ).getHttpCode( ) ).entity( entity ).type( MediaType.APPLICATION_JSON_TYPE ).build( );
171     }
172 
173     /**
174      * Get ServiceContract
175      *
176      * @param clientCode
177      *            client code
178      * @param serviceContractId
179      *            service contract ID
180      * @return the ServiceContract
181      */
182     @Path( Constants.SERVICECONTRACTS_PATH + "/{" + Constants.PARAM_ID_SERVICE_CONTRACT + "}" )
183     @GET
184     @Produces( MediaType.APPLICATION_JSON )
185     @ApiOperation( value = "Get the service contract associated to the given ID and application client code", response = ServiceContractSearchResponse.class )
186     @ApiResponses( value = {
187             @ApiResponse( code = 200, message = "Service contract Found" ),
188             @ApiResponse( code = 400, message = ERROR_DURING_TREATMENT + " with explanation message" ), @ApiResponse( code = 403, message = "Failure" ),
189             @ApiResponse( code = 404, message = ERROR_NO_SERVICE_CONTRACT_FOUND )
190     } )
191     public Response getServiceContract(
192             @ApiParam( name = Constants.PARAM_CLIENT_CODE, value = SwaggerConstants.PARAM_CLIENT_CODE_DESCRIPTION ) @HeaderParam( Constants.PARAM_CLIENT_CODE ) String clientCode,
193             @ApiParam( name = Constants.PARAM_AUTHOR_NAME, value = SwaggerConstants.PARAM_AUTHOR_NAME_DESCRIPTION ) @HeaderParam( Constants.PARAM_AUTHOR_NAME ) String authorName,
194             @ApiParam( name = Constants.PARAM_AUTHOR_TYPE, value = SwaggerConstants.PARAM_AUTHOR_TYPE_DESCRIPTION ) @HeaderParam( Constants.PARAM_AUTHOR_TYPE ) String authorType,
195             @ApiParam( name = Constants.PARAM_ID_SERVICE_CONTRACT, value = "ID of the searched contract" ) @PathParam( Constants.PARAM_ID_SERVICE_CONTRACT ) Integer serviceContractId,
196             @ApiParam( name = Constants.PARAM_APPLICATION_CODE, value = SwaggerConstants.PARAM_APPLICATION_CODE_DESCRIPTION ) @HeaderParam( Constants.PARAM_APPLICATION_CODE ) @DefaultValue( "" ) String strHeaderAppCode )
197             throws IdentityStoreException
198     {
199         final String trustedClientCode = IdentityStoreService.getTrustedClientCode( clientCode, StringUtils.EMPTY, strHeaderAppCode );
200         final ServiceContractGetRequeste/v3/web/request/contract/ServiceContractGetRequest.html#ServiceContractGetRequest">ServiceContractGetRequest request = new ServiceContractGetRequest( trustedClientCode, serviceContractId, authorName, authorType );
201         final ServiceContractSearchResponse entity = (ServiceContractSearchResponse) request.doRequest( );
202         return Response.status( entity.getStatus( ).getHttpCode( ) ).entity( entity ).type( MediaType.APPLICATION_JSON_TYPE ).build( );
203     }
204 
205     /**
206      * Creates a service contract.<br/>
207      * The service contract is created from the provided {@link ServiceContractDto}.
208      *
209      * @param serviceContract
210      *            the service contract to create
211      * @param clientCode
212      *            the application code in the HTTP header
213      * @return http 200 if creation is ok with {@link ServiceContractChangeResponse}
214      */
215     @Path( Constants.SERVICECONTRACTS_PATH )
216     @POST
217     @Consumes( MediaType.APPLICATION_JSON )
218     @ApiOperation( value = "Create a new Service Contract associated with the given client code", response = ServiceContractChangeResponse.class )
219     @ApiResponses( value = {
220             @ApiResponse( code = 201, message = "Success" ), @ApiResponse( code = 400, message = ERROR_DURING_TREATMENT + " with explanation message" ),
221             @ApiResponse( code = 403, message = "Failure" ), @ApiResponse( code = 409, message = "Conflict" )
222     } )
223     public Response createServiceContract( @ApiParam( name = "Request body", value = "A service contract creation Request" ) ServiceContractDto serviceContract,
224             @ApiParam( name = Constants.PARAM_CLIENT_CODE, value = SwaggerConstants.PARAM_CLIENT_CODE_DESCRIPTION ) @HeaderParam( Constants.PARAM_CLIENT_CODE ) String clientCode,
225             @ApiParam( name = Constants.PARAM_AUTHOR_NAME, value = SwaggerConstants.PARAM_AUTHOR_NAME_DESCRIPTION ) @HeaderParam( Constants.PARAM_AUTHOR_NAME ) String authorName,
226             @ApiParam( name = Constants.PARAM_AUTHOR_TYPE, value = SwaggerConstants.PARAM_AUTHOR_TYPE_DESCRIPTION ) @HeaderParam( Constants.PARAM_AUTHOR_TYPE ) String authorType,
227             @ApiParam( name = Constants.PARAM_APPLICATION_CODE, value = SwaggerConstants.PARAM_APPLICATION_CODE_DESCRIPTION ) @HeaderParam( Constants.PARAM_APPLICATION_CODE ) @DefaultValue( "" ) String strHeaderAppCode )
228             throws IdentityStoreException
229     {
230         final String trustedClientCode = IdentityStoreService.getTrustedClientCode( clientCode, StringUtils.EMPTY, strHeaderAppCode );
231         final ServiceContractCreateRequest/contract/ServiceContractCreateRequest.html#ServiceContractCreateRequest">ServiceContractCreateRequest identityStoreRequest = new ServiceContractCreateRequest( serviceContract, trustedClientCode, authorName,
232                 authorType );
233         final ServiceContractChangeResponse entity = (ServiceContractChangeResponse) identityStoreRequest.doRequest( );
234         return Response.status( entity.getStatus( ).getHttpCode( ) ).entity( entity ).type( MediaType.APPLICATION_JSON_TYPE ).build( );
235     }
236 
237     /**
238      * Updates a service contract.<br/>
239      * The service contract is updated from the provided {@link ServiceContractDto}.
240      *
241      * @param serviceContract
242      *            the service contract to update
243      * @param serviceContractId
244      *            the service contract ID
245      * @param clientCode
246      *            the application code in the HTTP header
247      * @return http 200 if creation is ok with {@link ServiceContractChangeResponse}
248      */
249     @PUT
250     @Path( Constants.SERVICECONTRACTS_PATH + "/{" + Constants.PARAM_ID_SERVICE_CONTRACT + "}" )
251     @Consumes( MediaType.APPLICATION_JSON )
252     @ApiOperation( value = "Update an existing Service Contract", response = ServiceContractChangeResponse.class )
253     @ApiResponses( value = {
254             @ApiResponse( code = 201, message = "Success" ), @ApiResponse( code = 400, message = ERROR_DURING_TREATMENT + " with explanation message" ),
255             @ApiResponse( code = 403, message = "Failure" ), @ApiResponse( code = 409, message = "Conflict" ),
256             @ApiResponse( code = 404, message = ERROR_NO_SERVICE_CONTRACT_FOUND )
257     } )
258     public Response updateServiceContract( @ApiParam( name = "Request body", value = "A service contract change Request" ) ServiceContractDto serviceContract,
259             @ApiParam( name = Constants.PARAM_ID_SERVICE_CONTRACT, value = "ID of the updated contract" ) @PathParam( Constants.PARAM_ID_SERVICE_CONTRACT ) Integer serviceContractId,
260             @ApiParam( name = Constants.PARAM_CLIENT_CODE, value = SwaggerConstants.PARAM_CLIENT_CODE_DESCRIPTION ) @HeaderParam( Constants.PARAM_CLIENT_CODE ) String clientCode,
261             @ApiParam( name = Constants.PARAM_AUTHOR_NAME, value = SwaggerConstants.PARAM_AUTHOR_NAME_DESCRIPTION ) @HeaderParam( Constants.PARAM_AUTHOR_NAME ) String authorName,
262             @ApiParam( name = Constants.PARAM_AUTHOR_TYPE, value = SwaggerConstants.PARAM_AUTHOR_TYPE_DESCRIPTION ) @HeaderParam( Constants.PARAM_AUTHOR_TYPE ) String authorType,
263             @ApiParam( name = Constants.PARAM_APPLICATION_CODE, value = SwaggerConstants.PARAM_APPLICATION_CODE_DESCRIPTION ) @HeaderParam( Constants.PARAM_APPLICATION_CODE ) @DefaultValue( "" ) String strHeaderAppCode )
264             throws IdentityStoreException
265     {
266         final String trustedClientCode = IdentityStoreService.getTrustedClientCode( clientCode, StringUtils.EMPTY, strHeaderAppCode );
267         final ServiceContractUpdateRequest/contract/ServiceContractUpdateRequest.html#ServiceContractUpdateRequest">ServiceContractUpdateRequest identityStoreRequest = new ServiceContractUpdateRequest( serviceContract, trustedClientCode, serviceContractId,
268                 authorName, authorType );
269         final ServiceContractChangeResponse entity = (ServiceContractChangeResponse) identityStoreRequest.doRequest( );
270         return Response.status( entity.getStatus( ).getHttpCode( ) ).entity( entity ).type( MediaType.APPLICATION_JSON_TYPE ).build( );
271     }
272 
273     /**
274      * Closes a service contract by specifying an end date.<br/>
275      * The service contract is updated from the provided {@link ServiceContractDto}.
276      *
277      * @param serviceContract
278      *            the service contract to update
279      * @param serviceContractId
280      *            the service contract ID
281      * @param clientCode
282      *            the application code in the HTTP header
283      * @return http 200 if creation is ok with {@link ServiceContractChangeResponse}
284      */
285     @PUT
286     @Path( Constants.SERVICECONTRACTS_PATH + "/{" + Constants.PARAM_ID_SERVICE_CONTRACT + "}" + Constants.SERVICECONTRACT_END_DATE_PATH )
287     @Consumes( MediaType.APPLICATION_JSON )
288     @ApiOperation( value = "Patches the end date of the service contract", response = ServiceContractChangeResponse.class )
289     @ApiResponses( value = {
290             @ApiResponse( code = 201, message = "Success" ), @ApiResponse( code = 400, message = ERROR_DURING_TREATMENT + " with explanation message" ),
291             @ApiResponse( code = 403, message = "Failure" ), @ApiResponse( code = 409, message = "Conflict" ),
292             @ApiResponse( code = 404, message = ERROR_NO_SERVICE_CONTRACT_FOUND )
293     } )
294     public Response closeServiceContract( @ApiParam( name = "Request body", value = "An Identity Change Request" ) ServiceContractDto serviceContract,
295             @ApiParam( name = Constants.PARAM_ID_SERVICE_CONTRACT, value = "ID of the updated contract" ) @PathParam( Constants.PARAM_ID_SERVICE_CONTRACT ) Integer serviceContractId,
296             @ApiParam( name = Constants.PARAM_CLIENT_CODE, value = SwaggerConstants.PARAM_CLIENT_CODE_DESCRIPTION ) @HeaderParam( Constants.PARAM_CLIENT_CODE ) String clientCode,
297             @ApiParam( name = Constants.PARAM_AUTHOR_NAME, value = SwaggerConstants.PARAM_AUTHOR_NAME_DESCRIPTION ) @HeaderParam( Constants.PARAM_AUTHOR_NAME ) String authorName,
298             @ApiParam( name = Constants.PARAM_AUTHOR_TYPE, value = SwaggerConstants.PARAM_AUTHOR_TYPE_DESCRIPTION ) @HeaderParam( Constants.PARAM_AUTHOR_TYPE ) String authorType,
299             @ApiParam( name = Constants.PARAM_APPLICATION_CODE, value = SwaggerConstants.PARAM_APPLICATION_CODE_DESCRIPTION ) @HeaderParam( Constants.PARAM_APPLICATION_CODE ) @DefaultValue( "" ) String strHeaderAppCode )
300             throws IdentityStoreException
301     {
302         final String trustedClientCode = IdentityStoreService.getTrustedClientCode( clientCode, StringUtils.EMPTY, strHeaderAppCode );
303         final ServiceContractPutEndDateRequesttract/ServiceContractPutEndDateRequest.html#ServiceContractPutEndDateRequest">ServiceContractPutEndDateRequest identityStoreRequest = new ServiceContractPutEndDateRequest( serviceContract, trustedClientCode,
304                 serviceContractId, authorName, authorType );
305         final ServiceContractChangeResponse entity = (ServiceContractChangeResponse) identityStoreRequest.doRequest( );
306         return Response.status( entity.getStatus( ).getHttpCode( ) ).entity( entity ).type( MediaType.APPLICATION_JSON_TYPE ).build( );
307     }
308 
309 }