Class ServiceContractService
- java.lang.Object
-
- fr.paris.lutece.plugins.identitystore.service.contract.ServiceContractService
-
public class ServiceContractService extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ServiceContractclose(ServiceContract serviceContract)Closes an existingServiceContract(if possible) and adds it to cache if active.ServiceContractcreate(ServiceContract serviceContract, ClientApplication clientApplication)Creates a newServiceContract(if possible) and adds it to cache if active.voiddelete(java.lang.Integer id)Deletes aServiceContractby its id in the databasevoiddeleteApplication(ClientApplication clientApplication)Deletes aClientApplicationand all the relatedServiceContractjava.util.List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDto>exportAllServiceContracts()Exports all service contractsjava.util.List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDto>exportAllServiceContracts(java.lang.String clientCode)Exports all service contracts associated with the provided client codefr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDtoexportServiceContract(int serviceContractId)ServiceContractgetActiveServiceContract(java.lang.String clientCode)Get the activeServiceContractassociated to the givenClientApplicationjava.util.List<java.lang.String>getClientCodesFromAppCode(java.lang.String appCode)get Client Code list From AppCodeintgetDataRetentionPeriodInMonths(java.lang.String clientCode)java.util.List<java.lang.String>getMandatoryAttributes(ServiceContract serviceContract, java.util.List<AttributeKey> sharedMandatoryAttributeList)static ServiceContractServiceinstance()booleanisInRange(java.util.Date testedDate, java.util.Date min, java.util.Date max)java.util.List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDto>searchServiceContracts(boolean loadDetails, java.sql.Date minEndDate)Search and exports service contracts corresponding to the given criteriasServiceContractupdate(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 Detail
-
instance
public static ServiceContractService instance()
-
getActiveServiceContract
public ServiceContract getActiveServiceContract(java.lang.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
-
getMandatoryAttributes
public java.util.List<java.lang.String> getMandatoryAttributes(ServiceContract serviceContract, java.util.List<AttributeKey> sharedMandatoryAttributeList)
-
getDataRetentionPeriodInMonths
public int getDataRetentionPeriodInMonths(java.lang.String clientCode) throws fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException- 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
public void delete(java.lang.Integer id)
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
public boolean isInRange(java.util.Date testedDate, java.util.Date min, java.util.Date max)
-
getClientCodesFromAppCode
public java.util.List<java.lang.String> getClientCodesFromAppCode(java.lang.String appCode)
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.ClientAuthorizationExceptionValidates 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.ClientAuthorizationExceptionValidates 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.ClientAuthorizationExceptionValidates 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.ClientAuthorizationExceptionValidates 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.ClientAuthorizationExceptionValidates 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 java.util.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 java.util.List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDto> exportAllServiceContracts(java.lang.String clientCode) throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreExceptionExports 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 java.util.List<fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.contract.ServiceContractDto> searchServiceContracts(boolean loadDetails, java.sql.Date minEndDate) throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreExceptionSearch 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
-
-