org.eclipse.stardust.engine.api.runtime
Class DmsUtils

java.lang.Object
  extended by org.eclipse.stardust.engine.api.runtime.DmsUtils

public class DmsUtils
extends Object

Utility class for operating DocumentManagementService

Version:
$Revision$
Author:
rsauer

Constructor Summary
DmsUtils()
           
 
Method Summary
static ZipOutputStream backupToZipFile(Folder rootFolder, OutputStream outputStream, DocumentManagementService documentManagementService, boolean ignoreEmptyFolders, String partitionId)
          Backup a folder to a zip stream
static void cleanupFolder(Folder parentFolder, DocumentManagementService documentManagementService)
           
static String composeDefaultPath(long scopeProcessInstanceOID, Date scopeProcessInstanceStartTime)
          Initialize default path based on the scope process instance OID and its start time.
static String composeDefaultPath(long activityInstanceOID, long scopeProcessInstanceOID, Date scopeProcessInstanceStartTime)
          Initialize default path based on the activity instance OID, scope process instance OID and its start time.
static DocumentInfo createDocumentInfo(String name)
          Creates a new DocumentInfo object that can be filled with additional information.
static DocumentInfo createDocumentInfo(String name, String id)
          Creates a new DocumentInfo object that can be filled with additional information.
static FolderInfo createFolderInfo(String name)
          Creates a new FolderInfo object that can be filled with additional information.
static Folder ensureFolderHierarchyExists(String folderPath, DocumentManagementService dms)
           
static Long getActivityInstanceOid(Resource resource)
          Retrieves the activity instance oid from a Resource path.
static Document getDocument(List documents, String id)
           
static Long getProcessInstanceOid(Resource resource)
          Retrieves the process instance oid from a Resource path.
static void loadFromZipFile(String rootFolderPath, InputStream inputStream, DocumentManagementService documentManagementService, boolean ignoreEmptyFolders)
          Load a folder from an inputStream
static void removeDocument(List documents, String id)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DmsUtils

public DmsUtils()
Method Detail

createDocumentInfo

public static DocumentInfo createDocumentInfo(String name)
Creates a new DocumentInfo object that can be filled with additional information.

Parameters:
name - the document name
Returns:
the document info object

createDocumentInfo

public static DocumentInfo createDocumentInfo(String name,
                                              String id)
Creates a new DocumentInfo object that can be filled with additional information. This method allows assigning the document ID for the case where no DMS backend is used (the caller must ensure the uniqueness of IDs)

Parameters:
name - the document name
id - id of the document
Returns:
the document info object

createFolderInfo

public static FolderInfo createFolderInfo(String name)
Creates a new FolderInfo object that can be filled with additional information.

Parameters:
name - the folder name
Returns:
the folder info object

getDocument

public static Document getDocument(List documents,
                                   String id)

removeDocument

public static void removeDocument(List documents,
                                  String id)

composeDefaultPath

public static String composeDefaultPath(long scopeProcessInstanceOID,
                                        Date scopeProcessInstanceStartTime)
Initialize default path based on the scope process instance OID and its start time. Example: "/process-instances/2001/02/03/04/pi-567"

Parameters:
scopeProcessInstanceStartTime -
scopeProcessInstanceOID -
Returns:
path starting with / and ending with a process instance specific folder name (no trailing slash).

composeDefaultPath

public static String composeDefaultPath(long activityInstanceOID,
                                        long scopeProcessInstanceOID,
                                        Date scopeProcessInstanceStartTime)
Initialize default path based on the activity instance OID, scope process instance OID and its start time. Example: "/process-instances/2001/02/03/04/pi-567/ai-890"

Parameters:
activityInstanceOID -
scopeProcessInstanceStartTime -
scopeProcessInstanceOID -
Returns:
path starting with / and ending with a process instance specific folder name (no trailing slash).

getActivityInstanceOid

public static Long getActivityInstanceOid(Resource resource)
Retrieves the activity instance oid from a Resource path.

Parameters:
resource - with ai-oid in path
Returns:
null if not found in path.
See Also:
composeDefaultPath(long, long, Date)

getProcessInstanceOid

public static Long getProcessInstanceOid(Resource resource)
Retrieves the process instance oid from a Resource path.

Parameters:
resource - with pi-oid in path
Returns:
null if not found in path.
See Also:
composeDefaultPath(long, Date), composeDefaultPath(long, long, Date)

backupToZipFile

public static ZipOutputStream backupToZipFile(Folder rootFolder,
                                              OutputStream outputStream,
                                              DocumentManagementService documentManagementService,
                                              boolean ignoreEmptyFolders,
                                              String partitionId)
                                       throws Exception
Backup a folder to a zip stream

Parameters:
rootFolder - folder to backup
outputStream - the stream to use for ZipOutputStream
documentManagementService -
ignoreEmptyFolders - option to not backup empty folders
partitionId - used for zip comment
Returns:
the stream that contains the ZipEntries
Throws:
Exception

loadFromZipFile

public static void loadFromZipFile(String rootFolderPath,
                                   InputStream inputStream,
                                   DocumentManagementService documentManagementService,
                                   boolean ignoreEmptyFolders)
                            throws Exception
Load a folder from an inputStream

Parameters:
rootFolderPath - loaded data is saved to this repository path
inputStream - the stream is used to create a new ZipInputStream
documentManagementService -
ignoreEmptyFolders - option to not create empty folders that exist in the zip stream
Throws:
Exception

cleanupFolder

public static void cleanupFolder(Folder parentFolder,
                                 DocumentManagementService documentManagementService)

ensureFolderHierarchyExists

public static Folder ensureFolderHierarchyExists(String folderPath,
                                                 DocumentManagementService dms)


Copyright © 2017 Eclipse Stardust. All Rights Reserved.