Class ServiceContractService

java.lang.Object
fr.paris.lutece.plugins.identitystore.service.contract.ServiceContractService

public class ServiceContractService extends Object
  • Method Details

    • instance

      public static ServiceContractService instance()
    • getActiveServiceContract

      public ServiceContract getActiveServiceContract(String clientCode) throws fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException
      Get the active ServiceContract associated to the given ClientApplication
      Parameters:
      clientCode - code of the ClientApplication requesting the change
      Returns:
      the active ServiceContract
      Throws:
      fr.paris.lutece.plugins.identitystore.web.exception.ResourceNotFoundException
      fr.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 new ServiceContract (if possible) and adds it to cache if active.
      Parameters:
      serviceContract - the service contract to create
      clientApplication - 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 existing ServiceContract (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 existing ServiceContract (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 a ServiceContract by its id in the database
      Parameters:
      id -
    • deleteApplication

      public void deleteApplication(ClientApplication clientApplication) throws fr.paris.lutece.plugins.identitystore.web.exception.IdentityStoreException
      Deletes a ClientApplication and all the related ServiceContract
      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 given ServiceContract is 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(Date testedDate, Date min, Date max)
    • getClientCodesFromAppCode

      public List<String> getClientCodesFromAppCode(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 the ServiceContract associated to the ClientApplication requesting 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 the IdentitySearchRequest against the ServiceContract associated to the ClientApplication requesting the search. Each violation is listed in the ClientAuthorizationException'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 - IdentitySearchRequest with list of attributes
      serviceContract - 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 the IdentityChangeRequest against the ServiceContract associated to the ClientApplication requesting the change. Each violation is listed in the ClientAuthorizationException'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 - IdentityChangeRequest with list of attributes
      serviceContract - 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 the IdentityChangeRequest against the ServiceContract associated to the ClientApplication requesting the change. Each violation is listed in the ClientAuthorizationException'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 - IdentityChangeRequest with list of attributes
      serviceContract - 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 the IdentityMergeRequest against the ServiceContract associated to the ClientApplication requesting the change. Each violation is listed in the IdentityMergeResponse with a status by attribute key. The following rules are verified:
      Parameters:
      request - IdentityMergeRequest with list of attributes
      serviceContract - service contract of the client requesting the change
      Throws:
      fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException
    • 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 the IdentityChangeRequest against the ServiceContract associated to the ClientApplication requesting the change. Each violation is listed in the IdentityChangeResponse with a status by attribute key. The following rules are verified:
      • The ClientApplication must 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 - IdentityChangeRequest with list of attributes
      serviceContract - the service contract of the client requesting the change
      Throws:
      fr.paris.lutece.plugins.identitystore.web.exception.ClientAuthorizationException - in case of error
    • 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.IdentityStoreException
      Exports 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