Class ServiceContractService
- java.lang.Object
-
- fr.paris.lutece.plugins.identitystore.service.contract.ServiceContractService
-
public class ServiceContractService extends Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanCreateIdentity(String clientCode)booleancanDeleteIdentity(String clientCode)booleancanModifyConnectedIdentity(String clientCode)booleancanUncertifyIdentity(String clientCode)booleancanUpdateIdentity(String clientCode)ServiceContractclose(ServiceContract serviceContract)Closes an existingServiceContract(if possible) and adds it to cache if active.ServiceContractcreate(ServiceContract serviceContract, Integer applicationId)Creates a newServiceContract(if possible) and adds it to cache if active.voiddelete(Integer id)Deletes aServiceContractby its id in the databasevoiddeleteApplication(ClientApplication clientApplication)Deletes aClientApplicationand all the relatedServiceContractServiceContractgetActiveServiceContract(String clientCode)Get the activeServiceContractassociated to the givenClientApplicationList<String>getClientCodesFromAppCode(String appCode)get Client Code list From AppCodeintgetDataRetentionPeriodInMonths(String clientCode)List<String>getMandatoryAttributes(String clientCode, List<AttributeKey> sharedMandatoryAttributeList)static ServiceContractServiceinstance()booleanisInRange(Date testedDate, Date min, Date max)ServiceContractupdate(ServiceContract serviceContract, Integer applicationId)Update an existingServiceContract(if possible) and adds it to cache if active.fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeResponsevalidateIdentityChange(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeRequest identityChangeRequest, String clientCode)Validates theIdentityChangeRequestagainst theServiceContractassociated to theClientApplicationrequesting the change.fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeResponsevalidateIdentityImport(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeRequest identityChangeRequest, String clientCode)Validates theIdentityChangeRequestagainst theServiceContractassociated to theClientApplicationrequesting the change.fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.merge.IdentityMergeResponsevalidateIdentityMerge(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.merge.IdentityMergeRequest identityMergeRequest, String clientCode)Validates theIdentityMergeRequestagainst theServiceContractassociated to theClientApplicationrequesting the change.fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.search.IdentitySearchResponsevalidateIdentitySearch(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.search.IdentitySearchRequest identitySearchRequest, String clientCode, boolean checkContract)Validates theIdentitySearchRequestagainst theServiceContractassociated to theClientApplicationrequesting the search.
-
-
-
Method Detail
-
instance
public static ServiceContractService instance()
-
getActiveServiceContract
public ServiceContract getActiveServiceContract(String clientCode) throws ServiceContractNotFoundException
Get the activeServiceContractassociated to the givenClientApplication- Parameters:
clientCode- code of theClientApplicationrequesting the change- Returns:
- the active
ServiceContract - Throws:
ServiceContractNotFoundException
-
validateIdentityChange
public fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeResponse validateIdentityChange(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeRequest identityChangeRequest, String clientCode) throws ServiceContractNotFoundException, IdentityAttributeNotFoundExceptionValidates theIdentityChangeRequestagainst theServiceContractassociated to theClientApplicationrequesting the change. Each violation is listed in theIdentityChangeResponsewith a status by attribute key. The following rules are verified:
- 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 attributesclientCode- code of theClientApplicationrequesting the change- Returns:
IdentityChangeResponsecontaining the execution status- Throws:
ServiceContractNotFoundExceptionIdentityAttributeNotFoundException
-
validateIdentityMerge
public fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.merge.IdentityMergeResponse validateIdentityMerge(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.merge.IdentityMergeRequest identityMergeRequest, String clientCode) throws ServiceContractNotFoundExceptionValidates 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:
identityMergeRequest-IdentityMergeRequestwith list of attributesclientCode- code of theClientApplicationrequesting the change- Returns:
IdentityMergeResponsecontaining the execution status- Throws:
ServiceContractNotFoundException
- The
-
validateIdentityImport
public fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeResponse validateIdentityImport(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.crud.IdentityChangeRequest identityChangeRequest, String clientCode) throws ServiceContractNotFoundException, IdentityAttributeNotFoundExceptionValidates 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
- Parameters:
identityChangeRequest-IdentityMergeRequestwith list of attributesclientCode- code of theClientApplicationrequesting the change- Returns:
IdentityMergeResponsecontaining the execution status- Throws:
ServiceContractNotFoundExceptionIdentityAttributeNotFoundException
- The
-
validateIdentitySearch
public fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.search.IdentitySearchResponse validateIdentitySearch(fr.paris.lutece.plugins.identitystore.v3.web.rs.dto.search.IdentitySearchRequest identitySearchRequest, String clientCode, boolean checkContract) throws ServiceContractNotFoundExceptionValidates theIdentitySearchRequestagainst theServiceContractassociated to theClientApplicationrequesting the search. Each violation is listed in the response with a status by attribute key. The following rules are verified:
- The attribute must be searchable
- Parameters:
identitySearchRequest-IdentitySearchRequestwith list of attributesclientCode- code of theClientApplicationrequesting the search- Throws:
ServiceContractNotFoundException
-
getMandatoryAttributes
public List<String> getMandatoryAttributes(String clientCode, List<AttributeKey> sharedMandatoryAttributeList) throws ServiceContractNotFoundException
- Throws:
ServiceContractNotFoundException
-
canModifyConnectedIdentity
public boolean canModifyConnectedIdentity(String clientCode) throws ServiceContractNotFoundException
- Throws:
ServiceContractNotFoundException
-
canCreateIdentity
public boolean canCreateIdentity(String clientCode) throws ServiceContractNotFoundException
- Throws:
ServiceContractNotFoundException
-
canUpdateIdentity
public boolean canUpdateIdentity(String clientCode) throws ServiceContractNotFoundException
- Throws:
ServiceContractNotFoundException
-
canUncertifyIdentity
public boolean canUncertifyIdentity(String clientCode) throws ServiceContractNotFoundException
- Throws:
ServiceContractNotFoundException
-
canDeleteIdentity
public boolean canDeleteIdentity(String clientCode) throws ServiceContractNotFoundException
- Throws:
ServiceContractNotFoundException
-
getDataRetentionPeriodInMonths
public int getDataRetentionPeriodInMonths(String clientCode) throws ServiceContractNotFoundException
- Throws:
ServiceContractNotFoundException
-
create
public ServiceContract create(ServiceContract serviceContract, Integer applicationId) throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
Creates a newServiceContract(if possible) and adds it to cache if active. The contract can be created if:- The start date of the contract is not in the range [start date; end date] of an existing contract
- The end date of the contract is not in the range [start date; end date] of an existing contract
- Parameters:
serviceContract-applicationId-- Returns:
- Throws:
fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
-
update
public ServiceContract update(ServiceContract serviceContract, Integer applicationId) throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
Update an existingServiceContract(if possible) and adds it to cache if active. The contract can be updated if:- The start date of the contract is not in the range [start date; end date] of an existing contract
- The end date of the contract is not in the range [start date; end date] of an existing contract
- Parameters:
serviceContract-applicationId-- 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(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
-
-