Package fr.gouv.vitam.functional.administration.core.agencies

# Class AgenciesService

java.lang.Object
fr.gouv.vitam.functional.administration.core.agencies.AgenciesService

public class AgenciesService extends Object
AgenciesService class allowing multiple operation on AgenciesService collection

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `CSV_MULTIPLE_STRINGS_SEPARATOR`
  `static final VitamLogger`
  `LOGGER`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AgenciesService(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, FunctionalBackupService backupService)`
  `AgenciesService(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, FunctionalBackupService backupService, fr.gouv.vitam.functional.administration.core.agencies.LogbookAgenciesImportManager manager, ContractService<AccessContractModel> accessContractService)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DbRequestResult`
  `findAgencies(com.fasterxml.jackson.databind.JsonNode queryDsl)`
  Find agencies with a specific query
  `InputStream`
  `generateErrorReport(AgenciesImportResult agenciesImportResult)`
  Generate an error report
  `RequestResponse<AgenciesModel>`
  `importAgencies(InputStream stream, String filename)`
  Import an input stream into agencies collection
  `AgenciesImportResult`
  `parseFile(File csvFile)`
  convert csv file into a set of AgenciesModel
  `Set<AgenciesModel>`
  `retrieveAgenciesInDb()`
  Retrieve agencies in database

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### LOGGER

    public static final VitamLogger LOGGER

  - ### CSV_MULTIPLE_STRINGS_SEPARATOR

    public static final String CSV_MULTIPLE_STRINGS_SEPARATOR
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### AgenciesService

    public AgenciesService(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, FunctionalBackupService backupService)

  - ### AgenciesService

    public AgenciesService(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, FunctionalBackupService backupService, fr.gouv.vitam.functional.administration.core.agencies.LogbookAgenciesImportManager manager, ContractService<AccessContractModel> accessContractService)

- ## Method Details

  - ### parseFile

    public AgenciesImportResult parseFile(File csvFile) throws IOException, ReferentialException
    convert csv file into a set of AgenciesModel
    Parameters:
      `csvFile` - the stream to be converted
    Returns:
      a set of AgenciesModel
    Throws:
      `IOException` - thrown if the file could be read
      `ReferentialException`

  - ### retrieveAgenciesInDb

    public Set<AgenciesModel> retrieveAgenciesInDb() throws ReferentialException
    Retrieve agencies in database
    Returns:
      list of agencies in database
    Throws:
      `ReferentialException`

  - ### importAgencies

    public RequestResponse<AgenciesModel> importAgencies(InputStream stream, String filename) throws VitamException
    Import an input stream into agencies collection
    Parameters:
      `stream` - the stream to be imported
      `filename` - the file name
    Returns:
      a response as a RequestResponse object
    Throws:
      `VitamException` - thrown if logbook could not be initialized

  - ### findAgencies

    public DbRequestResult findAgencies(com.fasterxml.jackson.databind.JsonNode queryDsl) throws ReferentialException
    Find agencies with a specific query
    Parameters:
      `queryDsl` - the query to be executed
    Returns:
      a DbRequestResult containing agencies
    Throws:
      `ReferentialException` - thrown if the query could not be executed

  - ### generateErrorReport

    public InputStream generateErrorReport(AgenciesImportResult agenciesImportResult)
    Generate an error report
    Returns:
      an input stream containing the report