Package fr.gouv.vitam.metadata.core.graph

# Class StoreGraphService

java.lang.Object
fr.gouv.vitam.metadata.core.graph.StoreGraphService

public class StoreGraphService extends 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 final String`
  `$_GTE`
  `static final String`
  `$_LT`
  `static final DateTimeFormatter`
  `formatter`
  `static final String`
  `GRAPH`
  `static final LocalDateTime`
  `INITIAL_START_DATE`
  `static final String`
  `UNDERSCORE`
  `static final String`
  `ZIP_EXTENTION`
  `static final String`
  `ZIP_PREFIX_NAME`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `StoreGraphService(VitamRepositoryProvider vitamRepositoryProvider)`
  `StoreGraphService(VitamRepositoryProvider vitamRepositoryProvider, RestoreBackupService restoreBackupService, WorkspaceClientFactory workspaceClientFactory, StorageClientFactory storageClientFactory)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `LocalDateTime`
  `getLastGraphStoreDate(MetadataCollections metadataCollections)`
  As the files generated are zip files.
  `boolean`
  `isInProgress()`
  `static LocalDateTime`
  `parseGraphEndDateFromFileName(String fileName)`
  `static LocalDateTime`
  `parseGraphStartDateFromFileName(String fileName)`
  `void`
  `storeInWorkspace(String containerName, String graphFolder, 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 GRAPH
  `Map<MetadataCollections,Integer>`
  `tryStoreGraph()`
  If no graph store in progress, try to start one Should be exposed in the API
  `void`
  `zipAndSaveInOffer(DataCategory dataCategory, String containerName, String graphFolder, String graphZipName, String graph_store_name)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### INITIAL_START_DATE

    public static final LocalDateTime INITIAL_START_DATE

  - ### formatter

    public static final DateTimeFormatter formatter

  - ### GRAPH

    public static final String GRAPH
    See Also:
      - Constant Field Values

  - ### UNDERSCORE

    public static final String UNDERSCORE
    See Also:
      - Constant Field Values

  - ### ZIP_EXTENTION

    public static final String ZIP_EXTENTION
    See Also:
      - Constant Field Values

  - ### ZIP_PREFIX_NAME

    public static final String ZIP_PREFIX_NAME
    See Also:
      - Constant Field Values

  - ### $_GTE

    public static final String $_GTE
    See Also:
      - Constant Field Values

  - ### $_LT

    public static final String $_LT
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### StoreGraphService

    public StoreGraphService(VitamRepositoryProvider vitamRepositoryProvider, RestoreBackupService restoreBackupService, WorkspaceClientFactory workspaceClientFactory, StorageClientFactory storageClientFactory)
    Parameters:
      `vitamRepositoryProvider` -
      `restoreBackupService` -
      `workspaceClientFactory` -
      `storageClientFactory` -

  - ### StoreGraphService

    public StoreGraphService(VitamRepositoryProvider vitamRepositoryProvider)
    Parameters:
      `vitamRepositoryProvider` -

- ## Method Details

  - ### getLastGraphStoreDate

    public 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 LocalDateTime parseGraphStartDateFromFileName(String fileName)

  - ### parseGraphEndDateFromFileName

    public static LocalDateTime parseGraphEndDateFromFileName(String fileName)

  - ### isInProgress

    public boolean isInProgress()

  - ### tryStoreGraph

    public Map<MetadataCollections,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, String containerName, String graphFolder, String graphZipName, String graph_store_name) throws StoreGraphException
    Parameters:
      `dataCategory` - (Unit or GOT)
      `containerName` -
      `graphFolder` - the name of graph folder in the container
      `graphZipName` - the name if the zipFile in the container
      `graph_store_name` - the name of the zip file in the offer
    Throws:
      `StoreGraphException`

  - ### storeInWorkspace

    public void storeInWorkspace(String containerName, String graphFolder, 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`