Class 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 Detail

      • INITIAL_START_DATE

        public static final java.time.LocalDateTime INITIAL_START_DATE
      • formatter

        public static final java.time.format.DateTimeFormatter formatter
    • 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 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​(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