public class AgenciesService extends Object implements VitamAutoCloseable
| Modifier and Type | Field and Description |
|---|---|
static String |
AGENCIES_BACKUP_EVENT |
static String |
AGENCIES_IMPORT_EVENT |
static String |
AGENCIES_REPORT_EVENT |
static String |
IMPORT_AGENCIES_BACKUP_CSV |
static VitamLogger |
LOGGER |
| Constructor and Description |
|---|
AgenciesService(MongoDbAccessAdminImpl mongoAccess,
VitamCounterService vitamCounterService,
FunctionalBackupService backupService)
Constructor
|
AgenciesService(MongoDbAccessAdminImpl mongoAccess,
VitamCounterService vitamCounterService,
FunctionalBackupService backupService,
LogbookOperationsClientFactory logbookOperationsClientFactory,
fr.gouv.vitam.functional.administration.agencies.api.AgenciesManager manager,
List<AgenciesModel> agenciesInDb,
List<AgenciesModel> agenciesToDelete,
List<AgenciesModel> agenciesToInsert,
List<AgenciesModel> agenciesToUpdate,
List<AgenciesModel> usedAgenciesByAU,
List<AgenciesModel> usedAgenciesByContracts)
Constructor for test purposes
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkAgenciesInDb()
Check agencies in database
|
void |
checkFile(InputStream stream)
Check file integrity
|
void |
close() |
DbRequestResult |
findAgencies(com.fasterxml.jackson.databind.JsonNode queryDsl)
Find agencies with a specific query
|
List<Agencies> |
findAllAgencies()
Construct query DSL for find all Agencies (referential)
|
void |
findAllAgenciesUsedByAccessContracts()
Find all agencies used by access contracts
|
void |
findAllAgenciesUsedByUnits()
Construct query DSL for find all Agencies (referential)
|
VitamDocument<Agencies> |
findDocumentById(String id)
Find a document by its identifier
|
RequestResponseOK |
findDocuments(com.fasterxml.jackson.databind.JsonNode select)
Find documents with a query
|
InputStream |
generateErrorReport()
Generate an error report
|
RequestResponse<AgenciesModel> |
importAgencies(InputStream stream,
String filename)
Import an input stream into agencies collection
|
public static final String AGENCIES_IMPORT_EVENT
public static final String AGENCIES_REPORT_EVENT
public static final String AGENCIES_BACKUP_EVENT
public static final String IMPORT_AGENCIES_BACKUP_CSV
public static final VitamLogger LOGGER
public AgenciesService(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, FunctionalBackupService backupService)
mongoAccess - MongoDB clientvitamCounterService - the vitam counter servicebackupService - the FunctionalBackupServicepublic AgenciesService(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, FunctionalBackupService backupService, LogbookOperationsClientFactory logbookOperationsClientFactory, fr.gouv.vitam.functional.administration.agencies.api.AgenciesManager manager, List<AgenciesModel> agenciesInDb, List<AgenciesModel> agenciesToDelete, List<AgenciesModel> agenciesToInsert, List<AgenciesModel> agenciesToUpdate, List<AgenciesModel> usedAgenciesByAU, List<AgenciesModel> usedAgenciesByContracts)
mongoAccess - MongoDB clientvitamCounterService - the vitam counter servicebackupService - the FunctionalBackupServicelogbookOperationsClientFactory - the logbook operaction client factorymanager - the agency manageragenciesInDb - the list of agencies in DBagenciesToDelete - the list of agencies to be deletedagenciesToInsert - the list of agencies to be insertedagenciesToUpdate - the list of agencies to be updatedusedAgenciesByAU - the list of agencies used in AUusedAgenciesByContracts - the list of agencies used in contractspublic VitamDocument<Agencies> findDocumentById(String id) throws ReferentialException
id - the document idReferentialException - thrown if the agency is not found or if the an error is encounteredpublic RequestResponseOK findDocuments(com.fasterxml.jackson.databind.JsonNode select) throws ReferentialException
select - the query as a jsonReferentialException - thrown if an error is encounteredpublic List<Agencies> findAllAgencies()
public void findAllAgenciesUsedByUnits()
throws VitamException
VitamException - thrown if query could not be executedpublic void findAllAgenciesUsedByAccessContracts()
throws InvalidCreateOperationException,
VitamException
InvalidCreateOperationException - thrown if the query could not be createdVitamException - thrown if an error is encounteredpublic void checkFile(InputStream stream) throws ReferentialException, IOException
stream - the stream to be checkedReferentialException - thrown if the file is not correctIOException - thrown if the file could be readpublic void checkAgenciesInDb()
public RequestResponse<AgenciesModel> importAgencies(InputStream stream, String filename) throws VitamException, IOException
stream - the stream to be importedfilename - the file nameVitamException - thrown if logbook could not be initializedIOException - thrown in case or error with streamInvalidCreateOperationException - thrown if the error report could not be storedpublic DbRequestResult findAgencies(com.fasterxml.jackson.databind.JsonNode queryDsl) throws ReferentialException
queryDsl - the query to be executedReferentialException - thrown if the query could not be executedpublic InputStream generateErrorReport()
public void close()
close in interface VitamAutoCloseableclose in interface AutoCloseableCopyright © 2018 Vitam. All rights reserved.