Extended ECM (xECM) service
Content Script extension for xECM¶
The xecm Content Script service automates OpenText Extended ECM: business workspaces, business objects, workspace roles, workspace relationships, business application events and SPI business application connectors.
Module Suite 4.1.0 (Polaris) adds the Business Workspace Type API. Scripts can now read, create, update and delete business workspace types, and create business workspace templates for them.
Administrative operations
Creating, updating and deleting business workspace types are administrative operations. Creating a type requires create permission on the workspace types configuration folder. Updating a type requires edit permission on the type's configuration node.
The xecm service¶
The table below lists the members that were available before 4.1.0. The 4.1.0 members are described in Business workspace types and Business workspace templates.
| Method | Description | Since |
|---|---|---|
getWorkspaceCreationRequest(request) |
Returns the creation request payload for a CSBusinessWorkspaceCreationRequest. |
2.4.0 |
createWorkspace(name, description, request, categoriesInfo, throwException) |
Creates a business workspace from a request payload. Returns null on failure when throwException is false. |
2.4.0 |
listWorkspaceTemplates(space, name) |
Lists the workspace templates available in a space, optionally filtered by name. | 2.4.0 |
listRoles(workspace) |
Lists the roles of a workspace. | 2.4.0 |
addRole(workspace, name, description, permissions, isLeader) |
Adds a role to a workspace. | 2.4.0 |
updateRole(workspace, role, name, description, permissions, isLeader) |
Updates a role. role is a CSMember or a role name. |
2.4.0 |
deleteRole(workspace, role) |
Deletes a role. role is a CSMember or a role name. |
2.4.0 |
listRoleMembers(workspace, role) |
Lists the members of a role. | 2.4.0 |
addRoleMember(workspace, role, members...) |
Adds members to a role. | 2.4.0 |
removeRoleMembers(workspace, role, members...) |
Removes members from a role. | 2.4.0 |
createIcon(workspace, iconMime, file) / updateIcon(...) / deleteIcon(workspace) |
Manages the icon of a business workspace. | 2.4.0 |
getWorkspaceRelationships(workspace) |
Returns the relationships of a workspace. | 2.5.0 |
createWorkSpaceRelationship(workspace, ignoreExisting, children...) |
Relates child workspaces to a parent workspace. | 2.5.0 |
removeWorkSpaceRelationship(workspace, children...) |
Removes workspace relationships. | 2.5.0 |
getBusinessWorkspaces(extSystemId, boType, boId) |
Returns the business workspaces of a business object. | 3.1.0 |
getBusinessObject(workspace) |
Returns the business object of a workspace (CSNode or id). |
3.1.0 |
getRelatedBusinessObject(workspace) |
Returns the related business objects of a workspace (CSNode or id). |
3.1.0 |
newBusinessAttachment(name, docType, res) |
Creates a business attachment. | 3.1.0 |
uploadBusinessAttachment(extSystemId, boType, boId, attachment) |
Uploads a business attachment to a business object. | 3.1.0 |
newBusinessApplicationEvent(name, description, system) |
Creates a business application event. | 3.1.0 |
registerEvent(event) |
Registers a business application event definition. | 3.1.0 |
triggerEvents(events, system) |
Triggers business application events. | 3.1.0 |
newXEcmBusinessApplication(name, description) |
Creates an SPI business application connector (CSXEcmBusinessApplication). |
3.1.0 |
newRelatedWorkspacesQueryBuilder() |
Creates a query builder for related workspaces. | 3.6.0 |
newBusinessObjectQueryBuilder() |
Creates a query builder for business objects. | 3.6.0 |
search(builder) |
Runs a related-workspaces or business-object query. | 3.6.0 |
getBusinessObjectTypes(isDefaultSearch) |
Returns the registered business object types. | 3.6.0 |
newBusinessWorkspaceCreationRequest() |
Creates a fluent business workspace creation request. | 3.6.0 |
createWorkspace(creationRequest) |
Creates a business workspace from a CSBusinessWorkspaceCreationRequest. |
3.6.0 |
Deprecated since 3.6.0
createWorkspace(parent, templateName, name, description, categoriesInfo) (since 2.4.0), createWorkspace(parent, templateName, name, description, boId, boType, extSystemID, categoriesInfo) (since 3.2.0) and getWorkspaceCreationRequest(parent, templateName) (since 2.4.0) are deprecated. Use xecm.newBusinessWorkspaceCreationRequest() with xecm.createWorkspace(creationRequest) instead.
SPI connectors and request parameters¶
The closures of an SPI business application connector (CSXEcmBusinessApplication) have the form { Map config, Map params -> ... }. In 4.1.0, xECM service methods accept the parameters of the current request (see the 4.1.0 release notes). The scripting API does not add a method or parameter for this change.
Business workspace types¶
A business workspace type is built with a fluent request, CSBusinessWorkspaceTypeRequest. The request holds the scalar settings directly and references one settings object per group: name generation, creation, external document storage, search, indexing, widget icon and relations. Locations used by these settings are value objects created by the xecm location factories.
flowchart LR
newRequest["xecm.newWorkspaceTypeRequest()"] --> request[CSBusinessWorkspaceTypeRequest]
nameGen[CSWorkspaceTypeNameGeneration] --> request
creation[CSWorkspaceTypeCreation] --> request
extStorage[CSWorkspaceTypeExternalDocStorage] --> request
search[CSWorkspaceTypeSearch] --> request
indexing[CSWorkspaceTypeIndexing] --> request
widgetIcon[CSWorkspaceTypeWidgetIcon] --> request
relation[CSWorkspaceTypeRelation] --> request
location[CSWorkspaceTypeLocation] --> creation
location --> extStorage
location --> request
request -->|"createWorkspaceType / create()"| wsType[CSBusinessWorkspaceType]
wsType -->|"workspaceType(type)"| tplRequest[CSBusinessWorkspaceTemplateRequest]
tplRequest -->|"createWorkspaceTemplate / create()"| template["Template CSNode"]
Service methods¶
| Method | Description | Since |
|---|---|---|
listWorkspaceTypes() |
Lists all business workspace types. Returns a list of CSBusinessWorkspaceType. |
4.1.0 |
getWorkspaceType(wkspTypeId) |
Reads a business workspace type by id. Returns null if it does not exist. |
4.1.0 |
newWorkspaceTypeRequest() |
Creates a new CSBusinessWorkspaceTypeRequest. |
4.1.0 |
createWorkspaceType(request) |
Creates a business workspace type. wkspTypeName and the generated name for the default metadata language are mandatory. Returns the type read back from the server. If the read-back fails, returns a handle that carries only wkspTypeId. |
4.1.0 |
updateWorkspaceType(request) |
Updates the type identified by the request's wkspTypeId. Only the fields set on the request are changed. Returns the updated type. |
4.1.0 |
updateWorkspaceType(wkspTypeId, request) |
Updates the type with the given id using the fields set on the request. | 4.1.0 |
deleteWorkspaceType(wkspTypeId) |
Deletes a type by id. Returns true on success. The server decides whether a type in use can be deleted. |
4.1.0 |
deleteWorkspaceType(type) |
Deletes the given CSBusinessWorkspaceType. |
4.1.0 |
newWorkspaceTypeNameGeneration() |
Creates an empty CSWorkspaceTypeNameGeneration. |
4.1.0 |
newWorkspaceTypeCreation() |
Creates an empty CSWorkspaceTypeCreation. |
4.1.0 |
newWorkspaceTypeExternalDocStorage() |
Creates an empty CSWorkspaceTypeExternalDocStorage. |
4.1.0 |
newWorkspaceTypeSearch() |
Creates an empty CSWorkspaceTypeSearch. |
4.1.0 |
newWorkspaceTypeIndexing() |
Creates an empty CSWorkspaceTypeIndexing. |
4.1.0 |
newWorkspaceTypeWidgetIcon() |
Creates an empty CSWorkspaceTypeWidgetIcon. |
4.1.0 |
newWorkspaceTypeRelation() |
Experimental. Creates an empty CSWorkspaceTypeRelation. |
4.1.0 |
staticNodeLocation(node) |
Location pointing at a fixed node (StaticNodeId). |
4.1.0 |
categoryAttributeLocation(category, attributeName) |
Location resolved from a category attribute (CategoryAttribute). |
4.1.0 |
businessPropertyLocation(propertyName) |
Location resolved from a business property (BusinessProperty). |
4.1.0 |
patternLocation(pattern) |
Sub-location path resolved from a pattern (Pattern). |
4.1.0 |
currentNodeLocation() |
Location of the node the workspace is created from (CurrentNode). |
4.1.0 |
noLocation() |
Empty location (None). Clears a classification, records-management classification or sub-location path. |
4.1.0 |
Create, update and delete throw InvalidParamException when the request is incomplete or a location strategy is not allowed for its field. They throw ExecutionFaultException when the server call fails.
Reading types: CSBusinessWorkspaceType¶
CSBusinessWorkspaceType is the read model returned by getWorkspaceType, listWorkspaceTypes, createWorkspaceType and updateWorkspaceType. All fields are available since 4.1.0.
| Field | Description |
|---|---|
wkspTypeId |
Workspace type id. |
configNodeId |
Id of the workspace type configuration node. |
wkspTypeName |
Workspace type name. |
wkspTypeNames |
Language-specific workspace type names. |
wkspDescriptions |
Language-specific workspace descriptions. |
nameGeneration |
Name generation settings (CSWorkspaceTypeNameGeneration). |
addCreatorToLeadRole |
Whether the creator is added to the lead role. |
aviatorEnabled |
Whether the Aviator feature is enabled. |
rmEnabled |
Whether Records Management is enabled. |
wkspCopyEnabled |
Whether business workspace copying is enabled. |
wkspCreationEnabled |
Whether business workspace creation is enabled. |
wkspPoliciesEnabled |
Whether business workspace policies are enabled. |
wkspIcon |
Business workspace icon name. |
widgetIconUrl |
URL of the widget icon. |
classification |
Classification location (CSWorkspaceTypeLocation). |
externalDocumentStorage |
External document storage settings. |
wkspCreation |
Business workspace creation settings. |
search |
Search settings. |
indexing |
Indexing settings. |
relations |
Relation context entries (list of CSWorkspaceTypeRelation). |
inUse |
Whether the type has live business workspaces. |
indexingStatus |
Indexing status: UpToDate or ReindexingRequired. |
modified |
Last modification timestamp. |
perspectiveFolderId |
Id of the perspective folder. |
wkspTypeIcon |
Workspace type icon URL. |
| Method | Description | Since |
|---|---|---|
toRequest() |
Returns a CSBusinessWorkspaceTypeRequest pre-populated from this type, for a get, modify, update flow. The widget icon is not copied, because only its URL is available on read. |
4.1.0 |
Example: List and read workspace types¶
xecm.listWorkspaceTypes().each { type ->
out << "${type.wkspTypeId}: ${type.wkspTypeName} (in use: ${type.inUse}, indexing: ${type.indexingStatus})<br/>"
}
def type = xecm.getWorkspaceType(12)
if (type == null) {
out << "Workspace type 12 does not exist"
} else {
out << "Creation location: ${type.wkspCreation?.location?.strategy} ${type.wkspCreation?.location?.value}"
}
Building a type request: CSBusinessWorkspaceTypeRequest¶
Obtain the request with xecm.newWorkspaceTypeRequest(). Every setter returns the request, so calls can be chained. Finish with create() or update(), or pass the request to xecm.createWorkspaceType(...) or xecm.updateWorkspaceType(...).
| Method | Description | Since |
|---|---|---|
wkspTypeId(wkspTypeId) |
Sets the id of the type to update. Not used on create. | 4.1.0 |
wkspTypeName(wkspTypeName) |
Sets the type name (max 248 characters). Mandatory on create; validated by Content Server naming rules. | 4.1.0 |
wkspTypeName(languageCode, name) |
Sets a language-specific type name (max 1024 characters). | 4.1.0 |
wkspTypeNames(wkspTypeNames) |
Sets all language-specific type names (language code to name). | 4.1.0 |
wkspDescription(languageCode, description) |
Sets a language-specific workspace description (max 1000 characters). | 4.1.0 |
wkspDescriptions(wkspDescriptions) |
Sets all language-specific workspace descriptions. | 4.1.0 |
nameGeneration(nameGeneration) |
Sets the name generation settings. Mandatory on create: at least the name for the default metadata language. | 4.1.0 |
generatedName(languageCode, name) |
Sets the generated workspace name pattern for a language (max 1024 characters). Creates the name generation settings if needed. | 4.1.0 |
generatedName(name) |
Sets the generated workspace name pattern for the current metadata language. | 4.1.0 |
addCreatorToLeadRole(addCreatorToLeadRole) |
Sets whether the creator is added to the lead role. | 4.1.0 |
aviatorEnabled(aviatorEnabled) |
Sets whether the Aviator feature is enabled. | 4.1.0 |
rmEnabled(rmEnabled) |
Sets whether Records Management is enabled. | 4.1.0 |
wkspCopyEnabled(wkspCopyEnabled) |
Sets whether business workspace copying is enabled. | 4.1.0 |
wkspCreationEnabled(wkspCreationEnabled) |
Sets whether business workspace creation is enabled. | 4.1.0 |
wkspPoliciesEnabled(wkspPoliciesEnabled) |
Sets whether business workspace policies are enabled. | 4.1.0 |
wkspIcon(wkspIcon) |
Sets the workspace icon: a support icon name with prefix otsapxecm/wksp, for example otsapxecm/wksp.png. |
4.1.0 |
widgetIcon(widgetIcon) |
Sets the widget icon from a CSWorkspaceTypeWidgetIcon. |
4.1.0 |
widgetIcon(content, mimeType) |
Sets the widget icon from Base64 content (max 1,500,000 characters) and an XEcmEnums.WidgetIconMimeType. |
4.1.0 |
resetWidgetIcon() |
Clears the widget icon. | 4.1.0 |
classification(classification) |
Sets the classification location. | 4.1.0 |
externalDocumentStorage(externalDocumentStorage) |
Sets the external document storage settings. | 4.1.0 |
wkspCreation(wkspCreation) |
Sets the business workspace creation settings. | 4.1.0 |
search(search) |
Sets the search settings. | 4.1.0 |
indexing(indexing) |
Sets the indexing settings. | 4.1.0 |
relation(relation) |
Experimental. Adds a relation context entry. | 4.1.0 |
relations(relations) |
Experimental. Sets the full list of relation context entries. | 4.1.0 |
from(type) |
Seeds the request from an existing type: copies the id and all shared settings, except the widget icon. | 4.1.0 |
create() |
Creates the type described by the request. Returns a CSBusinessWorkspaceType. |
4.1.0 |
update() |
Updates the type identified by wkspTypeId with the fields set on the request. Returns a CSBusinessWorkspaceType. |
4.1.0 |
Portable scripts
Prefer generatedName(name) for the mandatory name on create: it uses the current metadata language, so the script works on servers that use different language codes (for example en and en_US). For the same reason, pass CSNode objects to the location factories instead of hard-coded ids.
Aviator reindexing
Changing aviatorEnabled can trigger asynchronous reindexing of all workspaces of the type.
Locations: CSWorkspaceTypeLocation¶
A CSWorkspaceTypeLocation is a value object made of a strategy and a value. Build one with the xecm location factories listed in Service methods.
| Field | Description |
|---|---|
strategy |
The location strategy, an XEcmEnums.LocationStrategy: NONE, CURRENT_NODE, STATIC_NODE_ID, BUSINESS_PROPERTY, CATEGORY_ATTRIBUTE or PATTERN. |
value |
The node id, property name, <categoryId>::<attribute> or pattern, if any. |
Each setting accepts only some strategies. A location with a strategy that is not allowed for its field makes create and update fail with InvalidParamException.
| Setting | Allowed strategies |
|---|---|
Request classification(...) |
None, StaticNodeId, BusinessProperty, CategoryAttribute |
Creation location(...) |
CurrentNode, StaticNodeId, BusinessProperty, CategoryAttribute |
Creation subLocationPath(...) |
None, Pattern (ignored when the location is CurrentNode) |
External document storage rmClassification(...) |
None, StaticNodeId, CategoryAttribute |
External document storage subLocationPath(...) |
None, Pattern |
Name generation: CSWorkspaceTypeNameGeneration¶
Obtain with xecm.newWorkspaceTypeNameGeneration().
| Method | Description | Since |
|---|---|---|
name(languageCode, name) |
Sets the generated workspace name pattern for a metadata language (max 1024 characters). The language must be an enabled metadata language on the server. | 4.1.0 |
wkspNames(wkspNames) |
Sets all generated names (language code to name). | 4.1.0 |
useAlsoForWkspWithoutBo(useAlsoForWkspWithoutBo) |
Sets whether the generated name is also used for workspaces without a business object. | 4.1.0 |
Read fields: wkspNames, useAlsoForWkspWithoutBo.
Creation settings: CSWorkspaceTypeCreation¶
Obtain with xecm.newWorkspaceTypeCreation().
| Method | Description | Since |
|---|---|---|
location(location) |
Sets where new business workspaces are created. | 4.1.0 |
subLocationPath(subLocationPath) |
Sets the sub-location path. Ignored when the location is CurrentNode. | 4.1.0 |
createWkspWithFastBulkMethod(createWkspWithFastBulkMethod) |
Sets whether workspaces are created with the fast bulk method. | 4.1.0 |
directlyOpenCreatedWksp(directlyOpenCreatedWksp) |
Sets whether a workspace opens directly after creation. | 4.1.0 |
useAlsoForManualCreation(useAlsoForManualCreation) |
Sets whether the creation location is also used for manual creation. | 4.1.0 |
Read fields: location, subLocationPath, createWkspWithFastBulkMethod, directlyOpenCreatedWksp, useAlsoForManualCreation.
External document storage: CSWorkspaceTypeExternalDocStorage¶
Obtain with xecm.newWorkspaceTypeExternalDocStorage().
| Method | Description | Since |
|---|---|---|
rmClassification(rmClassification) |
Sets the records-management classification location. | 4.1.0 |
subLocationPath(subLocationPath) |
Sets the sub-location path. | 4.1.0 |
Read fields: rmClassification, subLocationPath.
Search: CSWorkspaceTypeSearch¶
Obtain with xecm.newWorkspaceTypeSearch().
| Method | Description | Since |
|---|---|---|
followRelatedWksp(followRelatedWksp) |
Sets the follow-related-workspaces behaviour: XEcmEnums.FollowRelatedWksp.DISABLED, ENABLED or ALWAYS_ENABLED. |
4.1.0 |
followRelatedWksp(String) |
Same, by name: Disabled, Enabled or AlwaysEnabled. |
4.1.0 |
maxNumberOfFollowedWksp(maxNumberOfFollowedWksp) |
Sets the maximum number of followed workspaces (0 or more). | 4.1.0 |
Read fields: followRelatedWksp, maxNumberOfFollowedWksp.
Indexing: CSWorkspaceTypeIndexing¶
Obtain with xecm.newWorkspaceTypeIndexing().
| Method | Description | Since |
|---|---|---|
enabled(enabled) |
Enables or disables indexing for the type. | 4.1.0 |
subTypes(List) |
Sets the list of Content Server subtypes to index (max 1024). | 4.1.0 |
subTypes(int...) |
Sets one or more Content Server subtypes to index. | 4.1.0 |
Read fields: enabled, subTypes.
Widget icon: CSWorkspaceTypeWidgetIcon¶
Obtain with xecm.newWorkspaceTypeWidgetIcon().
| Method | Description | Since |
|---|---|---|
content(content) |
Sets the Base64-encoded icon content (max 1,500,000 characters). | 4.1.0 |
mimeType(WidgetIconMimeType) |
Sets the MIME type: XEcmEnums.WidgetIconMimeType.GIF, JPEG, PJPEG, PNG, X_PNG or SVG. Required when the content is not empty. |
4.1.0 |
mimeType(String) |
Same, by MIME string: image/gif, image/jpeg, image/pjpeg, image/png, image/x-png or image/svg+xml. |
4.1.0 |
reset() |
Marks the widget icon to be cleared, by setting an empty content. | 4.1.0 |
Read fields: content, mimeType.
Relations: CSWorkspaceTypeRelation¶
Experimental
Relation context entries are experimental in 4.1.0.
A relation context entry describes a parent or child relation to another workspace type, with predicate labels. Obtain with xecm.newWorkspaceTypeRelation().
| Method | Description | Since |
|---|---|---|
targetWkspTypeId(targetWkspTypeId) |
Sets the target workspace type id. -1 refers to the type itself. |
4.1.0 |
relType(RelationType) |
Sets the relation type: XEcmEnums.RelationType.CHILD or PARENT. |
4.1.0 |
relType(String) |
Same, by name: Child or Parent. |
4.1.0 |
predicate(languageCode, label) |
Sets a predicate label for a language (max 128 characters). | 4.1.0 |
predicates(predicates) |
Sets all predicate labels (language code to label). | 4.1.0 |
Read fields: targetWkspTypeId, relType, predicates.
Enumerations¶
The enumerations used by this API are nested in XEcmEnums, which scripts can use without an import.
| Enumeration | Values |
|---|---|
XEcmEnums.LocationStrategy |
NONE, CURRENT_NODE, STATIC_NODE_ID, BUSINESS_PROPERTY, CATEGORY_ATTRIBUTE, PATTERN |
XEcmEnums.FollowRelatedWksp |
DISABLED, ENABLED, ALWAYS_ENABLED |
XEcmEnums.WidgetIconMimeType |
GIF, JPEG, PJPEG, PNG, X_PNG, SVG |
XEcmEnums.RelationType |
CHILD, PARENT |
Business workspace templates¶
A business workspace template is created under the Documents Template Volume for a given workspace type. This is different from createWorkspace(...), which creates a workspace from an existing template.
| Method | Description | Since |
|---|---|---|
xecm.newWorkspaceTemplateRequest() |
Creates a new CSBusinessWorkspaceTemplateRequest. |
4.1.0 |
xecm.createWorkspaceTemplate(request) |
Creates the template. Returns its CSNode (subtype 848). Requires create permission on the parent. Throws InvalidParamException if the name or workspace type is missing, and ExecutionFaultException if the create fails, including when the parent is not under the Documents Template Volume. |
4.1.0 |
CSBusinessWorkspaceTemplateRequest¶
| Method | Description | Since |
|---|---|---|
parent(parent) |
Sets the parent folder. It must be the Documents Template Volume or inside it. When omitted, docman.getDocumentsTemplateVolume() is used. |
4.1.0 |
name(name) |
Sets the template name. Mandatory. | 4.1.0 |
name(languageCode, name) |
Sets a language-specific template name. | 4.1.0 |
nameMultilingual(nameMultilingual) |
Sets all language-specific names (language code to name). | 4.1.0 |
description(description) |
Sets the template description. Optional. | 4.1.0 |
description(languageCode, description) |
Sets a language-specific description. | 4.1.0 |
descriptionMultilingual(descriptionMultilingual) |
Sets all language-specific descriptions. | 4.1.0 |
workspaceTypeId(workspaceTypeId) |
Sets the workspace type id of the template. Mandatory, unless workspaceType(...) is used. |
4.1.0 |
workspaceType(workspaceType) |
Sets the workspace type from a CSBusinessWorkspaceType. |
4.1.0 |
create() |
Creates the template and returns its CSNode. |
4.1.0 |
Examples¶
Example: Create a workspace type with its settings and a template¶
def workspacesFolder = asCSNode(path: "Enterprise:Customers")
def customerCategory = asCSNode(path: "Categories:Customer")
String subPathPattern = "..." // a Content Server sub-location path pattern
def creation = xecm.newWorkspaceTypeCreation()
.location(xecm.staticNodeLocation(workspacesFolder))
.subLocationPath(xecm.patternLocation(subPathPattern))
.directlyOpenCreatedWksp(true)
.useAlsoForManualCreation(true)
def storage = xecm.newWorkspaceTypeExternalDocStorage()
.rmClassification(xecm.categoryAttributeLocation(customerCategory, "RM Classification"))
.subLocationPath(xecm.noLocation())
def search = xecm.newWorkspaceTypeSearch()
.followRelatedWksp(XEcmEnums.FollowRelatedWksp.ENABLED)
.maxNumberOfFollowedWksp(10)
def indexing = xecm.newWorkspaceTypeIndexing()
.enabled(true)
.subTypes(0, 144)
def type = xecm.newWorkspaceTypeRequest()
.wkspTypeName("Customer")
.wkspTypeName("de", "Kunde")
.wkspDescription("en", "Customer workspaces")
.generatedName("Customer workspace")
.addCreatorToLeadRole(true)
.wkspCreationEnabled(true)
.wkspCopyEnabled(false)
.wkspIcon("otsapxecm/wksp.png")
.classification(xecm.noLocation())
.wkspCreation(creation)
.externalDocumentStorage(storage)
.search(search)
.indexing(indexing)
.create()
out << "Created workspace type ${type.wkspTypeId} (${type.wkspTypeName})"
def template = xecm.newWorkspaceTemplateRequest()
.name("Customer template")
.description("Default template for customer workspaces")
.workspaceType(type)
.create()
out << "<br/>Created template ${template.ID}"
Example: Read, modify and update a workspace type¶
The toRequest() and from(type) methods seed a request from an existing type. Only the fields set on the request are sent on update.
flowchart LR
getType["xecm.getWorkspaceType(id)"] --> current[CSBusinessWorkspaceType]
current -->|"toRequest()"| seeded[CSBusinessWorkspaceTypeRequest]
seeded -->|"change settings"| changed[CSBusinessWorkspaceTypeRequest]
changed -->|"update()"| updated[CSBusinessWorkspaceType]
def type = xecm.getWorkspaceType(12)
def updated = type.toRequest()
.search(xecm.newWorkspaceTypeSearch()
.followRelatedWksp("AlwaysEnabled")
.maxNumberOfFollowedWksp(5))
.rmEnabled(true)
.update()
out << "Indexing status: ${updated.indexingStatus}"
The same update without the seeded request changes only the fields that are set:
def updated = xecm.updateWorkspaceType(12, xecm.newWorkspaceTypeRequest()
.wkspPoliciesEnabled(true))
Example: Set and reset the widget icon¶
The widget icon is not copied by toRequest() or from(type). Set it explicitly when needed.
String iconBase64 = "..." // Base64-encoded PNG content
xecm.newWorkspaceTypeRequest()
.wkspTypeId(12)
.widgetIcon(iconBase64, XEcmEnums.WidgetIconMimeType.PNG)
.update()
// Alternative with a widget icon object
def icon = xecm.newWorkspaceTypeWidgetIcon()
.content(iconBase64)
.mimeType("image/png")
xecm.updateWorkspaceType(xecm.newWorkspaceTypeRequest().wkspTypeId(12).widgetIcon(icon))
// Clear the widget icon
xecm.newWorkspaceTypeRequest()
.wkspTypeId(12)
.resetWidgetIcon()
.update()
Example: Add a relation to another workspace type (experimental)¶
def relation = xecm.newWorkspaceTypeRelation()
.targetWkspTypeId(15)
.relType(XEcmEnums.RelationType.CHILD)
.predicate("en", "has contract")
xecm.getWorkspaceType(12)
.toRequest()
.relation(relation)
.update()
Example: Delete a workspace type¶
def type = xecm.listWorkspaceTypes().find { it.wkspTypeName == "Customer" }
if (type && !type.inUse) {
xecm.deleteWorkspaceType(type)
}