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.service; 35 36 import fr.paris.lutece.plugins.identitystore.v3.web.rs.IdentityRequestValidator; 37 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.RequestAuthor; 38 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractChangeResponse; 39 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDto; 40 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractSearchResponse; 41 import fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractsSearchResponse; 42 import fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException; 43 44 public interface IServiceContractTransportProvider 45 { 46 47 /** 48 * Get all service contract associated to the given client code. 49 * 50 * @param strTargetClientCode 51 * the client code. 52 * @param strClientCode 53 * client code of calling application 54 * @param author 55 * the author of the request 56 * @return ServiceContractsSearchResponse 57 */ 58 ServiceContractsSearchResponse getServiceContractList( final String strTargetClientCode, final String strClientCode, final RequestAuthor author ) 59 throws IdentityStoreException; 60 61 /** 62 * Get all service contracts. 63 * 64 * @param strClientCode 65 * client code of calling application 66 * @param author 67 * the author of the request 68 * @return ServiceContractsSearchResponse 69 */ 70 ServiceContractsSearchResponse getAllServiceContractList( final String strClientCode, final RequestAuthor author ) throws IdentityStoreException; 71 72 /** 73 * Get the active service contract associated to the given client code. 74 * 75 * @param strTargetClientCode 76 * the client code. 77 * @param strClientCode 78 * client code of calling application 79 * @param author 80 * the author of the request 81 * @return ServiceContractSearchResponse 82 */ 83 ServiceContractSearchResponse getActiveServiceContract( final String strTargetClientCode, final String strClientCode, final RequestAuthor author ) 84 throws IdentityStoreException; 85 86 /** 87 * Get the service contract associated to the given ID and client code. 88 * 89 * @param nServiceContractId 90 * the ID. 91 * @param strClientCode 92 * client code of calling application 93 * @param author 94 * the author of the request 95 * @return ServiceContractSearchResponse 96 */ 97 ServiceContractSearchResponse getServiceContract( final Integer nServiceContractId, final String strClientCode, final RequestAuthor author ) 98 throws IdentityStoreException; 99 100 /** 101 * Create a new Service Contract associated with the given client code.<br/> 102 * The service contract is created from the provided {@link ServiceContractDto}. 103 * 104 * @param serviceContract 105 * the service contract to create. 106 * @param strClientCode 107 * client code of calling application 108 * @param author 109 * the author of the request 110 * @return ServiceContractChangeResponse 111 */ 112 ServiceContractChangeResponse createServiceContract( final ServiceContractDto serviceContract, final String strClientCode, final RequestAuthor author ) 113 throws IdentityStoreException; 114 115 /** 116 * Updates a service contract.<br/> 117 * The service contract is updated from the provided {@link ServiceContractDto}.<br/> 118 * 119 * @param serviceContract 120 * the service contract to update 121 * @param nServiceContractId 122 * the service contract ID 123 * @param strClientCode 124 * client code of calling application 125 * @param author 126 * the author of the request 127 * @return ServiceContractChangeResponse 128 */ 129 ServiceContractChangeResponse updateServiceContract( final ServiceContractDto serviceContract, final Integer nServiceContractId, final String strClientCode, 130 final RequestAuthor author ) throws IdentityStoreException; 131 132 /** 133 * Closes a service contract by specifying an end date.<br/> 134 * The service contract is updated from the provided {@link ServiceContractDto}.<br/> 135 * 136 * @param serviceContract 137 * the service contract to close 138 * @param nServiceContractId 139 * the service contract ID 140 * @param strClientCode 141 * client code of calling application 142 * @param author 143 * the author of the request 144 * @return ServiceContractChangeResponse 145 */ 146 ServiceContractChangeResponse closeServiceContract( final ServiceContractDto serviceContract, final Integer nServiceContractId, final String strClientCode, 147 final RequestAuthor author ) throws IdentityStoreException; 148 149 default void checkCommonHeaders( final String clientCode, final RequestAuthor author ) throws IdentityStoreException 150 { 151 IdentityRequestValidator.instance( ).checkAuthor( author ); 152 IdentityRequestValidator.instance( ).checkClientCode( clientCode ); 153 } 154 }