Class AgenciesService
- java.lang.Object
-
- fr.gouv.vitam.functional.administration.agencies.api.AgenciesService
-
- All Implemented Interfaces:
VitamAutoCloseable,java.lang.AutoCloseable
public class AgenciesService extends java.lang.Object implements VitamAutoCloseable
AgenciesService class allowing multiple operation on AgenciesService collection
-
-
Field Summary
Fields Modifier and Type Field Description static VitamLoggerLOGGER
-
Constructor Summary
Constructors Constructor Description AgenciesService(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, FunctionalBackupService backupService, OntologyLoader ontologyLoader)AgenciesService(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, FunctionalBackupService backupService, LogbookOperationsClientFactory logbookOperationsClientFactory, fr.gouv.vitam.functional.administration.agencies.api.AgenciesManager manager, java.util.Set<AgenciesModel> agenciesInDb, java.util.Set<AgenciesModel> agenciesToDelete, java.util.Set<AgenciesModel> agenciesToInsert, java.util.Set<AgenciesModel> agenciesToUpdate, java.util.Set<AgenciesModel> usedAgenciesByAU, java.util.Set<AgenciesModel> usedAgenciesByContracts, java.util.Set<AgenciesModel> unusedAgenciesToDelete, OntologyLoader ontologyLoader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckAgenciesInDb()Check agencies in databasevoidcheckFile(java.io.InputStream stream)Check file integrityvoidclose()DbRequestResultfindAgencies(com.fasterxml.jackson.databind.JsonNode queryDsl)Find agencies with a specific queryvoidfindAllAgenciesUsedByAccessContracts()Find all agencies used by access contractsvoidfindAllAgenciesUsedByUnits()Construct query DSL for find all Agencies (referential)RequestResponseOKfindDocuments(com.fasterxml.jackson.databind.JsonNode select)Find documents with a queryjava.io.InputStreamgenerateErrorReport()Generate an error reportRequestResponse<AgenciesModel>importAgencies(java.io.InputStream stream, java.lang.String filename)Import an input stream into agencies collection
-
-
-
Field Detail
-
LOGGER
public static final VitamLogger LOGGER
-
-
Constructor Detail
-
AgenciesService
public AgenciesService(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, FunctionalBackupService backupService, OntologyLoader ontologyLoader) throws InvalidGuidOperationException
- Throws:
InvalidGuidOperationException
-
AgenciesService
public AgenciesService(MongoDbAccessAdminImpl mongoAccess, VitamCounterService vitamCounterService, FunctionalBackupService backupService, LogbookOperationsClientFactory logbookOperationsClientFactory, fr.gouv.vitam.functional.administration.agencies.api.AgenciesManager manager, java.util.Set<AgenciesModel> agenciesInDb, java.util.Set<AgenciesModel> agenciesToDelete, java.util.Set<AgenciesModel> agenciesToInsert, java.util.Set<AgenciesModel> agenciesToUpdate, java.util.Set<AgenciesModel> usedAgenciesByAU, java.util.Set<AgenciesModel> usedAgenciesByContracts, java.util.Set<AgenciesModel> unusedAgenciesToDelete, OntologyLoader ontologyLoader)
-
-
Method Detail
-
findDocuments
public RequestResponseOK findDocuments(com.fasterxml.jackson.databind.JsonNode select) throws ReferentialException
Find documents with a query- Parameters:
select- the query as a json- Returns:
- list of response as a RequestResponseOK object
- Throws:
ReferentialException- thrown if an error is encountered
-
findAllAgenciesUsedByUnits
public void findAllAgenciesUsedByUnits() throws VitamExceptionConstruct query DSL for find all Agencies (referential)- Throws:
VitamException- thrown if query could not be executed
-
findAllAgenciesUsedByAccessContracts
public void findAllAgenciesUsedByAccessContracts() throws InvalidCreateOperationException, VitamExceptionFind all agencies used by access contracts- Throws:
InvalidCreateOperationException- thrown if the query could not be createdVitamException- thrown if an error is encountered
-
checkFile
public void checkFile(java.io.InputStream stream) throws ReferentialException, java.io.IOExceptionCheck file integrity- Parameters:
stream- the stream to be checked- Throws:
ReferentialException- thrown if the file is not correctjava.io.IOException- thrown if the file could be read
-
checkAgenciesInDb
public void checkAgenciesInDb() throws ReferentialExceptionCheck agencies in database- Throws:
ReferentialException
-
importAgencies
public RequestResponse<AgenciesModel> importAgencies(java.io.InputStream stream, java.lang.String filename) throws VitamException, java.io.IOException
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 initializedjava.io.IOException- thrown in case or error with streamInvalidCreateOperationException- thrown if the error report could not be stored
-
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()
Generate an error report- Returns:
- an input stream containing the report
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceVitamAutoCloseable
-
-