DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
Alfresco Custom Model
1. Alfresco Custom Model
Università del Salento, 2012
Andrea Leo
www.alfresco.com
www.qbreng.it
2. Estendere il modello dei contenuti
Alfresco permette di personalizzare e estendere il modello dei contenti per
soddisfare le diverse esigenze dell’Organizzazione
Il Dizionario dei Dati di default è pre-popolato con le definizioni che descrivono
i contenuti con cui è inizialmente popolato il repository (Cartelle, Documenti,
Nomi)
Il Dizionario dei Dati di Alfresco è estendibile, consente all’utente di dichiarare
nuovi Tipi di Dati Personalizzati (Custom Content Type) che soddisfano i
bisogni dell’Organizzazione.
3. I Blocchi elementari : Tipi e Proprietà
Tipo: il concetto di tipo è concettualmente simile al concetto di
Classe dei linguaggi Object Oriented (es. Persona, Content, Folder).
Il concetto di Tipo è usato per modellare i Business Object che
hanno proprietà personalizzate.
I Tipi supportano l'ereditarietà.
Proprietà: sono metadati che appartengono ad un determinato tipo
(es. Nome_Persona, Telefono_Persona)
Tipi di Proprietà: sono i tipi di dato fondamentali. Descrivono i tipi di
dati del Repository che saranno usati per memorizzare le proprietà
(es. strings, dates, floats, boolean).
Vincoli: i Constraints possono opzionalmente essere usati per
restringere/controllare il valore di alcune proprietà. Ci sono 4 tipi di
vincoli di default disponibili dalla piattaforma: REGEX (espressioni
regolari), LIST, MINMAX e LENGTH. Anche i vincoli possono essere
estesi.
4. I Blocchi elementari : Aspetti e Associazioni
Aspetti: permettono di “incollare” delle Proprietà a Tipi di
contenuto o anche a singole istanze di documenti quando e dove
abbiamo bisogno.
Associazioni: una associazione definisce relazioni fra Tipi.
Peer Associations: definisce una relazione “alla Pari” fra due
oggetti nel repository, in cui nessuno dei due è subordinato
all’altro.
Child Association: definisce una relazione “Padre-Figlio” fra
due oggetti, ossia l’oggetto Target (Figlio) dell’associazione
potrebbe non esistere mentre l’oggetto Source (Padre) esiste
sicuramente (es. associazione fra il tipo “Folder” e il tipo
“Content” instaurata nel repository di Alfresco)
5. Content Model Overview
A Content Model is a collection of related Content Types and Aspects.
Each Content Model is described in its own XML file
It is identified by its defined Namespace and Name.
6. Built-in Content Model Namespaces
Out-of-the-box, the Alfresco Repository is primed with several models:
System - describes system-level Repository concepts
Content - describes the Content Domain Model (e.g. Folder, File, etc.)
Application - describes Alfresco Application Model (e.g. Glossary, …)
Dictionary - describes the Dictionary Meta-model
The above models may be found at:
<tomcat-home>/webapps/alfresco/WEB-INF/classes/alfresco/model/systemModel.xml
<tomcat-home>/webapps/alfresco/WEB-INF/classes/alfresco/model/contentModel.xml
<tomcat-home>/webapps/alfresco/WEB-INF/classes/alfresco/model/applicationModel.xml
<tomcat-home>/webapps/alfresco/WEB-INF/classes/alfresco/model/dictionaryModel.xml
11. Additional Property Capabilities
<property name="my:property">
<type>d:text</type>
<mandatory enforced='true'>true</mandatory>
<default>my default value</default>
</property>
….
It's possible to describe how properties are indexed.
<property name="cm:example">
<type>d:text</type>
<mandatory>false</mandatory>
<index enabled="true">
<atomic>false</atomic> <!-- index in the background. Default true -->
<stored>false</stored> <!-- store the property value in the index.Default false -->
<tokenised>true</tokenised> <!-- Default true -->
</index>
</property>
17. built-in constraints
These constraints can be referenced in the property definitions:
<property name="test:prop1">
<type>d:text</type>
<protected>true</protected>
<default></default>
<constraints>
<constraint ref="test:regex1"/>
<constraint ref="test:stringLength1"/>
</constraints>
</property>
Further constraints can be defined inline as well, but are not reusable:
<property name="test:prop1">
<type>d:text</type>
<protected>true</protected>
<default></default>
<constraints>
<constraint ref="test:regex1"/>
<constraint type="LENGTH">
<parameter name="minLength"><value>0</value></parameter>
<parameter name="maxLength"><value>128</value></parameter>
</constraint>
</constraints>
</property>
18. built-in constraints
The built-in constraints are present in the package
org.alfresco.repo.dictionary.constraint and are:
REGEX : org.alfresco.repo.dictionary.constraint.RegexConstraint
LENGTH : org.alfresco.repo.dictionary.constraint.StringLengthConstraint
MINMAX : org.alfresco.repo.dictionary.constraint.NumericRangeConstraint
LIST : org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint
The <parameter> definitions correspond directly to setter methods on the classes
19. Writing Further Constraints
Implement the org.alfresco.service.cmr.dictionary.Constraint interface
Extend org.alfresco.repo.dictionary.constraint.AbstractConstraint..
<constraint name="my:FactorsOf"
type="com.company.alfresco.constraints.MultiplesOfConstraint">
<parameter name="multipleOf"><value>10</value></parameter>
</constraint>
20. Out-of-the-box Aspects
Classifiable Aspect: Enable Categorization so that categories can be linked to the
document.
Dublin Core Aspect: Add Dublin core metadata to the document. Dublin core
metadata includes properties such as Publisher, Contributor, Subject, and Rights.
Effectivity Aspect: Add effectivity properties called Effective From and Effective
To to the document.
Emailed Aspect: Add a set of properties called Email Data to the document. This is
useful to capture the email information if the document is an attachment to email.
Summarizable Aspect: Add a property called Summary to the document.
Templatable Aspect: Enable template view.
Geographic Aspect: Add two properties called Latitude and Longitude.
Versionable Aspect: Enable versioning.
23. Dynamic model
Enables dynamic customisation of models without requiring a restart of the server
deployment/undeployment of custom models (messages)
deployment/undeployment of custom workflow (process) definitions
deployment/undeployment of custom web client extensions
Models in Company Home -> Data Dictionary -> Models (Model Active checkbox)
Messages in Company Home -> Data Dictionary -> Messages
Webclient in Company Home -> Data Dictionary -> Web Client Extensions
http://localhost:8080/alfresco/faces/jsp/admin/webclientconfig-console.jsp → reload
NOTES:
Only incremental updates are supported for an active model.
If the update attempts to delete a type, aspect, property (etc) then the upload will fail.
24. Estendere il modello Avanzato
Il modello dei dati può essere esteso editando 3 file di configurazione
XML:
• QBR-Model-content.xml: permette di dichiarare alla
piattaforma un insieme di modelli di dati personalizzati che
saranno resi disponibili all’interno di Alfresco
• QBRModel.xml: permette di implementare il Content Model
definito, ossia dichiarare alla piattaforma Tipi, Aspetti, e
Associazioni.
• Web-client-config-custom.xml: permette di dichiarare il
modello creato all’interfaccia utente di Alfresco: “Web Client”.
Tomcat: <TOMCAT_HOME>/shared/classes/alfresco/extension