Auto-Incrementing (Unique) ID in Alfresco

余生颓废 提交于 2019-12-11 08:03:30

问题


i am trying to extend alfresco's document management by running a script. So far, i have managed to create a Custom Model with a Custom Type and Property as seen below:

the said Custom Type is under this Custom Model (never mind the Custom Aspect for now)

the custom type is working so far, i managed to apply it to a certain document as you can see below (Notice the Control Code Field)

now what i want to do is to add an auto incrementing function that will be set as the value of the Control Code Property (ie: [FILE0012])

i tried utilizing the scripts rule from alfresco but it seems like the commands are limited to that of alfresco's functionalities. not even alert() or console.log functions work. i thought that if i can make a script that could call an ajax to my php server, i can extract the document's property, and insert it to my database and get the rowid then attach it to a word "FILE" so it becomes the Control Code Property (ie: a document was inserted to my database at row 1996, then the Control code is [FILE1996], this is because i joined '[FILE' and 1996 and ']'

but like i said, what happened was, the javascript commands are limited to that of alfresco's needs.

i tried to make my research but i've only bumped on 2 outdated (and i mean outdated) threads dating back to 2006-2010. which does not help me quite well with Alfresco's current build structure.

i hope someone can help me with here. connecting to the database is not mandatory, but if i can make it do as such then it'll give me quite a rather amazing results.


回答1:


Take a look at the "cm:countable" aspect. You do not have uniqueness guaranteed OOTB, so take that into account.

Example: http://www.avantec.se/howto-create-an-auto-increment-field-on-an-object-in-alfresco/



来源:https://stackoverflow.com/questions/38843229/auto-incrementing-unique-id-in-alfresco

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!