Class RulesManagerFileImpl
- java.lang.Object
-
- fr.gouv.vitam.functional.administration.core.rules.RulesManagerFileImpl
-
- All Implemented Interfaces:
ReferentialFile<FileRules>
public class RulesManagerFileImpl extends java.lang.Object implements ReferentialFile<FileRules>
RulesManagerFileImplManage the Rules File features
-
-
Constructor Summary
Constructors Constructor Description RulesManagerFileImpl(MongoDbAccessAdminImpl dbConfiguration, VitamCounterService vitamCounterService, VitamRuleService vitamRuleService, int ruleAuditThreadPoolSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RuleImportResultSet
checkFile(java.util.Map<java.lang.String,FileRulesModel> rulesToImport)
Checks File : checks if a stream of referential data is validvoid
checkRuleConformity(java.util.List<java.lang.Integer> tenants)
FileRules
findDocumentById(java.lang.String id)
find document based on a given IdRequestResponseOK<FileRules>
findDocuments(com.fasterxml.jackson.databind.JsonNode select)
find document based on DSL queryjava.io.InputStream
generateReportContent(java.util.Map<java.lang.Integer,java.util.List<ErrorReport>> errors, java.util.List<FileRulesModel> usedDeletedRules, java.util.List<FileRulesModel> usedRulesWithDurationModeUpdate, java.util.List<FileRulesModel> usedUpdatedRules, java.util.List<FileRulesModel> fileRulesModelToDelete, java.util.List<FileRulesModel> fileRulesModelToUpdate, java.util.List<FileRulesModel> fileRulesModelToInsert, StatusCode status, GUID eipMaster)
generate Error Reportjava.util.Map<java.lang.String,FileRulesModel>
getRulesFromCSV(java.io.InputStream ruleInputStream)
void
importFile(java.io.InputStream rulesFileStream, java.lang.String filename)
importFile : import reference file to databasejava.util.Map<java.lang.String,FileRulesModel>
processRuleParsing(java.io.File file, java.lang.String filename, GUID eip)
-
-
-
Constructor Detail
-
RulesManagerFileImpl
public RulesManagerFileImpl(MongoDbAccessAdminImpl dbConfiguration, VitamCounterService vitamCounterService, VitamRuleService vitamRuleService, int ruleAuditThreadPoolSize)
-
-
Method Detail
-
importFile
public void importFile(java.io.InputStream rulesFileStream, java.lang.String filename) throws java.io.IOException, InvalidParseOperationException, ReferentialException, StorageException, InvalidGuidOperationException, LogbookClientException, IllegalPathException
Description copied from interface:ReferentialFile
importFile : import reference file to database- Specified by:
importFile
in interfaceReferentialFile<FileRules>
- Parameters:
rulesFileStream
- as InputStreamfilename
- file name- Throws:
java.io.IOException
InvalidParseOperationException
ReferentialException
- when there is error of importStorageException
InvalidGuidOperationException
LogbookClientException
IllegalPathException
-
processRuleParsing
public java.util.Map<java.lang.String,FileRulesModel> processRuleParsing(java.io.File file, java.lang.String filename, GUID eip) throws FileRulesReadException, StorageException, InvalidParseOperationException, java.io.IOException, LogbookClientException
- Throws:
FileRulesReadException
StorageException
InvalidParseOperationException
java.io.IOException
LogbookClientException
-
checkFile
public RuleImportResultSet checkFile(java.util.Map<java.lang.String,FileRulesModel> rulesToImport) throws ReferentialException
Checks File : checks if a stream of referential data is valid- Parameters:
rulesToImport
- rules to import- Returns:
- The rules to import
- Throws:
ReferentialException
- when there is errors import
-
getRulesFromCSV
public java.util.Map<java.lang.String,FileRulesModel> getRulesFromCSV(java.io.InputStream ruleInputStream) throws java.io.IOException, FileRulesReadException
- Throws:
java.io.IOException
FileRulesReadException
-
findDocumentById
public FileRules findDocumentById(java.lang.String id)
Description copied from interface:ReferentialFile
find document based on a given Id- Specified by:
findDocumentById
in interfaceReferentialFile<FileRules>
- Parameters:
id
- of vitam document- Returns:
- vitam document
-
findDocuments
public RequestResponseOK<FileRules> findDocuments(com.fasterxml.jackson.databind.JsonNode select) throws ReferentialException
Description copied from interface:ReferentialFile
find document based on DSL query- Specified by:
findDocuments
in interfaceReferentialFile<FileRules>
- Parameters:
select
- filter- Returns:
- vitam document list
- Throws:
FileFormatNotFoundException
- when no results foundReferentialException
- when error occurs
-
generateReportContent
public java.io.InputStream generateReportContent(java.util.Map<java.lang.Integer,java.util.List<ErrorReport>> errors, java.util.List<FileRulesModel> usedDeletedRules, java.util.List<FileRulesModel> usedRulesWithDurationModeUpdate, java.util.List<FileRulesModel> usedUpdatedRules, java.util.List<FileRulesModel> fileRulesModelToDelete, java.util.List<FileRulesModel> fileRulesModelToUpdate, java.util.List<FileRulesModel> fileRulesModelToInsert, StatusCode status, GUID eipMaster)
generate Error Report- Parameters:
errors
- the list of error for generated errorsusedDeletedRules
- list of fileRules that attempt to be deleted but have reference to unitusedRulesWithDurationModeUpdate
- list of fileRules referenced by a unit, with duration mode update (defined to undefined, or undefined to defined)usedUpdatedRules
- list of fileRules that attempt to be updated but have reference to unitstatus
- statuseipMaster
- eipMaster- Returns:
- the error report inputStream
-
checkRuleConformity
public void checkRuleConformity(java.util.List<java.lang.Integer> tenants) throws ReferentialException
- Throws:
ReferentialException
-
-