Class ServiceContractService
java.lang.Object
fr.paris.lutece.plugins.identitystore.service.contract.ServiceContractService
-
Method Summary
Modifier and TypeMethodDescriptionclose(ServiceContract serviceContract) Closes an existingServiceContract(if possible) and adds it to cache if active.create(ServiceContract serviceContract, ClientApplication clientApplication) Creates a newServiceContract(if possible) and adds it to cache if active.voidDeletes aServiceContractby its id in the databasevoiddeleteApplication(ClientApplication clientApplication) Deletes aClientApplicationand all the relatedServiceContractList<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDto>Exports all service contractsList<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDto>exportAllServiceContracts(String clientCode) Exports all service contracts associated with the provided client codefr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDtoexportServiceContract(int serviceContractId) getActiveServiceContract(String clientCode) Get the activeServiceContractassociated to the givenClientApplicationgetActiveServiceContractAtSpecificDate(String clientCode, Date specificDate) Get the active ServiceContract} associated to the given ClientApplication at a specific dategetClientCodesFromAppCode(String appCode) get Client Code list From AppCodeintgetDataRetentionPeriodInMonths(String clientCode) get data retention period in monthsgetMandatoryAttributes(ServiceContract serviceContract, List<AttributeKey> sharedMandatoryAttributeList) get mandatory attributesstatic ServiceContractServiceinstance()booleanList<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDto>searchServiceContracts(boolean loadDetails, Date minEndDate) Search and exports service contracts corresponding to the given criteriasupdate(ServiceContract serviceContract, ClientApplication clientApplication) Update an existingServiceContract(if possible) and adds it to cache if active.voidvalidateContractDefinition(ServiceContract serviceContract, int clientApplicationId) Checks if the definition of a givenServiceContractis Valid.voidvalidateCreateAuthorization(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeRequest identityChangeRequest, ServiceContract serviceContract) Validates theIdentityChangeRequestagainst theServiceContractassociated to theClientApplicationrequesting the change.voidvalidateDeleteAuthorization(ServiceContract serviceContract) checks if the service contract grants the right to delete identitiesvoidvalidateExportAuthorization(ServiceContract serviceContract) Checks if the service contract grants the right to export identitiesvoidvalidateGetAuthorization(ServiceContract serviceContract) Validates that theServiceContractassociated to theClientApplicationrequesting the search, is authorizing searching.voidvalidateImportAuthorization(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeRequest request, ServiceContract serviceContract) Validates theIdentityChangeRequestagainst theServiceContractassociated to theClientApplicationrequesting the change.voidvalidateMergeAuthorization(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.merge.IdentityMergeRequest request, ServiceContract serviceContract) Validates theIdentityMergeRequestagainst theServiceContractassociated to theClientApplicationrequesting the change.voidvalidateSearchAuthorization(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.search.IdentitySearchRequest identitySearchRequest, ServiceContract serviceContract) Validates theIdentitySearchRequestagainst theServiceContractassociated to theClientApplicationrequesting the search.voidvalidateUncertifyAuthorization(ServiceContract serviceContract) Checks if the service contract grants the right to uncertify an identityvoidvalidateUpdateAuthorization(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeRequest identityChangeRequest, fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.IdentityDto existingIdentityToUpdate, ServiceContract serviceContract) Validates theIdentityChangeRequestagainst theServiceContractassociated to theClientApplicationrequesting the change.
-
Method Details
-
instance
-
getActiveServiceContract
public ServiceContract getActiveServiceContract(String clientCode) throws fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException Get the activeServiceContractassociated to the givenClientApplication- Parameters:
clientCode- code of theClientApplicationrequesting the change- Returns:
- the active
ServiceContract - Throws:
fr.paris.lutece.plugins.identitystore.web.exception.ResourceNotFoundExceptionfr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException
-
getActiveServiceContractAtSpecificDate
public ServiceContract getActiveServiceContractAtSpecificDate(String clientCode, Date specificDate) throws fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException Get the active ServiceContract} associated to the given ClientApplication at a specific date- Parameters:
clientCode-specificDate-- Returns:
- the service contract
- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException
-
getMandatoryAttributes
public List<String> getMandatoryAttributes(ServiceContract serviceContract, List<AttributeKey> sharedMandatoryAttributeList) get mandatory attributes- Parameters:
serviceContract-sharedMandatoryAttributeList-- Returns:
- the attribute key list
-
getDataRetentionPeriodInMonths
public int getDataRetentionPeriodInMonths(String clientCode) throws fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException get data retention period in months- Parameters:
clientCode-- Returns:
- the nb of months
- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException
-
create
public ServiceContract create(ServiceContract serviceContract, ClientApplication clientApplication) throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException Creates a newServiceContract(if possible) and adds it to cache if active.- Parameters:
serviceContract- the service contract to createclientApplication- the client application- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
-
update
public ServiceContract update(ServiceContract serviceContract, ClientApplication clientApplication) throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException Update an existingServiceContract(if possible) and adds it to cache if active.- Parameters:
serviceContract-clientApplication-- Returns:
- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
-
close
public ServiceContract close(ServiceContract serviceContract) throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException Closes an existingServiceContract(if possible) and adds it to cache if active.- Parameters:
serviceContract-- Returns:
- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
-
delete
Deletes aServiceContractby its id in the database- Parameters:
id-
-
deleteApplication
public void deleteApplication(ClientApplication clientApplication) throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException Deletes aClientApplicationand all the relatedServiceContract- Parameters:
clientApplication-- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
-
validateContractDefinition
public void validateContractDefinition(ServiceContract serviceContract, int clientApplicationId) throws fr.paris.lutece.plugins.identitystore.web.exception.RequestFormatException Checks if the definition of a givenServiceContractis Valid. Start date and End date of the given contract shall not be in the range of Start date and End date of an existing contract.- Parameters:
serviceContract-clientApplicationId-- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.RequestFormatException
-
isInRange
-
getClientCodesFromAppCode
get Client Code list From AppCode- Parameters:
appCode- the app code- Returns:
- list of corresponding client code
-
validateGetAuthorization
public void validateGetAuthorization(ServiceContract serviceContract) throws fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException Validates that theServiceContractassociated to theClientApplicationrequesting the search, is authorizing searching.- Parameters:
serviceContract- the service contract- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException
-
validateSearchAuthorization
public void validateSearchAuthorization(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.search.IdentitySearchRequest identitySearchRequest, ServiceContract serviceContract) throws fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException Validates theIdentitySearchRequestagainst theServiceContractassociated to theClientApplicationrequesting the search. Each violation is listed in theClientAuthorizationException's response with a status by attribute key. The following rules are verified:- The service contract must exist and allow to search identities
- The requested attributes must be searchable
- Parameters:
identitySearchRequest-IdentitySearchRequestwith list of attributesserviceContract- the service contract- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException
-
validateCreateAuthorization
public void validateCreateAuthorization(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeRequest identityChangeRequest, ServiceContract serviceContract) throws fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException Validates theIdentityChangeRequestagainst theServiceContractassociated to theClientApplicationrequesting the change. Each violation is listed in theClientAuthorizationException's response with a status by attribute key. The following rules are verified:
- The service contract must exist and allow writing identities
- The attribute must be writable
- The certification processus, if given in the request, must be in the list of authorized processus
- Parameters:
identityChangeRequest-IdentityChangeRequestwith list of attributesserviceContract- the service contract of the client requesting the change- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException
-
validateUpdateAuthorization
public void validateUpdateAuthorization(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeRequest identityChangeRequest, fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.common.IdentityDto existingIdentityToUpdate, ServiceContract serviceContract) throws fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException Validates theIdentityChangeRequestagainst theServiceContractassociated to theClientApplicationrequesting the change. Each violation is listed in theClientAuthorizationException's response with a status by attribute key. The following rules are verified:
- The service contract must exist and allow writing identities
- The attribute must be writable
- The certification processus, if given in the request, must be in the list of authorized processus
- Parameters:
identityChangeRequest-IdentityChangeRequestwith list of attributesserviceContract- service contract of the client requesting the change- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException
-
validateMergeAuthorization
public void validateMergeAuthorization(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.merge.IdentityMergeRequest request, ServiceContract serviceContract) throws fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException Validates theIdentityMergeRequestagainst theServiceContractassociated to theClientApplicationrequesting the change. Each violation is listed in theIdentityMergeResponsewith a status by attribute key. The following rules are verified:
- The
ClientApplicationmust be authorized to perform the merge
- Parameters:
request-IdentityMergeRequestwith list of attributesserviceContract- service contract of the client requesting the change- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException
- The
-
validateDeleteAuthorization
public void validateDeleteAuthorization(ServiceContract serviceContract) throws fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException checks if the service contract grants the right to delete identities- Parameters:
serviceContract- the service contract- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException- if the service contract does not grant the delete authorization
-
validateImportAuthorization
public void validateImportAuthorization(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeRequest request, ServiceContract serviceContract) throws fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException Validates theIdentityChangeRequestagainst theServiceContractassociated to theClientApplicationrequesting the change. Each violation is listed in theIdentityChangeResponsewith a status by attribute key. The following rules are verified:
- The
ClientApplicationmust be authorized to perform the import - The attribute must be writable
- The certification processus, if given in the request, must be in the list of authorized processus
- Parameters:
request-IdentityChangeRequestwith list of attributesserviceContract- the service contract of the client requesting the change- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException- in case of error
- The
-
validateUncertifyAuthorization
public void validateUncertifyAuthorization(ServiceContract serviceContract) throws fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException Checks if the service contract grants the right to uncertify an identity- Parameters:
serviceContract- the service contract- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException
-
validateExportAuthorization
public void validateExportAuthorization(ServiceContract serviceContract) throws fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException Checks if the service contract grants the right to export identities- Parameters:
serviceContract- the service contract- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException
-
exportAllServiceContracts
public List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDto> exportAllServiceContracts() throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreExceptionExports all service contracts- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException- in case of error
-
exportAllServiceContracts
public List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDto> exportAllServiceContracts(String clientCode) throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException Exports all service contracts associated with the provided client code- Parameters:
clientCode- the client code- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException- in case of error
-
searchServiceContracts
public List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDto> searchServiceContracts(boolean loadDetails, Date minEndDate) throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException Search and exports service contracts corresponding to the given criterias- Parameters:
loadDetails- - to load the details or not (only base object)minEndDate- - the min end date value to have- Returns:
- List
- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
-
exportServiceContract
public fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDto exportServiceContract(int serviceContractId) throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException - Throws:
fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
-