This is an extension to the information provided on How to setup a CMIS connection.
The Studio model mentioned in the information below is based on the example project that has been provided in the connection setup section. References to Alfresco DMS docker environment do refer to the default Community Edition settings as starting point.
Out of the box Alfresco uses a default model with types and properties when storing a file.
Some of these properties can be found in the Blueriq CmisExample Studio model in the entity called ‘Document_CMIS’ which stores information from the DMS in the profile (e.g. Version).
So properties need to be declared in both Blueriq and Alfresco.
If you need additional properties you can create your own, custom properties to be registered with the document and used within the Blueriq model. These need to be declared in both Blueriq and Alfresco.
Configure Alfresco
The default Alfresco model, type or its properties cannot be modified. Therefor you need to create a new ‘Content model’ in Alfresco.
Information about how to do so can be found on https://docs.alfresco.com/
Background on Models: https://docs.alfresco.com/content-services/latest/config/models/
Tutorial with example: https://docs.alfresco.com/content-services/latest/tutorial/model/
The Alfresco documentation is elaborate and not all instructions are needed for the basic purpose, adding custom properties.
From the Content Model structure only the Content Model, Custom Types and Properties are required.
An example as quick reference when using the Alfresco Tutorial steps:
- Navigate to Model Manager
Go to http://localhost:8080/alfresco/
- Open ‘Alfresco Share’
- Open ‘Admin Tools’
- Open tool ‘Model Manager’
o Here you can create or import a model. Create a new model
Create ModelNamespace:
model/blueriq/1.0
Prefix:
br
Name:
Blueriq_model
Create a new type
Open the created Model
- Select the option ‘Create Custom Type’Create Custom Type
Name:
Blueriq_Custom_Type
Parent Type:
smf:smartFolderTemplate
Display Label:
Blueriq Custom Type
Create new custom type properties
Open the created Custom Type
- Select the option ‘Create Property’Create Property
Name:
custom_string
Display Label:
Custom String
Data Type:
d:text
- Add new type properties to the Layout Designer
See tutorial.
Tip: use the ‘Apply Default Layout’ option in the ‘Layout Designer’ - Skip this step
- Skip this step
- Skip this step
- Activate the model
See tutorial. - Apply custom type to a file in Alfresco Share
If you want to use the new Type with its properties (so including the newly added property) to already existing documents in the Repository.
See tutorial.
In this example you will end up with these new items:
Content Model: | Blueriq_model |
Custom Type: | br:Blueriq_Custom_Type |
Property: | br:custom_string |
(note the automatic addition of the configured prefix of the Model (in this case ‘br’) to the name of the Type and the Property)
Configure Blueriq
The changes regarding Blueriq affect the Studio model and the Runtime properties.
Runtime
The provided properties for the application-cmis-client.properties
need to be updated.
Specifically the blueriq.cmis.object-type-id
property.
When using the default (out of the box) properties to store a file in Alfresco and retrieving its data the object-type-id is cmis:document
.
But we want the use the new Custom Type which was created in the new Content Model in Alfresco.
So for the example we need to find the id for ‘br:Blueriq_Custom_Type’.
This involves using the Alfresco API and it is rather complicated.
It requires these steps:
- Go to http://localhost:8080/alfresco/
- Open ‘Alfresco WebDav’
o We don’t need the information there but accessing this page requires a login.
This login provides the credentials in the session to be authorized for using the API as well. So login with admin, admin. - Open the API link to the type descriptions in your browser.
http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom/typedesc
o This is the link in the propertyblueriq.cmis.services-url,
in theapplication-cmis-client.properties,
+ ‘/typedesc’
o It will display xml data - Only if you want the data to be more easily readable, otherwise go to the next step.
Copy the content to an editor (e.g. Notepad++) to format it to ‘pretty print’.
Or any other option that suits you. - We need the <cmis:id> for the created Custom Type with the name ‘br:Blueriq_Custom_Type’
A search for this name will find it is used in:
<cmis:id>D:br:Blueriq_Custom_Type</cmis:id> Replace the
blueriq.cmis.object-type-id
cmis:document
with the id of the new Custom Type and save the properties file.blueriq.cmis.object-type-id
=cmis:document
becomesblueriq.cmis.object-type-id
=D:br:Blueriq_Custom_Type
- Restart the Blueriq Runtime Service
- Go to http://localhost:8080/alfresco/
Studio model
In the Studio model changes need to be made to receive and work with the custom property within the profile. Basically, consisting of:
- Add an attribute, for the property value.
- Specify the new attribute as TargetAttribute for the DMS property value in service call with service type AQ_CMIS_GetDocumentMetadata.
- Specify the new attribute as value for the DMS property field in service call with service type AQ_CMIS_Documentmanager (to set and update the value of the property)
- Additional changes to pages, AQ_InstanceList, flow, to see and update the value.
For the provided CmisExample model, examples of the changes to Entity and Service Calls are provided here:
- Document_CMIS (entity):
Add an attribute for the new property.
- CMIS_GetMetaData (service call)(service type AQ_CMIS_GetDocumentMetadata):
To get the value of the custom property into the profile.
In section CUSTOM PROPERTIES
Specify the custom property from the DMS to be mapped to the new attribute.
- DocumentManager_Update (service call)(service type AQ_CMIS_Documentmanager):
To set/update the value of the custom property.
In section CUSTOM METADATA
Specify the custom property from the DMS to be mapped to the new attribute.
Result after configuring
This is what it could look like:
Page ‘Document overview’
Edit the document in Page ‘Document view’
Add a value for the Custom String
After 'Update'
Page ‘Document view’
Document properties in the Alfresco repository