Class StoreGraphService
- java.lang.Object
-
- fr.gouv.vitam.metadata.core.graph.StoreGraphService
-
public class StoreGraphService extends java.lang.Object
This class get units where calculated data are modified Zip generated files and store the zipped file in the offer.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
$_GTE
static java.lang.String
$_LT
static java.time.format.DateTimeFormatter
formatter
static java.lang.String
GRAPH
static java.time.LocalDateTime
INITIAL_START_DATE
static java.lang.String
UNDERSCORE
static java.lang.String
ZIP_EXTENTION
static java.lang.String
ZIP_PREFIX_NAME
-
Constructor Summary
Constructors Constructor Description StoreGraphService(VitamRepositoryProvider vitamRepositoryProvider)
StoreGraphService(VitamRepositoryProvider vitamRepositoryProvider, RestoreBackupService restoreBackupService, WorkspaceClientFactory workspaceClientFactory, StorageClientFactory storageClientFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.time.LocalDateTime
getLastGraphStoreDate(MetadataCollections metadataCollections)
As the files generated are zip files.boolean
isInProgress()
static java.time.LocalDateTime
parseGraphEndDateFromFileName(java.lang.String fileName)
static java.time.LocalDateTime
parseGraphStartDateFromFileName(java.lang.String fileName)
void
storeInWorkspace(java.lang.String containerName, java.lang.String graphFolder, java.util.List<org.bson.Document> documents)
Connect to workspace and store the collection of documents as json file The destination container is containerName The destination folder is GRAPHjava.util.Map<MetadataCollections,java.lang.Integer>
tryStoreGraph()
If no graph store in progress, try to start one Should be exposed in the APIvoid
zipAndSaveInOffer(DataCategory dataCategory, java.lang.String containerName, java.lang.String graphFolder, java.lang.String graphZipName, java.lang.String graph_store_name)
-
-
-
Field Detail
-
INITIAL_START_DATE
public static final java.time.LocalDateTime INITIAL_START_DATE
-
formatter
public static final java.time.format.DateTimeFormatter formatter
-
GRAPH
public static final java.lang.String GRAPH
- See Also:
- Constant Field Values
-
UNDERSCORE
public static final java.lang.String UNDERSCORE
- See Also:
- Constant Field Values
-
ZIP_EXTENTION
public static final java.lang.String ZIP_EXTENTION
- See Also:
- Constant Field Values
-
ZIP_PREFIX_NAME
public static final java.lang.String ZIP_PREFIX_NAME
- See Also:
- Constant Field Values
-
$_GTE
public static final java.lang.String $_GTE
- See Also:
- Constant Field Values
-
$_LT
public static final java.lang.String $_LT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StoreGraphService
public StoreGraphService(VitamRepositoryProvider vitamRepositoryProvider, RestoreBackupService restoreBackupService, WorkspaceClientFactory workspaceClientFactory, StorageClientFactory storageClientFactory)
- Parameters:
vitamRepositoryProvider
-restoreBackupService
-workspaceClientFactory
-storageClientFactory
-
-
StoreGraphService
public StoreGraphService(VitamRepositoryProvider vitamRepositoryProvider)
- Parameters:
vitamRepositoryProvider
-
-
-
Method Detail
-
getLastGraphStoreDate
public java.time.LocalDateTime getLastGraphStoreDate(MetadataCollections metadataCollections) throws StoreGraphException
As the files generated are zip files. There name is the last store date Load from the offer, the latest zip file Get His name The name of zip file is fromDate_endDate.zip yyyy-MM-dd-HH-mm-ss-SSS_yyyy-MM-dd-HH-mm-ss-SSS.zip Format the name to LocalDateTime- Parameters:
metadataCollections
- the concerned collection- Returns:
- The date of the last store operation
- Throws:
StoreGraphException
-
parseGraphStartDateFromFileName
public static java.time.LocalDateTime parseGraphStartDateFromFileName(java.lang.String fileName)
-
parseGraphEndDateFromFileName
public static java.time.LocalDateTime parseGraphEndDateFromFileName(java.lang.String fileName)
-
isInProgress
public boolean isInProgress()
-
tryStoreGraph
public java.util.Map<MetadataCollections,java.lang.Integer> tryStoreGraph() throws StoreGraphException
If no graph store in progress, try to start one Should be exposed in the API- Returns:
- the map of collection:number of treated documents
- Throws:
StoreGraphException
-
zipAndSaveInOffer
public void zipAndSaveInOffer(DataCategory dataCategory, java.lang.String containerName, java.lang.String graphFolder, java.lang.String graphZipName, java.lang.String graph_store_name) throws StoreGraphException
- Parameters:
dataCategory
- (Unit or GOT)containerName
-graphFolder
- the name of graph folder in the containergraphZipName
- the name if the zipFile in the containergraph_store_name
- the name of the zip file in the offer- Throws:
StoreGraphException
-
storeInWorkspace
public void storeInWorkspace(java.lang.String containerName, java.lang.String graphFolder, java.util.List<org.bson.Document> documents) throws StoreGraphException
Connect to workspace and store the collection of documents as json file The destination container is containerName The destination folder is GRAPH- Parameters:
documents
-- Throws:
StoreGraphException
-
-