cancel
Showing results for 
Search instead for 
Did you mean: 

Display sys:node-dbid as an aspect

dleeuwen
Champ in-the-making
Champ in-the-making
Hi all,

I am trying to maken a custom aspect that displays the dbid, but I can't get it working.

In my customModel.xml I added the following:


<aspect name="custom:Identiteit">
       <title>ID</title>
       <properties>
         <property name="custom:ID">
           <title>ID</title>
           <type>sys:node-dbid</type>
         </property>
       </properties>
</aspect>

But whenever I add the <type>sys:node-dbid</type> alfresco won't start anymore until I remove that line.

Do I use it in a wrong way?

Thanks,
Danny
10 REPLIES 10

kevinr
Star Contributor
Star Contributor
The 'sys:node-dbid' is not a datatype, "d:text" or similar is a datatype. You do not need to create an aspect to display that value, it is available on the very base object type for all nodes already. You just need to configure the client to display it like you would any other property value.

Thanks,

Kevin

dleeuwen
Champ in-the-making
Champ in-the-making
I've put this in the web-client-config-custom.xml. I already read the Data Dictionary Guide, but can't figure it out. Smiley Surprisedops:

<config evaluator="aspect-name" condition="cm:contentModel">
    <property-sheet>
      <show-property name="sys:node-dbid"/>
    </property-sheet>
</config>

It should be very simple I guess…

kevinr
Star Contributor
Star Contributor
The condition attribute is wrong, it should be a type or aspect that you want the property to appear for, so for all content types:

<config evaluator="aspect-name" condition="cm:content">
    <property-sheet>
       <show-property name="sys:node-dbid"/>
    </property-sheet>
</config>


If you only want the sys:node-dbid to display for a specific type or aspect then change the condition to that.

Thanks,

Kevin

dleeuwen
Champ in-the-making
Champ in-the-making
For now I want it to be displayed for all content types so I used your code and put it in \extension\web-client-config-custom.xml but nothing happends, any idea?

gavinc
Champ in-the-making
Champ in-the-making
Try


<config evaluator="node-type" condition="content">

as the first line

dleeuwen
Champ in-the-making
Champ in-the-making
Thanks, it works! And can I use this on a space also like:

<config evaluator="node-type" condition="folder"> 

Because I would like to use this number to generate a unique document name based on the parent folders dbid and the documents dbid, is this a smart thing to do?

gavinc
Champ in-the-making
Champ in-the-making
It depends how "unique" you want the name, if it's unique for the repository then it's probably fine but if it needs to be globally unique it will be a problem as the dbid is just a counter so you may get the same dbid in another database.

Also I'm not sure on the policy regarding the dbid when you do an export/import, it may be that the dbid gets re-generated which could prove to be a problem.

dleeuwen
Champ in-the-making
Champ in-the-making
I probably gonna use just 1 database, but if I ever use an export/import function I have to know for sure that this method of generating a unique name is safe and not that the dbid is regenerated at import/export.

Could you find out if the dbid is regenerated, or should I send an email to my Alfresco contact in Europe?

Thanks a lot!
-Danny

gavinc
Champ in-the-making
Champ in-the-making
I can confirm that the dbid property WILL be re-generated if you do an import/export.

The only id you can rely on is the actual node uuid which can be retained when you import a previous export.