I need to create a model for cities that contains only the fields id, city name, like a sql table but without creating a file that is not inheriting any Alfresco model (content, folder, etc). I can do that? or it is obligatory to inherit from the Alfresco models
Asked
Active
Viewed 250 times
3 Answers
2
By seeing the definition of sys:base (root object) :
<type name="sys:base">
<title>Base</title>
<mandatory-aspects>
<aspect>sys:referenceable</aspect>
<aspect>sys:localized</aspect>
</mandatory-aspects>
</type>
I would say that it should be possible to create a type without inheriting from something.
But the best shot would be to do the try.
You can inherit from sys:base anyway.

Akah
- 1,890
- 20
- 28
-
I think that using sys:base is a good idea. The aspect sys:referenceable that will be added automatically is useful. The other aspect added automatically, sys:localized, is not really useful, but it won't create problems. – Marco Altieri Feb 18 '18 at 19:31
1
You could use a datalist like this to achieve that.
<description>Cities Data List Content model</description>
<version>1.0</version>
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
<!-- Import Alfresco Data List Model Definitions -->
<import uri="http://www.alfresco.org/model/datalist/1.0" prefix="dl" />
</imports>
<namespaces>
<namespace uri="<<Your uri>>" prefix="cities"/>
</namespaces>
<types>
<!--
Data List Item Type for the custom cities list
-->
<type name="cities:cityListItem">
<title>Cities List Item</title>
<parent>dl:dataListItem</parent>
<properties>
<property name="cities:cityName">
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="cities:cityID">
<type>d:int</type>
<mandatory>true</mandatory>
</property>
<property name="cities:cityDescription">
<type>d:text</type>
</property>
</properties>
</type>
</types>
You can later add more customization related to this datalist as you can see in here: https://docs.alfresco.com/5.1/references/dev-extension-points-data-lists.html

Adrián Álvarez
- 41
- 12
-
DataList is a good idea but is going to disapear : https://ecmarchitect.com/archives/2017/12/02/4305 – Akah Feb 16 '18 at 07:59
-
It is ok in alfresco 4 and 5.When alfresco 6 comes out it might not be correct but i think it will still work – Adrián Álvarez Feb 16 '18 at 10:53
-
I do not think that it is a good idea to use data-lists. They are deprecated and they had never been supported very well. – Marco Altieri Feb 18 '18 at 19:32
0
I'd suggest using AttributeService.
http://docs.alfresco.com/5.2/references/dev-services-attribute.html

Lista
- 2,186
- 1
- 15
- 18