3

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

yussenn
  • 577
  • 1
  • 7
  • 11

3 Answers3

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

0

I'd suggest using AttributeService.

http://docs.alfresco.com/5.2/references/dev-services-attribute.html

Lista
  • 2,186
  • 1
  • 15
  • 18