A document type object consists of the Document Type ID and the Document Type Schema Location, determined via the class DocumentType.
public DocumentType(String documentTypeId, String schemaLocation)
{
super();
this.documentTypeId = documentTypeId;
this.schemaLocation = schemaLocation;
}
The following sections describe options for managing Document Types:
For general concepts on working with Document Types in the Stardust, refer to chapter Document Types of the Concepts documentation.
The DocumentType class provides the following access on the meta data structure of a document:
To retrieve the qualified Id of a particular document type in the repository,
use method getDocumentTypeId():
public String getDocumentTypeId()
{
return documentTypeId;
}
To set the unique qualified Id of a particular document type within the
repository, use setDocumentTypeId(String documentTypeId):
public void setDocumentTypeId(String documentTypeId)
{
this.documentTypeId = documentTypeId;
}
To retrieve the identifier for the schema location in the repository, use
method getSchemaLocation():
public String getSchemaLocation()
{
return schemaLocation;
}
Use setSchemaLocation(String schemaLocation) to set the identifier
for exactly one XSD schema location in the repository:
public void setSchemaLocation(String schemaLocation)
{
this.schemaLocation = schemaLocation;
}}
To retrieve the document type of a document, the following method of the Document interface is used:
DocumentType getDocumentType();
The class DocumentTypeUtils provides the following method to create DocumentType objects based on the Document and DocumentList data having a TypeDeclaration assigned in a given model:
List<DocumentType> getDeclaredDocumentTypes(DeployedModel model)
Parameter model of type DeployedModel determines the model to search for declared DocumentTypes. The method returns a list of DocumentTypes that are declared within the specified model. Note that using this method does not resolve the DocumentType of Document or DocumentList data referencing a TypeDeclaration from an external model reference.
To retrieve a set of Document Types used in a specified data, the following method is provided:
public static Set<DocumentType> getDocumentTypesFromData(DeployedModel model,
List<Data> dataList)
Parameters are the deployed model and a list of specified data. The method returns a set of Document Types that are used in the specified data.
To retrieve data which are of type Document or DocumentList and having a reference to an external TypeDefinition, the class DocumentTypeUtils provides the following method:
List>Data> getReferencedDocumentData(DeployedModel model)
Parameter model of type DeployedModel determines the model to search for data referencing DocumentTypes. The method returns a list of of data referencing DocumentTypes.
You can retrieve data from a given model, which uses the type definition defined by a given Document Type, via the following method:
public static List<Data> getDataUsingDocumentType(DeployedModel model,
DocumentType documentType)
Parameters are the model containing the data and type definitions as well as the Document Type to retrieve the matching data for.
To retrieve document(s) using the Document Management Service, the following workflow is performed:
getDocument(String documentId)getDocuments(List/*<String>*/ documentIds)findDocuments(String xpathQuery) (deprecated)findDocumentsByName(String namePattern) (deprecated)findDocuments(DocumentQuery query)The workflow to retrieve the document type of a document is as follows:
DocumentType getDocumentType();
You can retrieve the XSD schema for a schema location of a document type serialized into a byte[] in the following way:
getSchemaLocation().@ExecutionPermission(
id=ExecutionPermission.Id.readModelData,
defaults={ExecutionPermission.Default.ALL})
byte[] getSchemaDefinition(String schemaLocation)
throws ObjectNotFoundException;
If the specified schema location
cannot be found, an ObjectNotFoundException is thrown.
To use this method, you need the permission to read model data.If the fully-qualified Structured Data Type is known and it is prepared to be used as Document Type, you can create the Document Type in the following way:
DocumentInfo docInfo = DmsUtils.createDocumentInfo("xyz");
docInfo.setDocumentType(new DocumentType("{http://www.infinity.com/bpm/model/Echos/CompanyDocumentType}CompanyDocumentType", null));
To create a Document Type for which the schema location part will be resolved internally, you can use the following code:
TypeDeclaration typeDeclaration = model.getTypeDeclaration("Composite1");
if (typeDeclaration != null)
{
XpdlType xpdlType = typeDeclaration.getXpdlType();
if (xpdlType instanceof ExternalReference)
{
// external schemas use xref as documentTypeId
String documentTypeId = ((ExternalReference) xpdlType).getXref();
documentType = new DocumentType(documentTypeId, null);
}
else if (xpdlType instanceof SchemaType)
{
// internal schemas use a composition of targetNamespace and typeDeclarationId
XSDSchema xsdSchema = ((SchemaType) xpdlType).getSchema();
QName documentTypeIdQname = new QName(xsdSchema.getTargetNamespace(), typeDeclaration.getId());
documentType = new DocumentType(documentTypeIdQname.toString(), null);
}
}
There are two options to assign a Document Type to a document:
To assign the Document Type by a Document Type ID, do the following:
setDocumentType(DocumentType documentType);
updateDocument).Another option to assign a Document Type to the document is to set the Document Type ID and the Document Type Schema Location in order to specify a particular Document Type version.
Therefore, use the following method of the DocumentInfo interface:
void setDocumentType(DocumentType documentType)
The parameter is an object of type DocumentType, containing the Document Type ID and Document Type schema location.
This Use Case describes how to delete a Document Type from a document using the Document Management Service.
setDocumentType method of the
DocumentInfo with parameter null:
setDocumentType(null);
updateDocument).To update a Document Type of a document, the following workflow is necessary:
setDocumentType(DocumentType documentType)
method of the
DocumentInfo.updateDocument).Another option to change the Document Type on the document object is to change the Document Type ID and the Document Type Schema Location in order to specify a particular Document Type version.
This section describes how a document is linked to a Type Declaration in the Document Repository.
This section describes how a document is unlinked from a Type Declaration in the Document Repository.
In case the given document is not linked to a Type Declaration, the document unlinking is rejected with an appropriate error message.
The Stardust QueryService provides functionality to filter for DocumentQuery types, which can be used to search for documents a particular Document Type, Document Type ID or Document Type Schema Location adheres to.
DOCUMENT_TYPE_ID)
as well as the wanted Document Type Schema Location
(DOCUMENT_TYPE_SCHEMA_LOCATION) as a predicate in a Document Query.DOCUMENT_TYPE_ID)
as a predicate in a Document Query.public static final FilterableAttribute DOCUMENT_TYPE_ID = new Attribute(
"attributesTypeId");
DOCUMENT_TYPE_SCHEMA_LOCATION) as a predicate in a Document Query.public static final FilterableAttribute DOCUMENT_TYPE_SCHEMA_LOCATION = new Attribute(
"attributesTypeSchemaLocation");
This section describes how the XSD of Document Types is replicated from the XPDL models to the Document Repository during model deployment:
In case an external XSD cannot be found, the model deployment is rejected with an appropriate error message.