Class AgenciesService
- java.lang.Object
-
- fr.gouv.vitam.functional.administration.core.agencies.AgenciesService
-
public class AgenciesService extends java.lang.Object
AgenciesService class allowing multiple operation on AgenciesService collection
-
-
Field Summary
Fields Modifier and Type Field Description static 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DbRequestResult
findAgencies(com.fasterxml.jackson.databind.JsonNode queryDsl)
Find agencies with a specific queryjava.io.InputStream
generateErrorReport(AgenciesImportResult agenciesImportResult)
Generate an error reportRequestResponse<AgenciesModel>
importAgencies(java.io.InputStream stream, java.lang.String filename)
Import an input stream into agencies collectionAgenciesImportResult
parseFile(java.io.File csvFile)
convert csv file into a set of AgenciesModeljava.util.Set<AgenciesModel>
retrieveAgenciesInDb()
Retrieve agencies in database
-
-
-
Field Detail
-
LOGGER
public static final VitamLogger LOGGER
-
-
Constructor Detail
-
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 Detail
-
parseFile
public AgenciesImportResult parseFile(java.io.File csvFile) throws java.io.IOException, ReferentialException
convert csv file into a set of AgenciesModel- Parameters:
csvFile
- the stream to be converted- Returns:
- a set of AgenciesModel
- Throws:
java.io.IOException
- thrown if the file could be readReferentialException
-
retrieveAgenciesInDb
public java.util.Set<AgenciesModel> retrieveAgenciesInDb() throws ReferentialException
Retrieve agencies in database- Returns:
- list of agencies in database
- Throws:
ReferentialException
-
importAgencies
public RequestResponse<AgenciesModel> importAgencies(java.io.InputStream stream, java.lang.String filename) throws VitamException
Import an input stream into agencies collection- Parameters:
stream
- the stream to be importedfilename
- 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 java.io.InputStream generateErrorReport(AgenciesImportResult agenciesImportResult)
Generate an error report- Returns:
- an input stream containing the report
-
-