How does cm:countable aspect works in alfresco?

旧巷老猫 提交于 2019-12-12 21:04:32

问题


I have added:

        <mandatory-aspects>
            <aspect>cm:countable</aspect>
        </mandatory-aspects>

To list definition, so every item should have "increment" field. But when list items are created nothig happened. I have check the follwoing code:

  1. nodeService.getAspects(nodeRef) return all defined aspects for item, cm:countable presents in this list.
  2. nodeService.getProperty(nodeRef, QName.createQName("http://www.alfresco.org/model/content/1.0", "countable")) return null.
  3. nodeService.getProperties(nodeRef) returns all properties but no countable key is present.

I have search in alfresco sources and found CounterIncrementActionExecuter is extends ActionExecuterAbstractBase and defines executeImpl, but:

  1. executeImpl is not invoked at new list item creation.
  2. ActionExecuterAbstractBase#isApplicableType also not invoked.
  3. ActionExecuterAbstractBase#isApplicableType "looks" at applicableTypes variable which is not populatd explicitly in CounterIncrementActionExecuter. So it is unclear how it should be populated and when.

So the question is - how does cm:countable aspect actually works in alfresco?

UDPATE

As I see counter is incremented in java code. So is safe to use it with one database and multuple alfresco instances connected to db?


回答1:


This aspect is used generally by Alfresco administrator.It automatically increments the value of a number (integer) property when node is hit by services. This will generally only be used by Alfresco Administrators

cm:countable aspect has property called cm:counter which keeps track of current count.

So, your code for fetching property should be.

nodeService.getProperty(nodeRef, QName.createQName("http://www.alfresco.org/model/content/1.0", "counter"))

Now it works based on policy which is tied to that aspect. So, whenever node is invoked that counter is incremented.



来源:https://stackoverflow.com/questions/41076223/how-does-cmcountable-aspect-works-in-alfresco

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