我想在Alfresco中添加一個方面以添加我的自定義元數據,我只想知道如何將此方面添加到所有新創建的文件。如何將方面應用於Alfresco中所有新創建的文件
自定義元數據文件添加到\ Alfresco \ tomcat \ shared \ classes \ alfresco \擴展 目錄中。
我想在Alfresco中添加一個方面以添加我的自定義元數據,我只想知道如何將此方面添加到所有新創建的文件。如何將方面應用於Alfresco中所有新創建的文件
自定義元數據文件添加到\ Alfresco \ tomcat \ shared \ classes \ alfresco \擴展 目錄中。
向創建新文件時上傳到的文件夾添加例如規則配置了「添加方面」操作的規則。
如果您需要添加到所有內容添加到露天不管位置的一個方面,你最好使用JavaBehavior
連接到OnCreateNodePolicy
。
您可以檢查someAlfresco類的如何創建自定義行爲的一個例子,它會大致如下(使用cm:content
附加行爲,每一個文件):
public class AddAspectBehavior implements NodeServicePolicies.OnCreateNodePolicy
{
/** Policy component */
private PolicyComponent policyComponent;
/** Node service */
private NodeService nodeService;
/** Dictionary service */
private DictionaryService dictionaryService;
// TODO: add setters for the services
public void init()
{
this.policyComponent.bindClassBehaviour(
NodeServicePolicies.OnCreateNodePolicy.QNAME,
ContentModel.TYPE_CONTENT,
new JavaBehaviour(this, "onCreateNode", NotificationFrequency.TRANSACTION_COMMIT));
}
@Override
public void onCreateNode(ChildAssociationRef childAssocRef)
{
Map<QName,Serializable> aspectValues = new HashMap<QName,Serializable>();
// TODO: add relevand properties
nodeService.addAspect(childAssocReg.getChildRef(), MyCustomModel.ASPECT_TO_ADD, props);
}
}
然後,在一些春天上下文文件:
<bean id="my_package_behaviors_AddAspect"
class="my.package.AddAspectBehavior"
init-method="init">
<property name="nodeService" ref="NodeService"/>
<property name="policyComponent" ref="policyComponent"/>
</bean>
謝謝skuro,問題解決........... –
謝謝,我想添加規則來添加一個方面的空間中創建的所有文件,但屬性仍然沒有得到添加。 –
僅當您爲這些屬性賦值時纔會添加屬性。否則,您將無法在node.properties列表中找到這些屬性。 – Teqnology