Package fr.gouv.vitam.processing.data.core.management

# Class WorkspaceProcessDataManagement

java.lang.Object
fr.gouv.vitam.processing.data.core.management.WorkspaceProcessDataManagement

All Implemented Interfaces:
  `ProcessDataManagement`

public class WorkspaceProcessDataManagement extends Object implements ProcessDataManagement
Workspace implemenation for workflows datas management

- ## Field Summary

  ### Fields inherited from interface fr.gouv.vitam.processing.data.core.management.ProcessDataManagement

  `DISTRIBUTOR_INDEX, PROCESS_CONTAINER`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `WorkspaceProcessDataManagement(WorkspaceClientFactory workspaceClientFactory)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `createFolder(String folderName)`
  Create a folder with the name {folderName} if does not exist on the process container
  `boolean`
  `createProcessContainer()`
  Create the process container (initialisation) if does not exist
  `Optional<DistributorIndex>`
  `getDistributorIndex(String fileName)`
  `static ProcessDataManagement`
  `getInstance()`
  Get the current instance
  `ProcessWorkflow`
  `getProcessWorkflow(String folderName, String asyncId)`
  Retrieve a workflow instance on process container
  `Map<String,ProcessWorkflow>`
  `getProcessWorkflowFor(Integer tenantId, String folderName)`
  Get process workflow map for tenantId and folderName (server id from serverIdentity)
  `boolean`
  `isFolderExist(String folderName)`
  Check if the folder with name {folderName} exists on process container
  `boolean`
  `isProcessContainerExist()`
  Check if the process container exists
  `void`
  `persistDistributorIndex(String fileName, DistributorIndex distributorIndex)`
  `void`
  `persistProcessWorkflow(String folderName, ProcessWorkflow processWorkflow)`
  Put process workflow instance in workspace
  `boolean`
  `removeFolder(String folderName)`
  Delete folder with name {folderName} if exists on process container
  `boolean`
  `removeOperationContainer(ProcessWorkflow processWorkflow, WorkspaceClientFactory workspaceClientFactory)`
  `void`
  `removeProcessWorkflow(String folderName, String asyncId)`
  Delete process workflow from the workspace

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

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

- ## Constructor Details

  - ### WorkspaceProcessDataManagement

    public WorkspaceProcessDataManagement(WorkspaceClientFactory workspaceClientFactory)

- ## Method Details

  - ### getInstance

    public static ProcessDataManagement getInstance()
    Get the current instance
    Returns:
      the current instance

  - ### createProcessContainer

    public boolean createProcessContainer() throws ProcessingStorageWorkspaceException
    Description copied from interface: `ProcessDataManagement`
    Create the process container (initialisation) if does not exist
    Specified by:
      `createProcessContainer` in interface `ProcessDataManagement`
    Returns:
      true if the container was created, false if it already exists
    Throws:
      `ProcessingStorageWorkspaceException` - when storage error occurs

  - ### isProcessContainerExist

    public boolean isProcessContainerExist() throws ProcessingStorageWorkspaceException
    Description copied from interface: `ProcessDataManagement`
    Check if the process container exists
    Specified by:
      `isProcessContainerExist` in interface `ProcessDataManagement`
    Returns:
      true if the container exists, false otherwise
    Throws:
      `ProcessingStorageWorkspaceException` - when storage error occurs

  - ### createFolder

    public boolean createFolder(String folderName) throws ProcessingStorageWorkspaceException
    Description copied from interface: `ProcessDataManagement`
    Create a folder with the name {folderName} if does not exist on the process container
    Specified by:
      `createFolder` in interface `ProcessDataManagement`
    Parameters:
      `folderName` - the name of the folder to create
    Returns:
      true if the folder was created, false if it already exists
    Throws:
      `ProcessingStorageWorkspaceException` - when storage error occurs

  - ### isFolderExist

    public boolean isFolderExist(String folderName) throws ProcessingStorageWorkspaceException
    Description copied from interface: `ProcessDataManagement`
    Check if the folder with name {folderName} exists on process container
    Specified by:
      `isFolderExist` in interface `ProcessDataManagement`
    Parameters:
      `folderName` - the folder name to check
    Returns:
      true if folder exists on process container, false otherwise
    Throws:
      `ProcessingStorageWorkspaceException` - when storage error occurs

  - ### removeFolder

    public boolean removeFolder(String folderName) throws ProcessingStorageWorkspaceException
    Description copied from interface: `ProcessDataManagement`
    Delete folder with name {folderName} if exists on process container
    Specified by:
      `removeFolder` in interface `ProcessDataManagement`
    Parameters:
      `folderName` - the folderName to delete
    Returns:
      true if the folder was removed, false if it does not exist
    Throws:
      `ProcessingStorageWorkspaceException` - when storage error occurs

  - ### persistProcessWorkflow

    public void persistProcessWorkflow(String folderName, ProcessWorkflow processWorkflow) throws ProcessingStorageWorkspaceException, InvalidParseOperationException
    Description copied from interface: `ProcessDataManagement`
    Put process workflow instance in workspace
    Specified by:
      `persistProcessWorkflow` in interface `ProcessDataManagement`
    Parameters:
      `folderName` - the folder to put workflow instance on process container
      `processWorkflow` - the instance to save
    Throws:
      `ProcessingStorageWorkspaceException` - when storage error occurs
      `InvalidParseOperationException` - when serializing object to json fail

  - ### persistDistributorIndex

    public void persistDistributorIndex(String fileName, DistributorIndex distributorIndex) throws ProcessingStorageWorkspaceException, InvalidParseOperationException
    Specified by:
      `persistDistributorIndex` in interface `ProcessDataManagement`
    Throws:
      `ProcessingStorageWorkspaceException`
      `InvalidParseOperationException`

  - ### getDistributorIndex

    public Optional<DistributorIndex> getDistributorIndex(String fileName) throws ProcessingStorageWorkspaceException, InvalidParseOperationException
    Specified by:
      `getDistributorIndex` in interface `ProcessDataManagement`
    Throws:
      `ProcessingStorageWorkspaceException`
      `InvalidParseOperationException`

  - ### getProcessWorkflow

    public ProcessWorkflow getProcessWorkflow(String folderName, String asyncId) throws ProcessingStorageWorkspaceException, InvalidParseOperationException
    Description copied from interface: `ProcessDataManagement`
    Retrieve a workflow instance on process container
    Specified by:
      `getProcessWorkflow` in interface `ProcessDataManagement`
    Parameters:
      `folderName` - the folder on process container to get workflow instance
      `asyncId` - the request id (asynchronous id)
    Returns:
      the workflow instance
    Throws:
      `ProcessingStorageWorkspaceException` - when storage error occurs
      `InvalidParseOperationException` - when deserializing object to json fail

  - ### removeProcessWorkflow

    public void removeProcessWorkflow(String folderName, String asyncId) throws ProcessingStorageWorkspaceException
    Description copied from interface: `ProcessDataManagement`
    Delete process workflow from the workspace
    Specified by:
      `removeProcessWorkflow` in interface `ProcessDataManagement`
    Parameters:
      `folderName` - the folder on process container to remove workflow instance
      `asyncId` - the request id (asynchronous id)
    Throws:
      `ProcessingStorageWorkspaceException` - when storage error occurs

  - ### getProcessWorkflowFor

    public Map<String,ProcessWorkflow> getProcessWorkflowFor(Integer tenantId, String folderName) throws ProcessingStorageWorkspaceException
    Description copied from interface: `ProcessDataManagement`
    Get process workflow map for tenantId and folderName (server id from serverIdentity)
    Specified by:
      `getProcessWorkflowFor` in interface `ProcessDataManagement`
    Parameters:
      `tenantId` - the tenant ID
      `folderName` - the folder name (server id from serverIdentity)
    Returns:
      map of tenantID process for a server id
    Throws:
      `ProcessingStorageWorkspaceException` - thrown if an error ocurred when loading process file

  - ### removeOperationContainer

    public boolean removeOperationContainer(ProcessWorkflow processWorkflow, WorkspaceClientFactory workspaceClientFactory)
    Specified by:
      `removeOperationContainer` in interface `ProcessDataManagement`