org.eclipse.stardust.engine.core.spi.dms
Class RepositoryResourceUtils

java.lang.Object
  extended by org.eclipse.stardust.engine.core.spi.dms.RepositoryResourceUtils

public class RepositoryResourceUtils
extends Object

Factory that should be used to create Document and Folder instances.

Author:
Roland.Stamm

Method Summary
static Document createDocument(String id)
          Use this to create a Document if no meta data is known at all.
For example when it is stored in a key value store and only the key is known.
static Document createDocument(String id, String path, long size, String encoding, Date dateCreated, Date dateLastModified)
          This creates a document without version information.
static Document createDocument(String id, String path, long size, String encoding, Date dateCreated, Date dateLastModified, String revisionId, String revisionName, String revisionComment, List<String> versionLabels)
          This creates a document with version information.
static Folder createFolder(String id, String path, Date dateCreated, Date dateLastModified, List<Document> containedDocuments, List<Folder> subFolders, int levelOfDetail)
          This creates a folder object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createDocument

public static Document createDocument(String id)
Use this to create a Document if no meta data is known at all.
For example when it is stored in a key value store and only the key is known.

The document name defaults to the specified document id but can be changed via ResourceInfo.setName(String). The document size defaults to 0.
The document path defaults to RepositoryConstants.ROOT_FOLDER_PATH
The document revisionId and revisionName default to RepositoryConstants.VERSION_UNVERSIONED. All other values are null. If more information about the document is available please use createDocument(String, String, long, String, Date, Date).

Only parameters that cannot be changed via setters on Document are available.

Important Note on IDs
Ensuring a good performance the id of the document should be shorter than 100 Bytes and a significant identifier that cannot be guessed. The best example is an generated UUID.

 Example: b9a2d44b-2e29-469a-9bfb-4464f86faf38
 
It is discouraged to use URLs or file paths as IDs as they tend to get long, have no significant difference at the start of the string and it is possible to guess other IDs.

Parameters:
id - The unique identifier of the document.
Returns:
The new document instance.

createDocument

public static Document createDocument(String id,
                                      String path,
                                      long size,
                                      String encoding,
                                      Date dateCreated,
                                      Date dateLastModified)
This creates a document without version information.

The document name defaults to the specified document id but can be changed via ResourceInfo.setName(String). The document revisionId and revisionName default to RepositoryConstants.VERSION_UNVERSIONED.

Only parameters that cannot be changed via setters on Document are available.

Important Note on IDs
Ensuring a good performance the id of the document should be shorter than 100 Bytes and a significant identifier that cannot be guessed. The best example is an generated UUID.

 Example: b9a2d44b-2e29-469a-9bfb-4464f86faf38
 
It is discouraged to use URLs or file paths as IDs as they tend to get long, have no significant difference at the start of the string and it is possible to guess other IDs.

Parameters:
id - The unique identifier of the document.
path - The path of the document. As path separator RepositoryConstants.PATH_SEPARATOR is expected.
size - The size of the content.
encoding - The encoding of the content.
dateCreated - The date the document was created
dateLastModified - The date the document was modified last.
Returns:
The new document instance.

createDocument

public static Document createDocument(String id,
                                      String path,
                                      long size,
                                      String encoding,
                                      Date dateCreated,
                                      Date dateLastModified,
                                      String revisionId,
                                      String revisionName,
                                      String revisionComment,
                                      List<String> versionLabels)
This creates a document with version information.

The document name defaults to the specified document id but can be changed via ResourceInfo.setName(String).

Only parameters that cannot be changed via setters on Document are available.

Important Note on IDs
Ensuring a good performance the id of the document should be shorter than 100 Bytes and a significant identifier that cannot be guessed. The best example is an generated UUID.

 Example: b9a2d44b-2e29-469a-9bfb-4464f86faf38
 
It is discouraged to use URLs or file paths as IDs as they tend to get long, have no significant difference at the start of the string and it is possible to guess other IDs.

Parameters:
id - The unique identifier of the document.
path - The path of the document. As path separator RepositoryConstants.PATH_SEPARATOR is expected.
size - The size of the content.
encoding - The encoding of the content.
dateCreated - The date the document was created
dateLastModified - The date the document was modified last.
revisionId - The id of this document's version. It can be the same as the document id.
revisionName - The name of the document's version.
revisionComment - A comment related to the documents version operation.
versionLabels - Labels assigned to the document version.
Returns:
The new document instance.

createFolder

public static Folder createFolder(String id,
                                  String path,
                                  Date dateCreated,
                                  Date dateLastModified,
                                  List<Document> containedDocuments,
                                  List<Folder> subFolders,
                                  int levelOfDetail)
This creates a folder object.

The folder name defaults to the specified folder id but can be changed via ResourceInfo.setName(String).

Only parameters that cannot be changed via setters on Folder are available.

Important Note on IDs
Ensuring a good performance the id of the folder should be shorter than 100 Bytes and a significant identifier that cannot be guessed. The best example is an generated UUID.

 Example: b9a2d44b-2e29-469a-9bfb-4464f86faf38
 
It is discouraged to use URLs or file paths as IDs as they tend to get long, have no significant difference at the start of the string and it is possible to guess other IDs.

Parameters:
id - The unique identifier of the folder.
path - The path of the folder. As path separator RepositoryConstants.PATH_SEPARATOR is expected.
dateCreated - The date the folder was created
dateLastModified - The date the folder was modified last.
containedDocuments - The documents that are contained in the folder. Should be Collections.EMPTY_LIST if Folder.LOD_NO_MEMBERS is selected.
subFolders - The folders that are contained in the folder. Should be Collections.EMPTY_LIST if Folder.LOD_NO_MEMBERS is selected.
levelOfDetail - The levelOfDetails Folder.LOD_NO_MEMBERS, Folder.LOD_LIST_MEMBERS, Folder.LOD_LIST_MEMBERS_OF_MEMBERS.
Returns:
The new folder instance.


Copyright © 2017 Eclipse Stardust. All Rights Reserved.