diff --git a/source/java/org/alfresco/repo/node/NodeServicePolicies.java b/source/java/org/alfresco/repo/node/NodeServicePolicies.java index 11d8846a23..07932a63b4 100644 --- a/source/java/org/alfresco/repo/node/NodeServicePolicies.java +++ b/source/java/org/alfresco/repo/node/NodeServicePolicies.java @@ -1,349 +1,376 @@ -/* - * Copyright (C) 2005-2012 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.node; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.repo.policy.AssociationPolicy; -import org.alfresco.repo.policy.ClassPolicy; -import org.alfresco.service.cmr.repository.AssociationRef; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; - -/** - * Node service policies - * - * @author Roy Wetherall - */ -public interface NodeServicePolicies -{ - public interface BeforeCreateStorePolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeCreateStore"); - /** - * Called before a new node store is created. - * - * @param nodeTypeQName the type of the node that will be used for the root - * @param storeRef the reference to the store about to be created - */ - public void beforeCreateStore(QName nodeTypeQName, StoreRef storeRef); - } - - public interface OnCreateStorePolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateStore"); - /** - * Called when a new node store has been created. - * - * @param rootNodeRef the reference to the newly created root node - */ - public void onCreateStore(NodeRef rootNodeRef); - } - - public interface BeforeCreateNodePolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeCreateNode"); - /** - * Called before a new node is created. - * - * @param parentRef the parent node reference - * @param assocTypeQName the association type qualified name - * @param assocQName the association qualified name - * @param nodeTypeQName the node type qualified name - */ - public void beforeCreateNode( - NodeRef parentRef, - QName assocTypeQName, - QName assocQName, - QName nodeTypeQName); - } - - public interface OnCreateNodePolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"); - /** - * Called when a new node has been created. - * - * @param childAssocRef the created child association reference - */ - public void onCreateNode(ChildAssociationRef childAssocRef); - } - - public interface BeforeMoveNodePolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeMoveNode"); - /** - * Called before a node is moved. - * - * @param oldChildAssocRef the child association reference prior to the move - * @param newParentRef the new parent node reference - * - * @since 4.1 - */ - public void beforeMoveNode(ChildAssociationRef oldChildAssocRef, NodeRef newParentRef); - } - - public interface OnMoveNodePolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onMoveNode"); - /** - * Called when a node has been moved. - * - * @param oldChildAssocRef the child association reference prior to the move - * @param newChildAssocRef the child association reference after the move - */ - public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef); - } - - public interface BeforeUpdateNodePolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeUpdateNode"); - /** - * Called before a node is updated. This includes the modification of properties, child and target - * associations and the addition of aspects. - * - * @param nodeRef reference to the node being updated - */ - public void beforeUpdateNode(NodeRef nodeRef); - } - - public interface OnUpdateNodePolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateNode"); - /** - * Called after a new node has been created. This includes the modification of properties, child and target - * associations and the addition of aspects. - * - * @param nodeRef reference to the updated node - */ - public void onUpdateNode(NodeRef nodeRef); - } - - public interface OnUpdatePropertiesPolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"); - /** - * Called after a node's properties have been changed. - * - * @param nodeRef reference to the updated node - * @param before the node's properties before the change - * @param after the node's properties after the change - */ - public void onUpdateProperties( - NodeRef nodeRef, - Map before, - Map after); - - static Arg ARG_0 = Arg.KEY; - static Arg ARG_1 = Arg.START_VALUE; - static Arg ARG_2 = Arg.END_VALUE; - } - - public interface BeforeDeleteNodePolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteNode"); - /** - * Called before a node is deleted. - * - * @param nodeRef the node reference - */ - public void beforeDeleteNode(NodeRef nodeRef); - } - - public interface BeforeArchiveNodePolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeArchiveNode"); - /** - * Called before a node is archived. - * - * @param nodeRef the node reference - */ - public void beforeArchiveNode(NodeRef nodeRef); - } - - public interface OnDeleteNodePolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteNode"); - /** - * Called after a node is deleted. The reference given is for an association - * which has been deleted and cannot be used to retrieve node or associaton - * information from any of the services. - * - * @param childAssocRef the primary parent-child association of the deleted node - * @param isNodeArchived indicates whether the node has been archived rather than purged - */ - public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived); - } - - public interface BeforeAddAspectPolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeAddAspect"); - /** - * Called before an aspect is added to a node - * - * @param nodeRef the node to which the aspect will be added - * @param aspectTypeQName the type of the aspect - */ - public void beforeAddAspect(NodeRef nodeRef, QName aspectTypeQName); - } - - public interface OnAddAspectPolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"); - /** - * Called after an aspect has been added to a node - * - * @param nodeRef the node to which the aspect was added - * @param aspectTypeQName the type of the aspect - */ - public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName); - } - - public interface BeforeRemoveAspectPolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRemoveAspect"); - /** - * Called before an aspect is removed from a node - * - * @param nodeRef the node from which the aspect will be removed - * @param aspectTypeQName the type of the aspect - */ - public void beforeRemoveAspect(NodeRef nodeRef, QName aspectTypeQName); - } - - public interface OnRemoveAspectPolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onRemoveAspect"); - /** - * Called after an aspect has been removed from a node - * - * @param nodeRef the node from which the aspect will be removed - * @param aspectTypeQName the type of the aspect - */ - public void onRemoveAspect(NodeRef nodeRef, QName aspectTypeQName); - } - - public interface OnRestoreNodePolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onRestoreNode"); - /** - * Called after an archived node is restored. - * - * @param childAssocRef the newly created child association reference - */ - public void onRestoreNode(ChildAssociationRef childAssocRef); - } - - public interface OnCreateChildAssociationPolicy extends AssociationPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"); - /** - * Called after a node child association has been created. - * - * @param childAssocRef the child association that has been created - * @param isNewNode true if the node is new or false if the node is being linked in - */ - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode); - } - - public interface BeforeDeleteChildAssociationPolicy extends AssociationPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteChildAssociation"); - /** - * Called before a node child association is deleted. - * - * @param childAssocRef the child association to be deleted - */ - public void beforeDeleteChildAssociation(ChildAssociationRef childAssocRef); - } - - public interface OnDeleteChildAssociationPolicy extends AssociationPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteChildAssociation"); - /** - * Called after a node child association has been deleted. - * - * @param childAssocRef the child association that has been deleted - */ - public void onDeleteChildAssociation(ChildAssociationRef childAssocRef); - } - - public interface OnCreateAssociationPolicy extends AssociationPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateAssociation"); - /** - * Called after a regular node association is created. - * - * @param nodeAssocRef the regular node association that was created - */ - public void onCreateAssociation(AssociationRef nodeAssocRef); - } - - public interface BeforeDeleteAssociationPolicy extends AssociationPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteAssociation"); - /** - * Called before a regular node association is deleted. - * - * @param nodeAssocRef the regular node association that will be removed - */ - public void beforeDeleteAssociation(AssociationRef nodeAssocRef); - } - - public interface OnDeleteAssociationPolicy extends AssociationPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteAssociation"); - /** - * Called after a regular node association is deleted. - * - * @param nodeAssocRef the regular node association that was removed - */ - public void onDeleteAssociation(AssociationRef nodeAssocRef); - } - - public interface BeforeSetNodeTypePolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeSetNodeType"); - /** - * Called before the type of a node is set explicitly. - * - * @param nodeRef the node having its type set. - * @param oldType the current type of the node. - * @param newType the type the node will be given. - */ - public void beforeSetNodeType(NodeRef nodeRef, QName oldType, QName newType); - } - - public interface OnSetNodeTypePolicy extends ClassPolicy - { - public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onSetNodeType"); - /** - * Called after the type of a node is set explicitly. - * - * @param nodeRef the node that has had its type set. - * @param oldType the previous type of the node. - * @param newType the type the node has been given. - */ - public void onSetNodeType(NodeRef nodeRef, QName oldType, QName newType); - } -} +/* + * Copyright (C) 2005-2012 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.node; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.repo.policy.AssociationPolicy; +import org.alfresco.repo.policy.ClassPolicy; +import org.alfresco.service.cmr.repository.AssociationRef; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; + +/** + * Node service policies + * + * @author Roy Wetherall + */ +@AlfrescoPublicApi +public interface NodeServicePolicies +{ + @AlfrescoPublicApi + public interface BeforeCreateStorePolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeCreateStore"); + /** + * Called before a new node store is created. + * + * @param nodeTypeQName the type of the node that will be used for the root + * @param storeRef the reference to the store about to be created + */ + public void beforeCreateStore(QName nodeTypeQName, StoreRef storeRef); + } + + @AlfrescoPublicApi + public interface OnCreateStorePolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateStore"); + /** + * Called when a new node store has been created. + * + * @param rootNodeRef the reference to the newly created root node + */ + public void onCreateStore(NodeRef rootNodeRef); + } + + @AlfrescoPublicApi + public interface BeforeCreateNodePolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeCreateNode"); + /** + * Called before a new node is created. + * + * @param parentRef the parent node reference + * @param assocTypeQName the association type qualified name + * @param assocQName the association qualified name + * @param nodeTypeQName the node type qualified name + */ + public void beforeCreateNode( + NodeRef parentRef, + QName assocTypeQName, + QName assocQName, + QName nodeTypeQName); + } + + @AlfrescoPublicApi + public interface OnCreateNodePolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"); + /** + * Called when a new node has been created. + * + * @param childAssocRef the created child association reference + */ + public void onCreateNode(ChildAssociationRef childAssocRef); + } + + @AlfrescoPublicApi + public interface BeforeMoveNodePolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeMoveNode"); + /** + * Called before a node is moved. + * + * @param oldChildAssocRef the child association reference prior to the move + * @param newParentRef the new parent node reference + * + * @since 4.1 + */ + public void beforeMoveNode(ChildAssociationRef oldChildAssocRef, NodeRef newParentRef); + } + + @AlfrescoPublicApi + public interface OnMoveNodePolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onMoveNode"); + /** + * Called when a node has been moved. + * + * @param oldChildAssocRef the child association reference prior to the move + * @param newChildAssocRef the child association reference after the move + */ + public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef); + } + + @AlfrescoPublicApi + public interface BeforeUpdateNodePolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeUpdateNode"); + /** + * Called before a node is updated. This includes the modification of properties, child and target + * associations and the addition of aspects. + * + * @param nodeRef reference to the node being updated + */ + public void beforeUpdateNode(NodeRef nodeRef); + } + + @AlfrescoPublicApi + public interface OnUpdateNodePolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateNode"); + /** + * Called after a new node has been created. This includes the modification of properties, child and target + * associations and the addition of aspects. + * + * @param nodeRef reference to the updated node + */ + public void onUpdateNode(NodeRef nodeRef); + } + + @AlfrescoPublicApi + public interface OnUpdatePropertiesPolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"); + /** + * Called after a node's properties have been changed. + * + * @param nodeRef reference to the updated node + * @param before the node's properties before the change + * @param after the node's properties after the change + */ + public void onUpdateProperties( + NodeRef nodeRef, + Map before, + Map after); + + static Arg ARG_0 = Arg.KEY; + static Arg ARG_1 = Arg.START_VALUE; + static Arg ARG_2 = Arg.END_VALUE; + } + + @AlfrescoPublicApi + public interface BeforeDeleteNodePolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteNode"); + /** + * Called before a node is deleted. + * + * @param nodeRef the node reference + */ + public void beforeDeleteNode(NodeRef nodeRef); + } + + @AlfrescoPublicApi + public interface BeforeArchiveNodePolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeArchiveNode"); + /** + * Called before a node is archived. + * + * @param nodeRef the node reference + */ + public void beforeArchiveNode(NodeRef nodeRef); + } + + @AlfrescoPublicApi + public interface OnDeleteNodePolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteNode"); + /** + * Called after a node is deleted. The reference given is for an association + * which has been deleted and cannot be used to retrieve node or associaton + * information from any of the services. + * + * @param childAssocRef the primary parent-child association of the deleted node + * @param isNodeArchived indicates whether the node has been archived rather than purged + */ + public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived); + } + + @AlfrescoPublicApi + public interface BeforeAddAspectPolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeAddAspect"); + /** + * Called before an aspect is added to a node + * + * @param nodeRef the node to which the aspect will be added + * @param aspectTypeQName the type of the aspect + */ + public void beforeAddAspect(NodeRef nodeRef, QName aspectTypeQName); + } + + @AlfrescoPublicApi + public interface OnAddAspectPolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"); + /** + * Called after an aspect has been added to a node + * + * @param nodeRef the node to which the aspect was added + * @param aspectTypeQName the type of the aspect + */ + public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName); + } + + @AlfrescoPublicApi + public interface BeforeRemoveAspectPolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeRemoveAspect"); + /** + * Called before an aspect is removed from a node + * + * @param nodeRef the node from which the aspect will be removed + * @param aspectTypeQName the type of the aspect + */ + public void beforeRemoveAspect(NodeRef nodeRef, QName aspectTypeQName); + } + + @AlfrescoPublicApi + public interface OnRemoveAspectPolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onRemoveAspect"); + /** + * Called after an aspect has been removed from a node + * + * @param nodeRef the node from which the aspect will be removed + * @param aspectTypeQName the type of the aspect + */ + public void onRemoveAspect(NodeRef nodeRef, QName aspectTypeQName); + } + + @AlfrescoPublicApi + public interface OnRestoreNodePolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onRestoreNode"); + /** + * Called after an archived node is restored. + * + * @param childAssocRef the newly created child association reference + */ + public void onRestoreNode(ChildAssociationRef childAssocRef); + } + + @AlfrescoPublicApi + public interface OnCreateChildAssociationPolicy extends AssociationPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"); + /** + * Called after a node child association has been created. + * + * @param childAssocRef the child association that has been created + * @param isNewNode true if the node is new or false if the node is being linked in + */ + public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode); + } + + @AlfrescoPublicApi + public interface BeforeDeleteChildAssociationPolicy extends AssociationPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteChildAssociation"); + /** + * Called before a node child association is deleted. + * + * @param childAssocRef the child association to be deleted + */ + public void beforeDeleteChildAssociation(ChildAssociationRef childAssocRef); + } + + @AlfrescoPublicApi + public interface OnDeleteChildAssociationPolicy extends AssociationPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteChildAssociation"); + /** + * Called after a node child association has been deleted. + * + * @param childAssocRef the child association that has been deleted + */ + public void onDeleteChildAssociation(ChildAssociationRef childAssocRef); + } + + @AlfrescoPublicApi + public interface OnCreateAssociationPolicy extends AssociationPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateAssociation"); + /** + * Called after a regular node association is created. + * + * @param nodeAssocRef the regular node association that was created + */ + public void onCreateAssociation(AssociationRef nodeAssocRef); + } + + @AlfrescoPublicApi + public interface BeforeDeleteAssociationPolicy extends AssociationPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeDeleteAssociation"); + /** + * Called before a regular node association is deleted. + * + * @param nodeAssocRef the regular node association that will be removed + */ + public void beforeDeleteAssociation(AssociationRef nodeAssocRef); + } + + @AlfrescoPublicApi + public interface OnDeleteAssociationPolicy extends AssociationPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteAssociation"); + /** + * Called after a regular node association is deleted. + * + * @param nodeAssocRef the regular node association that was removed + */ + public void onDeleteAssociation(AssociationRef nodeAssocRef); + } + + @AlfrescoPublicApi + public interface BeforeSetNodeTypePolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "beforeSetNodeType"); + /** + * Called before the type of a node is set explicitly. + * + * @param nodeRef the node having its type set. + * @param oldType the current type of the node. + * @param newType the type the node will be given. + */ + public void beforeSetNodeType(NodeRef nodeRef, QName oldType, QName newType); + } + + @AlfrescoPublicApi + public interface OnSetNodeTypePolicy extends ClassPolicy + { + public static final QName QNAME = QName.createQName(NamespaceService.ALFRESCO_URI, "onSetNodeType"); + /** + * Called after the type of a node is set explicitly. + * + * @param nodeRef the node that has had its type set. + * @param oldType the previous type of the node. + * @param newType the type the node has been given. + */ + public void onSetNodeType(NodeRef nodeRef, QName oldType, QName newType); + } +} diff --git a/source/java/org/alfresco/repo/nodelocator/NodeLocatorService.java b/source/java/org/alfresco/repo/nodelocator/NodeLocatorService.java index d435e6552c..00dfb9e346 100644 --- a/source/java/org/alfresco/repo/nodelocator/NodeLocatorService.java +++ b/source/java/org/alfresco/repo/nodelocator/NodeLocatorService.java @@ -1,47 +1,49 @@ -/* - * Copyright (C) 2005-2011 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ - -package org.alfresco.repo.nodelocator; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * This service is responsible for locating {@link NodeRef}s in the repository using {@link NodeLocator} strategies. - * - * @author Nick Smith - * @since 4.0 - * - */ -public interface NodeLocatorService -{ - /** - * Locates and returns a {@link NodeRef} using the specified {@link NodeLocator}. - * - * @param locatorName the name of the {@link NodeLocator} to use. - * @param source the source node. Can be null. - * @param params An arbitrary set of parameters. Can be null. - * @return the node to be found or null. - */ - NodeRef getNode(String locatorName, NodeRef source, Map params); - - void register(String locatorName, NodeLocator locator); -} +/* + * Copyright (C) 2005-2011 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ + +package org.alfresco.repo.nodelocator; + +import java.io.Serializable; +import java.util.Map; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * This service is responsible for locating {@link NodeRef}s in the repository using {@link NodeLocator} strategies. + * + * @author Nick Smith + * @since 4.0 + * + */ +@AlfrescoPublicApi +public interface NodeLocatorService +{ + /** + * Locates and returns a {@link NodeRef} using the specified {@link NodeLocator}. + * + * @param locatorName the name of the {@link NodeLocator} to use. + * @param source the source node. Can be null. + * @param params An arbitrary set of parameters. Can be null. + * @return the node to be found or null. + */ + NodeRef getNode(String locatorName, NodeRef source, Map params); + + void register(String locatorName, NodeLocator locator); +} diff --git a/source/java/org/alfresco/repo/policy/AssociationPolicy.java b/source/java/org/alfresco/repo/policy/AssociationPolicy.java index c3afeeeffb..c1238ac16f 100644 --- a/source/java/org/alfresco/repo/policy/AssociationPolicy.java +++ b/source/java/org/alfresco/repo/policy/AssociationPolicy.java @@ -1,30 +1,32 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - - -/** - * Marker interface for representing an Association-level Policy. - * - * @author David Caruana - */ -public interface AssociationPolicy extends Policy -{ - -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Marker interface for representing an Association-level Policy. + * + * @author David Caruana + */ +@AlfrescoPublicApi +public interface AssociationPolicy extends Policy +{ + +} diff --git a/source/java/org/alfresco/repo/policy/AssociationPolicyDelegate.java b/source/java/org/alfresco/repo/policy/AssociationPolicyDelegate.java index b6d1897d10..8a82435259 100644 --- a/source/java/org/alfresco/repo/policy/AssociationPolicyDelegate.java +++ b/source/java/org/alfresco/repo/policy/AssociationPolicyDelegate.java @@ -1,209 +1,211 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.service.cmr.dictionary.AssociationDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - - -/** - * Delegate for a Class Feature-level (Property and Association) Policies. Provides - * access to Policy Interface implementations which invoke the appropriate bound behaviours. - * - * @author David Caruana - * - * @param

the policy interface - */ -public class AssociationPolicyDelegate

-{ - private DictionaryService dictionary; - private CachedPolicyFactory factory; - - - /** - * Construct. - * - * @param dictionary the dictionary service - * @param policyClass the policy interface class - * @param index the behaviour index to query against - */ - @SuppressWarnings("unchecked") - /*package*/ AssociationPolicyDelegate(DictionaryService dictionary, Class

policyClass, BehaviourIndex index) - { - // Get list of all pre-registered behaviours for the policy and - // ensure they are valid. - Collection definitions = index.getAll(); - for (BehaviourDefinition definition : definitions) - { - definition.getBehaviour().getInterface(policyClass); - } - - // Rely on cached implementation of policy factory - // Note: Could also use PolicyFactory (without caching) - this.factory = new CachedPolicyFactory(policyClass, index); - this.dictionary = dictionary; - } - - /** - * Ensures the validity of the given assoc type - * - * @param assocTypeQName - * @throws IllegalArgumentException - */ - private void checkAssocType(QName assocTypeQName) throws IllegalArgumentException - { - AssociationDefinition assocDef = dictionary.getAssociation(assocTypeQName); - if (assocDef == null) - { - throw new IllegalArgumentException("Association " + assocTypeQName + " has not been defined in the data dictionary"); - } - } - - /** - * Gets the Policy implementation for the specified Class and Association - * - * When multiple behaviours are bound to the policy for the class feature, an - * aggregate policy implementation is returned which invokes each policy - * in turn. - * - * @param classQName the class qualified name - * @param assocTypeQName the association type qualified name - * @return the policy - */ - public P get(QName classQName, QName assocTypeQName) - { - return get(null, classQName, assocTypeQName); - } - - /** - * Gets the Policy implementation for the specified Class and Association - * - * When multiple behaviours are bound to the policy for the class feature, an - * aggregate policy implementation is returned which invokes each policy - * in turn. - * - * @param nodeRef the node reference - * @param classQName the class qualified name - * @param assocTypeQName the association type qualified name - * @return the policy - */ - public P get(NodeRef nodeRef, QName classQName, QName assocTypeQName) - { - checkAssocType(assocTypeQName); - return factory.create(new ClassFeatureBehaviourBinding(dictionary, nodeRef, classQName, assocTypeQName)); - } - - /** - * Gets the collection of Policy implementations for the specified Class and Association - * - * @param classQName the class qualified name - * @param assocTypeQName the association type qualified name - * @return the collection of policies - */ - public Collection

getList(QName classQName, QName assocTypeQName) - { - return getList(null, classQName, assocTypeQName); - } - - /** - * Gets the collection of Policy implementations for the specified Class and Association - * - * @param nodeRef the node reference - * @param classQName the class qualified name - * @param assocTypeQName the association type qualified name - * @return the collection of policies - */ - public Collection

getList(NodeRef nodeRef, QName classQName, QName assocTypeQName) - { - checkAssocType(assocTypeQName); - return factory.createList(new ClassFeatureBehaviourBinding(dictionary, nodeRef, classQName, assocTypeQName)); - } - - /** - * Gets a Policy for all the given Class and Association - * - * @param classQNames the class qualified names - * @param assocTypeQName the association type qualified name - * @return Return the policy - */ - public P get(Set classQNames, QName assocTypeQName) - { - return get(null, classQNames, assocTypeQName); - } - - /** - * Gets a Policy for all the given Class and Association - * - * @param nodeRef the node reference - * @param classQNames the class qualified names - * @param assocTypeQName the association type qualified name - * @return Return the policy - */ - public P get(NodeRef nodeRef, Set classQNames, QName assocTypeQName) - { - checkAssocType(assocTypeQName); - return factory.toPolicy(getList(nodeRef, classQNames, assocTypeQName)); - } - - /** - * Gets the Policy instances for all the given Classes and Associations - * - * @param classQNames the class qualified names - * @param assocTypeQName the association type qualified name - * @return Return the policies - */ - public Collection

getList(Set classQNames, QName assocTypeQName) - { - return getList(null, classQNames, assocTypeQName); - } - - /** - * Gets the Policy instances for all the given Classes and Associations - * - * @param nodeRef the node reference - * @param classQNames the class qualified names - * @param assocTypeQName the association type qualified name - * @return Return the policies - */ - public Collection

getList(NodeRef nodeRef, Set classQNames, QName assocTypeQName) - { - checkAssocType(assocTypeQName); - Collection

policies = new HashSet

(); - for (QName classQName : classQNames) - { - P policy = factory.create(new ClassFeatureBehaviourBinding(dictionary, nodeRef, classQName, assocTypeQName)); - if (policy instanceof PolicyList) - { - policies.addAll(((PolicyList

)policy).getPolicies()); - } - else - { - policies.add(policy); - } - } - return policies; - } - -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.dictionary.AssociationDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + + +/** + * Delegate for a Class Feature-level (Property and Association) Policies. Provides + * access to Policy Interface implementations which invoke the appropriate bound behaviours. + * + * @author David Caruana + * + * @param

the policy interface + */ +@AlfrescoPublicApi +public class AssociationPolicyDelegate

+{ + private DictionaryService dictionary; + private CachedPolicyFactory factory; + + + /** + * Construct. + * + * @param dictionary the dictionary service + * @param policyClass the policy interface class + * @param index the behaviour index to query against + */ + @SuppressWarnings("unchecked") + /*package*/ AssociationPolicyDelegate(DictionaryService dictionary, Class

policyClass, BehaviourIndex index) + { + // Get list of all pre-registered behaviours for the policy and + // ensure they are valid. + Collection definitions = index.getAll(); + for (BehaviourDefinition definition : definitions) + { + definition.getBehaviour().getInterface(policyClass); + } + + // Rely on cached implementation of policy factory + // Note: Could also use PolicyFactory (without caching) + this.factory = new CachedPolicyFactory(policyClass, index); + this.dictionary = dictionary; + } + + /** + * Ensures the validity of the given assoc type + * + * @param assocTypeQName + * @throws IllegalArgumentException + */ + private void checkAssocType(QName assocTypeQName) throws IllegalArgumentException + { + AssociationDefinition assocDef = dictionary.getAssociation(assocTypeQName); + if (assocDef == null) + { + throw new IllegalArgumentException("Association " + assocTypeQName + " has not been defined in the data dictionary"); + } + } + + /** + * Gets the Policy implementation for the specified Class and Association + * + * When multiple behaviours are bound to the policy for the class feature, an + * aggregate policy implementation is returned which invokes each policy + * in turn. + * + * @param classQName the class qualified name + * @param assocTypeQName the association type qualified name + * @return the policy + */ + public P get(QName classQName, QName assocTypeQName) + { + return get(null, classQName, assocTypeQName); + } + + /** + * Gets the Policy implementation for the specified Class and Association + * + * When multiple behaviours are bound to the policy for the class feature, an + * aggregate policy implementation is returned which invokes each policy + * in turn. + * + * @param nodeRef the node reference + * @param classQName the class qualified name + * @param assocTypeQName the association type qualified name + * @return the policy + */ + public P get(NodeRef nodeRef, QName classQName, QName assocTypeQName) + { + checkAssocType(assocTypeQName); + return factory.create(new ClassFeatureBehaviourBinding(dictionary, nodeRef, classQName, assocTypeQName)); + } + + /** + * Gets the collection of Policy implementations for the specified Class and Association + * + * @param classQName the class qualified name + * @param assocTypeQName the association type qualified name + * @return the collection of policies + */ + public Collection

getList(QName classQName, QName assocTypeQName) + { + return getList(null, classQName, assocTypeQName); + } + + /** + * Gets the collection of Policy implementations for the specified Class and Association + * + * @param nodeRef the node reference + * @param classQName the class qualified name + * @param assocTypeQName the association type qualified name + * @return the collection of policies + */ + public Collection

getList(NodeRef nodeRef, QName classQName, QName assocTypeQName) + { + checkAssocType(assocTypeQName); + return factory.createList(new ClassFeatureBehaviourBinding(dictionary, nodeRef, classQName, assocTypeQName)); + } + + /** + * Gets a Policy for all the given Class and Association + * + * @param classQNames the class qualified names + * @param assocTypeQName the association type qualified name + * @return Return the policy + */ + public P get(Set classQNames, QName assocTypeQName) + { + return get(null, classQNames, assocTypeQName); + } + + /** + * Gets a Policy for all the given Class and Association + * + * @param nodeRef the node reference + * @param classQNames the class qualified names + * @param assocTypeQName the association type qualified name + * @return Return the policy + */ + public P get(NodeRef nodeRef, Set classQNames, QName assocTypeQName) + { + checkAssocType(assocTypeQName); + return factory.toPolicy(getList(nodeRef, classQNames, assocTypeQName)); + } + + /** + * Gets the Policy instances for all the given Classes and Associations + * + * @param classQNames the class qualified names + * @param assocTypeQName the association type qualified name + * @return Return the policies + */ + public Collection

getList(Set classQNames, QName assocTypeQName) + { + return getList(null, classQNames, assocTypeQName); + } + + /** + * Gets the Policy instances for all the given Classes and Associations + * + * @param nodeRef the node reference + * @param classQNames the class qualified names + * @param assocTypeQName the association type qualified name + * @return Return the policies + */ + public Collection

getList(NodeRef nodeRef, Set classQNames, QName assocTypeQName) + { + checkAssocType(assocTypeQName); + Collection

policies = new HashSet

(); + for (QName classQName : classQNames) + { + P policy = factory.create(new ClassFeatureBehaviourBinding(dictionary, nodeRef, classQName, assocTypeQName)); + if (policy instanceof PolicyList) + { + policies.addAll(((PolicyList

)policy).getPolicies()); + } + else + { + policies.add(policy); + } + } + return policies; + } + +} diff --git a/source/java/org/alfresco/repo/policy/BaseBehaviour.java b/source/java/org/alfresco/repo/policy/BaseBehaviour.java index 29aa5a6a72..70ab5e70b6 100644 --- a/source/java/org/alfresco/repo/policy/BaseBehaviour.java +++ b/source/java/org/alfresco/repo/policy/BaseBehaviour.java @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Stack; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.repo.policy.Behaviour.NotificationFrequency; import org.springframework.extensions.surf.util.ParameterCheck; @@ -30,6 +31,7 @@ import org.springframework.extensions.surf.util.ParameterCheck; * * @author Roy Wetherall */ +@AlfrescoPublicApi public abstract class BaseBehaviour implements Behaviour { /** The notification frequency */ diff --git a/source/java/org/alfresco/repo/policy/Behaviour.java b/source/java/org/alfresco/repo/policy/Behaviour.java index 2ef5ba2218..0f4d28ac7f 100644 --- a/source/java/org/alfresco/repo/policy/Behaviour.java +++ b/source/java/org/alfresco/repo/policy/Behaviour.java @@ -1,74 +1,76 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - - -/** - * A Behaviour represents an encapsulated piece of logic (system or business) - * that may be bound to a Policy. The logic may be expressed in any - * language (java, script etc). - * - * Once bound to a Policy, the behaviour must be able to provide the interface - * declared by that policy. - * - * @author David Caruana - */ -public interface Behaviour -{ - - /** - * When should behaviour be notified? - */ - public enum NotificationFrequency - { - EVERY_EVENT, - FIRST_EVENT, - TRANSACTION_COMMIT - } - - /** - * Gets the requested policy interface onto the behaviour - * - * @param policy the policy interface class - * @return the policy interface - */ - public T getInterface(Class policy); - - /** - * Disable the behaviour (for this thread only) - */ - public void disable(); - - /** - * Enable the behaviour (for this thread only) - */ - public void enable(); - - /** - * @return is the behaviour enabled (for this thread only) - */ - public boolean isEnabled(); - - /** - * @return the notification - */ - public NotificationFrequency getNotificationFrequency(); - -} - +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * A Behaviour represents an encapsulated piece of logic (system or business) + * that may be bound to a Policy. The logic may be expressed in any + * language (java, script etc). + * + * Once bound to a Policy, the behaviour must be able to provide the interface + * declared by that policy. + * + * @author David Caruana + */ +@AlfrescoPublicApi +public interface Behaviour +{ + + /** + * When should behaviour be notified? + */ + public enum NotificationFrequency + { + EVERY_EVENT, + FIRST_EVENT, + TRANSACTION_COMMIT + } + + /** + * Gets the requested policy interface onto the behaviour + * + * @param policy the policy interface class + * @return the policy interface + */ + public T getInterface(Class policy); + + /** + * Disable the behaviour (for this thread only) + */ + public void disable(); + + /** + * Enable the behaviour (for this thread only) + */ + public void enable(); + + /** + * @return is the behaviour enabled (for this thread only) + */ + public boolean isEnabled(); + + /** + * @return the notification + */ + public NotificationFrequency getNotificationFrequency(); + +} + diff --git a/source/java/org/alfresco/repo/policy/BehaviourBinding.java b/source/java/org/alfresco/repo/policy/BehaviourBinding.java index e87d058a23..76cdc37f33 100644 --- a/source/java/org/alfresco/repo/policy/BehaviourBinding.java +++ b/source/java/org/alfresco/repo/policy/BehaviourBinding.java @@ -1,40 +1,41 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - - -/** - * A Behaviour Binding represents the way in which a Behaviour is bound - * to a Policy i.e. the key. - * - * @author David Caruana - * - */ -/*package*/ interface BehaviourBinding -{ - /** - * Gets a generalised form of the Binding. - * - * For example, if the binding key is hierarchical, return the parent - * key. - * - * @return the generalised form (or null, if there isn't one) - */ - BehaviourBinding generaliseBinding(); -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * A Behaviour Binding represents the way in which a Behaviour is bound + * to a Policy i.e. the key. + * + * @author David Caruana + * + */ +/*package*/ @AlfrescoPublicApi interface BehaviourBinding +{ + /** + * Gets a generalised form of the Binding. + * + * For example, if the binding key is hierarchical, return the parent + * key. + * + * @return the generalised form (or null, if there isn't one) + */ + BehaviourBinding generaliseBinding(); +} diff --git a/source/java/org/alfresco/repo/policy/BehaviourDefinition.java b/source/java/org/alfresco/repo/policy/BehaviourDefinition.java index 142c7a7e88..031c7c63a3 100644 --- a/source/java/org/alfresco/repo/policy/BehaviourDefinition.java +++ b/source/java/org/alfresco/repo/policy/BehaviourDefinition.java @@ -1,60 +1,62 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - -import org.alfresco.service.namespace.QName; - - -/** - * Description of a bound Behaviour. - * - * @author David Caruana - * - * @param The type of Binding. - */ -public interface BehaviourDefinition -{ - /** - * Gets the Policy bound to - * - * @return the policy name - */ - public QName getPolicy(); - - /** - * Gets the definition of the Policy bound to - * - * @return the policy definition (or null, if the Policy has not been registered yet) - */ - public PolicyDefinition getPolicyDefinition(); - - /** - * Gets the binding used to bind the Behaviour to the Policy - * - * @return the binding - */ - public B getBinding(); - - /** - * Gets the Behaviour - * - * @return the behaviour - */ - public Behaviour getBehaviour(); -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.namespace.QName; + + +/** + * Description of a bound Behaviour. + * + * @author David Caruana + * + * @param The type of Binding. + */ +@AlfrescoPublicApi +public interface BehaviourDefinition +{ + /** + * Gets the Policy bound to + * + * @return the policy name + */ + public QName getPolicy(); + + /** + * Gets the definition of the Policy bound to + * + * @return the policy definition (or null, if the Policy has not been registered yet) + */ + public PolicyDefinition getPolicyDefinition(); + + /** + * Gets the binding used to bind the Behaviour to the Policy + * + * @return the binding + */ + public B getBinding(); + + /** + * Gets the Behaviour + * + * @return the behaviour + */ + public Behaviour getBehaviour(); +} diff --git a/source/java/org/alfresco/repo/policy/BehaviourIndex.java b/source/java/org/alfresco/repo/policy/BehaviourIndex.java index 993c658614..dd049ee7bd 100644 --- a/source/java/org/alfresco/repo/policy/BehaviourIndex.java +++ b/source/java/org/alfresco/repo/policy/BehaviourIndex.java @@ -1,64 +1,65 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - -import java.util.Collection; - - -/** - * Index of Bound Behaviours. - * - * @author David Caruana - * - * @param the type of Binding. - */ -/*package*/ interface BehaviourIndex -{ - /** - * Gets all bound behaviours - * - * @return the bound behaviours - */ - public Collection getAll(); - - /** - * Gets all bound behaviours for the specified binding. - * - * Note: The index may use any algorithm for determining which behaviours - * are returned for the binding e.g. based on hierarchical binding - * - * @param binding the binding - * @return the associated behaviours - */ - public Collection find(B binding); - - /** - * Add a Behaviour Change Observer. - * - * @param observer the observer - */ - public void addChangeObserver(BehaviourChangeObserver observer); - - /** - * Gets the behaviour filter - * - * @return the behaviour filter - */ - public BehaviourFilter getFilter(); -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import java.util.Collection; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Index of Bound Behaviours. + * + * @author David Caruana + * + * @param the type of Binding. + */ +/*package*/ @AlfrescoPublicApi interface BehaviourIndex +{ + /** + * Gets all bound behaviours + * + * @return the bound behaviours + */ + public Collection getAll(); + + /** + * Gets all bound behaviours for the specified binding. + * + * Note: The index may use any algorithm for determining which behaviours + * are returned for the binding e.g. based on hierarchical binding + * + * @param binding the binding + * @return the associated behaviours + */ + public Collection find(B binding); + + /** + * Add a Behaviour Change Observer. + * + * @param observer the observer + */ + public void addChangeObserver(BehaviourChangeObserver observer); + + /** + * Gets the behaviour filter + * + * @return the behaviour filter + */ + public BehaviourFilter getFilter(); +} diff --git a/source/java/org/alfresco/repo/policy/CachedPolicyFactory.java b/source/java/org/alfresco/repo/policy/CachedPolicyFactory.java index 9a59a86591..5e4429802e 100644 --- a/source/java/org/alfresco/repo/policy/CachedPolicyFactory.java +++ b/source/java/org/alfresco/repo/policy/CachedPolicyFactory.java @@ -1,246 +1,247 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import org.alfresco.util.LockHelper; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - - -/** - * Policy Factory with caching support. - * - * @author David Caruana - * - * @param the type of Binding - * @param

the type of Policy - */ -/*package*/ class CachedPolicyFactory extends PolicyFactory -{ - // Logger - private static final Log logger = LogFactory.getLog(PolicyComponentImpl.class); - - // Behaviour Filter - private BehaviourFilter behaviourFilter = null; - - // Cache Lock - private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); - - /** - * Cache for a single Policy interface (keyed by Binding) - */ - private Map singleCache = new HashMap(); - - /** - * Cache for a collection of Policy interfaces (keyed by Binding) - */ - private Map> listCache = new HashMap>(); - - - /** - * Construct cached policy factory - * - * @param policyClass the policy interface class - * @param index the behaviour index to search on - */ - /*package*/ CachedPolicyFactory(Class

policyClass, BehaviourIndex index) - { - super(policyClass, index); - behaviourFilter = index.getFilter(); - - // Register this cached policy factory as a change observer of the behaviour index - // to allow for cache to be cleared appropriately. - index.addChangeObserver(new BehaviourChangeObserver() - { - public void addition(B binding, Behaviour behaviour) - { - clearCache("aggregate delegate", singleCache, binding); - clearCache("delegate collection", listCache, binding); - } - }); - } - - - @Override - public P create(B binding) - { - // When behaviour filters are activated bypass the cache - if (behaviourFilter != null && behaviourFilter.isActivated()) - { - return super.create(binding); - } - - LockHelper.tryLock(lock.readLock(), 100); - try - { - P policyInterface = singleCache.get(binding); - if (policyInterface != null) - { - return policyInterface; - } - } - finally - { - lock.readLock().unlock(); - } - - // There wasn't one - LockHelper.tryLock(lock.writeLock(), 100); - try - { - P policyInterface = singleCache.get(binding); - if (policyInterface != null) - { - return policyInterface; - } - policyInterface = super.create(binding); - singleCache.put(binding, policyInterface); - - if (logger.isDebugEnabled()) - logger.debug("Cached delegate interface " + policyInterface + " for " + binding + " and policy " + getPolicyClass()); - - return policyInterface; - } - finally - { - lock.writeLock().unlock(); - } - } - - - @Override - public Collection

createList(B binding) - { - // When behaviour filters are activated bypass the cache - if (behaviourFilter != null && behaviourFilter.isActivated()) - { - return super.createList(binding); - } - - LockHelper.tryLock(lock.readLock(), 100); - try - { - Collection

policyInterfaces = listCache.get(binding); - if (policyInterfaces != null) - { - return policyInterfaces; - } - } - finally - { - lock.readLock().unlock(); - } - - // There wasn't one - LockHelper.tryLock(lock.writeLock(), 100); - try - { - Collection

policyInterfaces = listCache.get(binding); - if (policyInterfaces != null) - { - return policyInterfaces; - } - policyInterfaces = super.createList(binding); - listCache.put(binding, policyInterfaces); - - if (logger.isDebugEnabled()) - logger.debug("Cached delegate interface collection " + policyInterfaces + " for " + binding + " and policy " + getPolicyClass()); - - return policyInterfaces; - } - finally - { - lock.writeLock().unlock(); - } - } - - /** - * Clear entries in the cache based on binding changes. - * - * @param cacheDescription description of cache to clear - * @param cache the cache to clear - * @param binding the binding - */ - private void clearCache(String cacheDescription, Map cache, B binding) - { - if (binding == null) - { - LockHelper.tryLock(lock.writeLock(), 100); - try - { - // A specific binding has not been provided, so clear all entries - cache.clear(); - - if (logger.isDebugEnabled() && cache.isEmpty() == false) - logger.debug("Cleared " + cacheDescription + " cache (all class bindings) for policy " + getPolicyClass()); - } - finally - { - lock.writeLock().unlock(); - } - } - else - { - // A specific binding has been provided. Build a list of entries - // that require removal. An entry is removed if the binding in the - // list is equal or derived from the changed binding. - Collection invalidBindings = new ArrayList(); - for (B cachedBinding : cache.keySet()) - { - // Determine if binding is equal or derived from changed binding - BehaviourBinding generalisedBinding = cachedBinding; - while(generalisedBinding != null) - { - if (generalisedBinding.equals(binding)) - { - invalidBindings.add(cachedBinding); - break; - } - generalisedBinding = generalisedBinding.generaliseBinding(); - } - } - - // Remove all invalid bindings - if (invalidBindings.size() > 0) - { - LockHelper.tryLock(lock.writeLock(), 100); - try - { - for (B invalidBinding : invalidBindings) - { - cache.remove(invalidBinding); - - if (logger.isDebugEnabled()) - logger.debug("Cleared " + cacheDescription + " cache for " + invalidBinding + " and policy " + getPolicyClass()); - } - } - finally - { - lock.writeLock().unlock(); - } - } - } - } -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.util.LockHelper; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + + +/** + * Policy Factory with caching support. + * + * @author David Caruana + * + * @param the type of Binding + * @param

the type of Policy + */ +/*package*/ @AlfrescoPublicApi class CachedPolicyFactory extends PolicyFactory +{ + // Logger + private static final Log logger = LogFactory.getLog(PolicyComponentImpl.class); + + // Behaviour Filter + private BehaviourFilter behaviourFilter = null; + + // Cache Lock + private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); + + /** + * Cache for a single Policy interface (keyed by Binding) + */ + private Map singleCache = new HashMap(); + + /** + * Cache for a collection of Policy interfaces (keyed by Binding) + */ + private Map> listCache = new HashMap>(); + + + /** + * Construct cached policy factory + * + * @param policyClass the policy interface class + * @param index the behaviour index to search on + */ + /*package*/ CachedPolicyFactory(Class

policyClass, BehaviourIndex index) + { + super(policyClass, index); + behaviourFilter = index.getFilter(); + + // Register this cached policy factory as a change observer of the behaviour index + // to allow for cache to be cleared appropriately. + index.addChangeObserver(new BehaviourChangeObserver() + { + public void addition(B binding, Behaviour behaviour) + { + clearCache("aggregate delegate", singleCache, binding); + clearCache("delegate collection", listCache, binding); + } + }); + } + + + @Override + public P create(B binding) + { + // When behaviour filters are activated bypass the cache + if (behaviourFilter != null && behaviourFilter.isActivated()) + { + return super.create(binding); + } + + LockHelper.tryLock(lock.readLock(), 100); + try + { + P policyInterface = singleCache.get(binding); + if (policyInterface != null) + { + return policyInterface; + } + } + finally + { + lock.readLock().unlock(); + } + + // There wasn't one + LockHelper.tryLock(lock.writeLock(), 100); + try + { + P policyInterface = singleCache.get(binding); + if (policyInterface != null) + { + return policyInterface; + } + policyInterface = super.create(binding); + singleCache.put(binding, policyInterface); + + if (logger.isDebugEnabled()) + logger.debug("Cached delegate interface " + policyInterface + " for " + binding + " and policy " + getPolicyClass()); + + return policyInterface; + } + finally + { + lock.writeLock().unlock(); + } + } + + + @Override + public Collection

createList(B binding) + { + // When behaviour filters are activated bypass the cache + if (behaviourFilter != null && behaviourFilter.isActivated()) + { + return super.createList(binding); + } + + LockHelper.tryLock(lock.readLock(), 100); + try + { + Collection

policyInterfaces = listCache.get(binding); + if (policyInterfaces != null) + { + return policyInterfaces; + } + } + finally + { + lock.readLock().unlock(); + } + + // There wasn't one + LockHelper.tryLock(lock.writeLock(), 100); + try + { + Collection

policyInterfaces = listCache.get(binding); + if (policyInterfaces != null) + { + return policyInterfaces; + } + policyInterfaces = super.createList(binding); + listCache.put(binding, policyInterfaces); + + if (logger.isDebugEnabled()) + logger.debug("Cached delegate interface collection " + policyInterfaces + " for " + binding + " and policy " + getPolicyClass()); + + return policyInterfaces; + } + finally + { + lock.writeLock().unlock(); + } + } + + /** + * Clear entries in the cache based on binding changes. + * + * @param cacheDescription description of cache to clear + * @param cache the cache to clear + * @param binding the binding + */ + private void clearCache(String cacheDescription, Map cache, B binding) + { + if (binding == null) + { + LockHelper.tryLock(lock.writeLock(), 100); + try + { + // A specific binding has not been provided, so clear all entries + cache.clear(); + + if (logger.isDebugEnabled() && cache.isEmpty() == false) + logger.debug("Cleared " + cacheDescription + " cache (all class bindings) for policy " + getPolicyClass()); + } + finally + { + lock.writeLock().unlock(); + } + } + else + { + // A specific binding has been provided. Build a list of entries + // that require removal. An entry is removed if the binding in the + // list is equal or derived from the changed binding. + Collection invalidBindings = new ArrayList(); + for (B cachedBinding : cache.keySet()) + { + // Determine if binding is equal or derived from changed binding + BehaviourBinding generalisedBinding = cachedBinding; + while(generalisedBinding != null) + { + if (generalisedBinding.equals(binding)) + { + invalidBindings.add(cachedBinding); + break; + } + generalisedBinding = generalisedBinding.generaliseBinding(); + } + } + + // Remove all invalid bindings + if (invalidBindings.size() > 0) + { + LockHelper.tryLock(lock.writeLock(), 100); + try + { + for (B invalidBinding : invalidBindings) + { + cache.remove(invalidBinding); + + if (logger.isDebugEnabled()) + logger.debug("Cleared " + cacheDescription + " cache for " + invalidBinding + " and policy " + getPolicyClass()); + } + } + finally + { + lock.writeLock().unlock(); + } + } + } + } +} diff --git a/source/java/org/alfresco/repo/policy/ClassBehaviourBinding.java b/source/java/org/alfresco/repo/policy/ClassBehaviourBinding.java index 42bba462d7..f7bbc60313 100644 --- a/source/java/org/alfresco/repo/policy/ClassBehaviourBinding.java +++ b/source/java/org/alfresco/repo/policy/ClassBehaviourBinding.java @@ -1,138 +1,140 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - -import org.alfresco.service.cmr.dictionary.ClassDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - - -/** - * Behaviour binding to a Class (Type or Aspect) in the Content Model. - * - * @author David Caruana - * - */ -public class ClassBehaviourBinding implements BehaviourBinding -{ - // The dictionary service - private DictionaryService dictionary; - - // The class qualified name - private QName classQName; - - // Instance level node reference - private NodeRef nodeRef; - - - /** - * Construct. - * - * @param dictionary the dictionary service - * @param nodeRef the instance level node reference - * @param classQName the Class qualified name - */ - /*package*/ ClassBehaviourBinding(DictionaryService dictionary, NodeRef nodeRef, QName classQName) - { - this.dictionary = dictionary; - this.nodeRef = nodeRef; - this.classQName = classQName; - } - - /** - * Construct. - * - * @param dictionary the dictionary service - * @param classQName the Class qualified name - */ - /*package*/ ClassBehaviourBinding(DictionaryService dictionary, QName classQName) - { - this(dictionary, null, classQName); - } - - /*package*/ DictionaryService getDictionary() - { - return dictionary; - } - - /* (non-Javadoc) - * @see org.alfresco.repo.policy.BehaviourBinding#generaliseBinding() - */ - public BehaviourBinding generaliseBinding() - { - BehaviourBinding generalisedBinding = null; - ClassDefinition classDefinition = dictionary.getClass(classQName); - if (classDefinition == null) - { - // The class definition doesn't exist so there can be no behaviour bound - return null; - } - - QName parentClassName = classDefinition.getParentName(); - if (parentClassName != null) - { - generalisedBinding = new ClassBehaviourBinding(dictionary, parentClassName); - } - return generalisedBinding; - } - - /** - * Gets the instance level node reference - * - * @return the node reference - */ - public NodeRef getNodeRef() - { - return nodeRef; - } - - /** - * Gets the class qualified name - * - * @return the class qualified name - */ - public QName getClassQName() - { - return classQName; - } - - @Override - public boolean equals(Object obj) - { - if (obj == null || !(obj instanceof ClassBehaviourBinding)) - { - return false; - } - return classQName.equals(((ClassBehaviourBinding)obj).classQName); - } - - @Override - public int hashCode() - { - return classQName.hashCode(); - } - - @Override - public String toString() - { - return "ClassBinding[class=" + classQName + "]"; - } - -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.dictionary.ClassDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + + +/** + * Behaviour binding to a Class (Type or Aspect) in the Content Model. + * + * @author David Caruana + * + */ +@AlfrescoPublicApi +public class ClassBehaviourBinding implements BehaviourBinding +{ + // The dictionary service + private DictionaryService dictionary; + + // The class qualified name + private QName classQName; + + // Instance level node reference + private NodeRef nodeRef; + + + /** + * Construct. + * + * @param dictionary the dictionary service + * @param nodeRef the instance level node reference + * @param classQName the Class qualified name + */ + /*package*/ ClassBehaviourBinding(DictionaryService dictionary, NodeRef nodeRef, QName classQName) + { + this.dictionary = dictionary; + this.nodeRef = nodeRef; + this.classQName = classQName; + } + + /** + * Construct. + * + * @param dictionary the dictionary service + * @param classQName the Class qualified name + */ + /*package*/ ClassBehaviourBinding(DictionaryService dictionary, QName classQName) + { + this(dictionary, null, classQName); + } + + /*package*/ DictionaryService getDictionary() + { + return dictionary; + } + + /* (non-Javadoc) + * @see org.alfresco.repo.policy.BehaviourBinding#generaliseBinding() + */ + public BehaviourBinding generaliseBinding() + { + BehaviourBinding generalisedBinding = null; + ClassDefinition classDefinition = dictionary.getClass(classQName); + if (classDefinition == null) + { + // The class definition doesn't exist so there can be no behaviour bound + return null; + } + + QName parentClassName = classDefinition.getParentName(); + if (parentClassName != null) + { + generalisedBinding = new ClassBehaviourBinding(dictionary, parentClassName); + } + return generalisedBinding; + } + + /** + * Gets the instance level node reference + * + * @return the node reference + */ + public NodeRef getNodeRef() + { + return nodeRef; + } + + /** + * Gets the class qualified name + * + * @return the class qualified name + */ + public QName getClassQName() + { + return classQName; + } + + @Override + public boolean equals(Object obj) + { + if (obj == null || !(obj instanceof ClassBehaviourBinding)) + { + return false; + } + return classQName.equals(((ClassBehaviourBinding)obj).classQName); + } + + @Override + public int hashCode() + { + return classQName.hashCode(); + } + + @Override + public String toString() + { + return "ClassBinding[class=" + classQName + "]"; + } + +} diff --git a/source/java/org/alfresco/repo/policy/ClassFeatureBehaviourBinding.java b/source/java/org/alfresco/repo/policy/ClassFeatureBehaviourBinding.java index 5a8746c4f8..62e66c8f1a 100644 --- a/source/java/org/alfresco/repo/policy/ClassFeatureBehaviourBinding.java +++ b/source/java/org/alfresco/repo/policy/ClassFeatureBehaviourBinding.java @@ -1,165 +1,166 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - -import org.alfresco.service.cmr.dictionary.ClassDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - - -/** - * Behaviour binding to a Class (Type or Aspect) in the Content Model. - * - * @author David Caruana - * - */ -/*package*/ class ClassFeatureBehaviourBinding extends ClassBehaviourBinding -{ - // The feature qualified name (property or association) - private QName featureQName; - private QName activeFeatureQName; - - // Wild Card feature match (match all features) - private static final QName ALL_FEATURES = QName.createQName("", "*"); - - - /** - * Construct. - * - * @param dictionary the dictionary service - * @param nodeRef the node reference - * @param classQName the Class qualified name - * @param featureQName the Class feature (property or association) qualifed name - */ - /*package*/ ClassFeatureBehaviourBinding(DictionaryService dictionary, NodeRef nodeRef, QName classQName, QName featureQName) - { - this(dictionary, nodeRef, classQName, featureQName, featureQName); - } - - - /** - * Construct. - * - * @param dictionary the dictionary service - * @param classQName the Class qualified name - * @param featureQName the Class feature (property or association) qualifed name - */ - /*package*/ ClassFeatureBehaviourBinding(DictionaryService dictionary, QName classQName, QName featureQName) - { - this(dictionary, null, classQName, featureQName, featureQName); - } - - - /** - * Construct. - * - * @param dictionary the dictionary service - * @param nodeRef the node reference - * @param classQName the Class qualified name - */ - /*package*/ ClassFeatureBehaviourBinding(DictionaryService dictionary, NodeRef nodeRef, QName classQName) - { - this(dictionary, nodeRef, classQName, ALL_FEATURES); - } - - - /** - * Construct. - * - * @param dictionary the dictionary service - * @param classQName the Class qualified name - */ - /*package*/ ClassFeatureBehaviourBinding(DictionaryService dictionary, QName classQName) - { - this(dictionary, null, classQName, ALL_FEATURES); - } - - - /** - * Construct. - * - * @param dictionary the dictionary service - * @param nodeRef the node reference - * @param classQName the Class qualified name - * @param featureQName the Class feature (property or association) qualifed name - * @param activeFeatureQName the currently active feature QName - */ - private ClassFeatureBehaviourBinding(DictionaryService dictionary, NodeRef nodeRef, QName classQName, QName featureQName, QName activeFeatureQName) - { - super(dictionary, nodeRef, classQName); - this.featureQName = featureQName; - this.activeFeatureQName = activeFeatureQName; - } - - - /* (non-Javadoc) - * @see org.alfresco.repo.policy.BehaviourBinding#generaliseBinding() - */ - public BehaviourBinding generaliseBinding() - { - BehaviourBinding generalisedBinding = null; - ClassDefinition classDefinition = getDictionary().getClass(getClassQName()); - - if (classDefinition == null) - { - // The class definition doesn't exist so there can be no behaviour bound - return null; - } - - if (activeFeatureQName.equals(ALL_FEATURES)) - { - QName parentClassName = classDefinition.getParentName(); - if (parentClassName != null) - { - generalisedBinding = new ClassFeatureBehaviourBinding(getDictionary(), getNodeRef(), parentClassName, featureQName, featureQName); - } - } - else - { - generalisedBinding = new ClassFeatureBehaviourBinding(getDictionary(), getNodeRef(), getClassQName(), featureQName, ALL_FEATURES); - } - - return generalisedBinding; - } - - @Override - public boolean equals(Object obj) - { - if (obj == null || !(obj instanceof ClassFeatureBehaviourBinding)) - { - return false; - } - return getClassQName().equals(((ClassFeatureBehaviourBinding)obj).getClassQName()) && - activeFeatureQName.equals(((ClassFeatureBehaviourBinding)obj).activeFeatureQName); - } - - @Override - public int hashCode() - { - return 37 * getClassQName().hashCode() + activeFeatureQName.hashCode(); - } - - @Override - public String toString() - { - return "ClassFeatureBinding[class=" + getClassQName() + ";feature=" + activeFeatureQName + "]"; - } - -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.dictionary.ClassDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + + +/** + * Behaviour binding to a Class (Type or Aspect) in the Content Model. + * + * @author David Caruana + * + */ +/*package*/ @AlfrescoPublicApi class ClassFeatureBehaviourBinding extends ClassBehaviourBinding +{ + // The feature qualified name (property or association) + private QName featureQName; + private QName activeFeatureQName; + + // Wild Card feature match (match all features) + private static final QName ALL_FEATURES = QName.createQName("", "*"); + + + /** + * Construct. + * + * @param dictionary the dictionary service + * @param nodeRef the node reference + * @param classQName the Class qualified name + * @param featureQName the Class feature (property or association) qualifed name + */ + /*package*/ ClassFeatureBehaviourBinding(DictionaryService dictionary, NodeRef nodeRef, QName classQName, QName featureQName) + { + this(dictionary, nodeRef, classQName, featureQName, featureQName); + } + + + /** + * Construct. + * + * @param dictionary the dictionary service + * @param classQName the Class qualified name + * @param featureQName the Class feature (property or association) qualifed name + */ + /*package*/ ClassFeatureBehaviourBinding(DictionaryService dictionary, QName classQName, QName featureQName) + { + this(dictionary, null, classQName, featureQName, featureQName); + } + + + /** + * Construct. + * + * @param dictionary the dictionary service + * @param nodeRef the node reference + * @param classQName the Class qualified name + */ + /*package*/ ClassFeatureBehaviourBinding(DictionaryService dictionary, NodeRef nodeRef, QName classQName) + { + this(dictionary, nodeRef, classQName, ALL_FEATURES); + } + + + /** + * Construct. + * + * @param dictionary the dictionary service + * @param classQName the Class qualified name + */ + /*package*/ ClassFeatureBehaviourBinding(DictionaryService dictionary, QName classQName) + { + this(dictionary, null, classQName, ALL_FEATURES); + } + + + /** + * Construct. + * + * @param dictionary the dictionary service + * @param nodeRef the node reference + * @param classQName the Class qualified name + * @param featureQName the Class feature (property or association) qualifed name + * @param activeFeatureQName the currently active feature QName + */ + private ClassFeatureBehaviourBinding(DictionaryService dictionary, NodeRef nodeRef, QName classQName, QName featureQName, QName activeFeatureQName) + { + super(dictionary, nodeRef, classQName); + this.featureQName = featureQName; + this.activeFeatureQName = activeFeatureQName; + } + + + /* (non-Javadoc) + * @see org.alfresco.repo.policy.BehaviourBinding#generaliseBinding() + */ + public BehaviourBinding generaliseBinding() + { + BehaviourBinding generalisedBinding = null; + ClassDefinition classDefinition = getDictionary().getClass(getClassQName()); + + if (classDefinition == null) + { + // The class definition doesn't exist so there can be no behaviour bound + return null; + } + + if (activeFeatureQName.equals(ALL_FEATURES)) + { + QName parentClassName = classDefinition.getParentName(); + if (parentClassName != null) + { + generalisedBinding = new ClassFeatureBehaviourBinding(getDictionary(), getNodeRef(), parentClassName, featureQName, featureQName); + } + } + else + { + generalisedBinding = new ClassFeatureBehaviourBinding(getDictionary(), getNodeRef(), getClassQName(), featureQName, ALL_FEATURES); + } + + return generalisedBinding; + } + + @Override + public boolean equals(Object obj) + { + if (obj == null || !(obj instanceof ClassFeatureBehaviourBinding)) + { + return false; + } + return getClassQName().equals(((ClassFeatureBehaviourBinding)obj).getClassQName()) && + activeFeatureQName.equals(((ClassFeatureBehaviourBinding)obj).activeFeatureQName); + } + + @Override + public int hashCode() + { + return 37 * getClassQName().hashCode() + activeFeatureQName.hashCode(); + } + + @Override + public String toString() + { + return "ClassFeatureBinding[class=" + getClassQName() + ";feature=" + activeFeatureQName + "]"; + } + +} diff --git a/source/java/org/alfresco/repo/policy/ClassPolicy.java b/source/java/org/alfresco/repo/policy/ClassPolicy.java index b7b6526825..23cc1da9bc 100644 --- a/source/java/org/alfresco/repo/policy/ClassPolicy.java +++ b/source/java/org/alfresco/repo/policy/ClassPolicy.java @@ -1,29 +1,32 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - -/** - * Marker interface for representing an Class-level Policy. - * - * @author David Caruana - * - */ -public interface ClassPolicy extends Policy -{ -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Marker interface for representing an Class-level Policy. + * + * @author David Caruana + * + */ +@AlfrescoPublicApi +public interface ClassPolicy extends Policy +{ +} diff --git a/source/java/org/alfresco/repo/policy/ClassPolicyDelegate.java b/source/java/org/alfresco/repo/policy/ClassPolicyDelegate.java index 94a8d62c7f..26dc6fadf2 100644 --- a/source/java/org/alfresco/repo/policy/ClassPolicyDelegate.java +++ b/source/java/org/alfresco/repo/policy/ClassPolicyDelegate.java @@ -1,188 +1,190 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.service.cmr.dictionary.ClassDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Delegate for a Class-level Policy. Provides access to Policy Interface - * implementations which invoke the appropriate bound behaviours. - * - * @author David Caruana - * - * @param

the policy interface - */ -public class ClassPolicyDelegate

-{ - private DictionaryService dictionary; - private CachedPolicyFactory factory; - - - /** - * Construct. - * - * @param dictionary the dictionary service - * @param policyClass the policy interface class - * @param index the behaviour index to query against - */ - @SuppressWarnings("unchecked") - /*package*/ ClassPolicyDelegate(DictionaryService dictionary, Class

policyClass, BehaviourIndex index) - { - // Get list of all pre-registered behaviours for the policy and - // ensure they are valid. - Collection definitions = index.getAll(); - for (BehaviourDefinition definition : definitions) - { - definition.getBehaviour().getInterface(policyClass); - } - - // Rely on cached implementation of policy factory - // Note: Could also use PolicyFactory (without caching) - this.factory = new CachedPolicyFactory(policyClass, index); - this.dictionary = dictionary; - } - - - /** - * Gets the Policy implementation for the specified Class - * - * When multiple behaviours are bound to the policy for the class, an - * aggregate policy implementation is returned which invokes each policy - * in turn. - * - * @param classQName the class qualified name - * @return the policy - */ - public P get(QName classQName) - { - return get(null, classQName); - } - - /** - * Gets the Policy implementation for the specified Class - * - * @param nodeRef the node reference - * @param classQName the class name - * @return the policy - */ - public P get(NodeRef nodeRef, QName classQName) - { - ClassDefinition classDefinition = dictionary.getClass(classQName); - if (classDefinition == null) - { - throw new IllegalArgumentException("Class " + classQName + " has not been defined in the data dictionary"); - } - return factory.create(new ClassBehaviourBinding(dictionary, nodeRef, classQName)); - } - - /** - * Gets the collection of Policy implementations for the specified Class - * - * @param classQName the class qualified name - * @return the collection of policies - */ - public Collection

getList(QName classQName) - { - return getList(null, classQName); - } - - /** - * Gets the collection of Policy implementations for the specified Class - * - * @param nodeRef the node reference - * @param classQName the class qualified name - * @return the collection of policies - */ - public Collection

getList(NodeRef nodeRef, QName classQName) - { - ClassDefinition classDefinition = dictionary.getClass(classQName); - if (classDefinition == null) - { - throw new IllegalArgumentException("Class " + classQName + " has not been defined in the data dictionary"); - } - return factory.createList(new ClassBehaviourBinding(dictionary, nodeRef, classQName)); - } - - /** - * Gets the policy implementation for the given classes. The single Policy - * will be a wrapper of multiple appropriate policies. - * - * @param classQNames the class qualified names - * @return Returns the policy - */ - public P get(Set classQNames) - { - return get(null, classQNames); - } - - /** - * Gets the policy implementation for the given classes. The single Policy - * will be a wrapper of multiple appropriate policies. - * - * @param nodeRef the node reference - * @param classQNames the class qualified names - * @return Returns the policy - */ - public P get(NodeRef nodeRef, Set classQNames) - { - return factory.toPolicy(getList(nodeRef, classQNames)); - } - - /** - * Gets the collection of Policy implementations for the given classes - * - * @param classQNames the class qualified names - * @return Returns the collection of policies - */ - public Collection

getList(Set classQNames) - { - return getList(null, classQNames); - } - - /** - * Gets the collection of Policy implementations for the given classes - * - * @param classQNames the class qualified names - * @return Returns the collection of policies - */ - public Collection

getList(NodeRef nodeRef, Set classQNames) - { - Collection

policies = new HashSet

(); - for (QName classQName : classQNames) - { - P policy = factory.create(new ClassBehaviourBinding(dictionary, nodeRef, classQName)); - if (policy instanceof PolicyList) - { - policies.addAll(((PolicyList

)policy).getPolicies()); - } - else - { - policies.add(policy); - } - } - return policies; - } -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.dictionary.ClassDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Delegate for a Class-level Policy. Provides access to Policy Interface + * implementations which invoke the appropriate bound behaviours. + * + * @author David Caruana + * + * @param

the policy interface + */ +@AlfrescoPublicApi +public class ClassPolicyDelegate

+{ + private DictionaryService dictionary; + private CachedPolicyFactory factory; + + + /** + * Construct. + * + * @param dictionary the dictionary service + * @param policyClass the policy interface class + * @param index the behaviour index to query against + */ + @SuppressWarnings("unchecked") + /*package*/ ClassPolicyDelegate(DictionaryService dictionary, Class

policyClass, BehaviourIndex index) + { + // Get list of all pre-registered behaviours for the policy and + // ensure they are valid. + Collection definitions = index.getAll(); + for (BehaviourDefinition definition : definitions) + { + definition.getBehaviour().getInterface(policyClass); + } + + // Rely on cached implementation of policy factory + // Note: Could also use PolicyFactory (without caching) + this.factory = new CachedPolicyFactory(policyClass, index); + this.dictionary = dictionary; + } + + + /** + * Gets the Policy implementation for the specified Class + * + * When multiple behaviours are bound to the policy for the class, an + * aggregate policy implementation is returned which invokes each policy + * in turn. + * + * @param classQName the class qualified name + * @return the policy + */ + public P get(QName classQName) + { + return get(null, classQName); + } + + /** + * Gets the Policy implementation for the specified Class + * + * @param nodeRef the node reference + * @param classQName the class name + * @return the policy + */ + public P get(NodeRef nodeRef, QName classQName) + { + ClassDefinition classDefinition = dictionary.getClass(classQName); + if (classDefinition == null) + { + throw new IllegalArgumentException("Class " + classQName + " has not been defined in the data dictionary"); + } + return factory.create(new ClassBehaviourBinding(dictionary, nodeRef, classQName)); + } + + /** + * Gets the collection of Policy implementations for the specified Class + * + * @param classQName the class qualified name + * @return the collection of policies + */ + public Collection

getList(QName classQName) + { + return getList(null, classQName); + } + + /** + * Gets the collection of Policy implementations for the specified Class + * + * @param nodeRef the node reference + * @param classQName the class qualified name + * @return the collection of policies + */ + public Collection

getList(NodeRef nodeRef, QName classQName) + { + ClassDefinition classDefinition = dictionary.getClass(classQName); + if (classDefinition == null) + { + throw new IllegalArgumentException("Class " + classQName + " has not been defined in the data dictionary"); + } + return factory.createList(new ClassBehaviourBinding(dictionary, nodeRef, classQName)); + } + + /** + * Gets the policy implementation for the given classes. The single Policy + * will be a wrapper of multiple appropriate policies. + * + * @param classQNames the class qualified names + * @return Returns the policy + */ + public P get(Set classQNames) + { + return get(null, classQNames); + } + + /** + * Gets the policy implementation for the given classes. The single Policy + * will be a wrapper of multiple appropriate policies. + * + * @param nodeRef the node reference + * @param classQNames the class qualified names + * @return Returns the policy + */ + public P get(NodeRef nodeRef, Set classQNames) + { + return factory.toPolicy(getList(nodeRef, classQNames)); + } + + /** + * Gets the collection of Policy implementations for the given classes + * + * @param classQNames the class qualified names + * @return Returns the collection of policies + */ + public Collection

getList(Set classQNames) + { + return getList(null, classQNames); + } + + /** + * Gets the collection of Policy implementations for the given classes + * + * @param classQNames the class qualified names + * @return Returns the collection of policies + */ + public Collection

getList(NodeRef nodeRef, Set classQNames) + { + Collection

policies = new HashSet

(); + for (QName classQName : classQNames) + { + P policy = factory.create(new ClassBehaviourBinding(dictionary, nodeRef, classQName)); + if (policy instanceof PolicyList) + { + policies.addAll(((PolicyList

)policy).getPolicies()); + } + else + { + policies.add(policy); + } + } + return policies; + } +} diff --git a/source/java/org/alfresco/repo/policy/JavaBehaviour.java b/source/java/org/alfresco/repo/policy/JavaBehaviour.java index 7e2a482d11..5072a3b353 100644 --- a/source/java/org/alfresco/repo/policy/JavaBehaviour.java +++ b/source/java/org/alfresco/repo/policy/JavaBehaviour.java @@ -1,215 +1,216 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; - -import org.springframework.extensions.surf.util.ParameterCheck; - - -/** - * Java based Behaviour. - * - * A behavior acts like a delegate (a method pointer). The pointer is - * represented by an instance object and method name. - * - * @author David Caruana - * - */ -public class JavaBehaviour extends BaseBehaviour -{ - // The object instance holding the method - Object instance; - - // The method name - String method; - - /** - * Construct. - * - * @param instance the object instance holding the method - * @param method the method name - */ - public JavaBehaviour(Object instance, String method) - { - this(instance, method, NotificationFrequency.EVERY_EVENT); - } - - /** - * Construct. - * - * @param instance the object instance holding the method - * @param method the method name - */ - public JavaBehaviour(Object instance, String method, NotificationFrequency frequency) - { - super(frequency); - ParameterCheck.mandatory("Instance", instance); - ParameterCheck.mandatory("Method", method); - this.method = method; - this.instance = instance; - } - - - @Override - public String toString() - { - return "Java method[class=" + instance.getClass().getName() + ", method=" + method + "]"; - } - - @SuppressWarnings("unchecked") - public synchronized T getInterface(Class policy) - { - ParameterCheck.mandatory("Policy class", policy); - Object proxy = proxies.get(policy); - if (proxy == null) - { - InvocationHandler handler = getInvocationHandler(instance, method, policy); - proxy = Proxy.newProxyInstance(policy.getClassLoader(), new Class[]{policy}, handler); - proxies.put(policy, proxy); - } - return (T)proxy; - } - - /** - * Gets the Invocation Handler. - * - * @param the policy interface class - * @param instance the object instance - * @param method the method name - * @param policyIF the policy interface class - * @return the invocation handler - */ - InvocationHandler getInvocationHandler(Object instance, String method, Class policyIF) - { - Method[] policyIFMethods = policyIF.getMethods(); - if (policyIFMethods.length != 1) - { - throw new PolicyException("Policy interface " + policyIF.getCanonicalName() + " must have only one method"); - } - - try - { - Class instanceClass = instance.getClass(); - Method delegateMethod = instanceClass.getMethod(method, (Class[])policyIFMethods[0].getParameterTypes()); - return new JavaMethodInvocationHandler(this, delegateMethod); - } - catch (NoSuchMethodException e) - { - throw new PolicyException("Method " + method + " not found or accessible on " + instance.getClass(), e); - } - } - - /** - * Java Method Invocation Handler - * - * @author David Caruana - */ - private static class JavaMethodInvocationHandler implements InvocationHandler - { - private JavaBehaviour behaviour; - private Method delegateMethod; - - /** - * Constuct. - * - * @param instance the object instance holding the method - * @param delegateMethod the method to invoke - */ - private JavaMethodInvocationHandler(JavaBehaviour behaviour, Method delegateMethod) - { - this.behaviour = behaviour; - this.delegateMethod = delegateMethod; - } - - /* (non-Javadoc) - * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) - */ - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable - { - // Handle Object level methods - if (method.getName().equals("toString")) - { - return toString(); - } - else if (method.getName().equals("hashCode")) - { - return hashCode(); - } - else if (method.getName().equals("equals")) - { - if (Proxy.isProxyClass(args[0].getClass())) - { - return equals(Proxy.getInvocationHandler(args[0])); - } - return false; - } - - // Delegate to designated method pointer - if (behaviour.isEnabled()) - { - try - { - behaviour.disable(); - return delegateMethod.invoke(behaviour.instance, args); - } - catch (InvocationTargetException e) - { - throw e.getTargetException(); - } - finally - { - behaviour.enable(); - } - } - return null; - } - - @Override - public boolean equals(Object obj) - { - if (obj == this) - { - return true; - } - else if (obj == null || !(obj instanceof JavaMethodInvocationHandler)) - { - return false; - } - JavaMethodInvocationHandler other = (JavaMethodInvocationHandler)obj; - return behaviour.instance.equals(other.behaviour.instance) && delegateMethod.equals(other.delegateMethod); - } - - @Override - public int hashCode() - { - return 37 * behaviour.instance.hashCode() + delegateMethod.hashCode(); - } - - @Override - public String toString() - { - return "JavaBehaviour[instance=" + behaviour.instance.hashCode() + ", method=" + delegateMethod.toString() + "]"; - } - } - -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; + +import org.alfresco.api.AlfrescoPublicApi; +import org.springframework.extensions.surf.util.ParameterCheck; + +/** + * Java based Behaviour. + * + * A behavior acts like a delegate (a method pointer). The pointer is + * represented by an instance object and method name. + * + * @author David Caruana + * + */ +@AlfrescoPublicApi +public class JavaBehaviour extends BaseBehaviour +{ + // The object instance holding the method + Object instance; + + // The method name + String method; + + /** + * Construct. + * + * @param instance the object instance holding the method + * @param method the method name + */ + public JavaBehaviour(Object instance, String method) + { + this(instance, method, NotificationFrequency.EVERY_EVENT); + } + + /** + * Construct. + * + * @param instance the object instance holding the method + * @param method the method name + */ + public JavaBehaviour(Object instance, String method, NotificationFrequency frequency) + { + super(frequency); + ParameterCheck.mandatory("Instance", instance); + ParameterCheck.mandatory("Method", method); + this.method = method; + this.instance = instance; + } + + + @Override + public String toString() + { + return "Java method[class=" + instance.getClass().getName() + ", method=" + method + "]"; + } + + @SuppressWarnings("unchecked") + public synchronized T getInterface(Class policy) + { + ParameterCheck.mandatory("Policy class", policy); + Object proxy = proxies.get(policy); + if (proxy == null) + { + InvocationHandler handler = getInvocationHandler(instance, method, policy); + proxy = Proxy.newProxyInstance(policy.getClassLoader(), new Class[]{policy}, handler); + proxies.put(policy, proxy); + } + return (T)proxy; + } + + /** + * Gets the Invocation Handler. + * + * @param the policy interface class + * @param instance the object instance + * @param method the method name + * @param policyIF the policy interface class + * @return the invocation handler + */ + InvocationHandler getInvocationHandler(Object instance, String method, Class policyIF) + { + Method[] policyIFMethods = policyIF.getMethods(); + if (policyIFMethods.length != 1) + { + throw new PolicyException("Policy interface " + policyIF.getCanonicalName() + " must have only one method"); + } + + try + { + Class instanceClass = instance.getClass(); + Method delegateMethod = instanceClass.getMethod(method, (Class[])policyIFMethods[0].getParameterTypes()); + return new JavaMethodInvocationHandler(this, delegateMethod); + } + catch (NoSuchMethodException e) + { + throw new PolicyException("Method " + method + " not found or accessible on " + instance.getClass(), e); + } + } + + /** + * Java Method Invocation Handler + * + * @author David Caruana + */ + private static class JavaMethodInvocationHandler implements InvocationHandler + { + private JavaBehaviour behaviour; + private Method delegateMethod; + + /** + * Constuct. + * + * @param instance the object instance holding the method + * @param delegateMethod the method to invoke + */ + private JavaMethodInvocationHandler(JavaBehaviour behaviour, Method delegateMethod) + { + this.behaviour = behaviour; + this.delegateMethod = delegateMethod; + } + + /* (non-Javadoc) + * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) + */ + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable + { + // Handle Object level methods + if (method.getName().equals("toString")) + { + return toString(); + } + else if (method.getName().equals("hashCode")) + { + return hashCode(); + } + else if (method.getName().equals("equals")) + { + if (Proxy.isProxyClass(args[0].getClass())) + { + return equals(Proxy.getInvocationHandler(args[0])); + } + return false; + } + + // Delegate to designated method pointer + if (behaviour.isEnabled()) + { + try + { + behaviour.disable(); + return delegateMethod.invoke(behaviour.instance, args); + } + catch (InvocationTargetException e) + { + throw e.getTargetException(); + } + finally + { + behaviour.enable(); + } + } + return null; + } + + @Override + public boolean equals(Object obj) + { + if (obj == this) + { + return true; + } + else if (obj == null || !(obj instanceof JavaMethodInvocationHandler)) + { + return false; + } + JavaMethodInvocationHandler other = (JavaMethodInvocationHandler)obj; + return behaviour.instance.equals(other.behaviour.instance) && delegateMethod.equals(other.delegateMethod); + } + + @Override + public int hashCode() + { + return 37 * behaviour.instance.hashCode() + delegateMethod.hashCode(); + } + + @Override + public String toString() + { + return "JavaBehaviour[instance=" + behaviour.instance.hashCode() + ", method=" + delegateMethod.toString() + "]"; + } + } + +} diff --git a/source/java/org/alfresco/repo/policy/Policy.java b/source/java/org/alfresco/repo/policy/Policy.java index c32c4761ec..18181e5c35 100644 --- a/source/java/org/alfresco/repo/policy/Policy.java +++ b/source/java/org/alfresco/repo/policy/Policy.java @@ -1,46 +1,48 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - -import org.alfresco.service.namespace.NamespaceService; - -/** - * Marker interface for representing a Policy. - * - * @author David Caruana - */ -public interface Policy -{ - /** - * mandatory static field on a Policy that can be overridden in - * derived policies - */ - static String NAMESPACE = NamespaceService.ALFRESCO_URI; - - /** - * Argument Configuration - */ - public enum Arg - { - KEY, - START_VALUE, - END_VALUE - } - -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.namespace.NamespaceService; + +/** + * Marker interface for representing a Policy. + * + * @author David Caruana + */ +@AlfrescoPublicApi +public interface Policy +{ + /** + * mandatory static field on a Policy that can be overridden in + * derived policies + */ + static String NAMESPACE = NamespaceService.ALFRESCO_URI; + + /** + * Argument Configuration + */ + public enum Arg + { + KEY, + START_VALUE, + END_VALUE + } + +} diff --git a/source/java/org/alfresco/repo/policy/PolicyComponent.java b/source/java/org/alfresco/repo/policy/PolicyComponent.java index 5cbe8c3486..23b618a4d8 100644 --- a/source/java/org/alfresco/repo/policy/PolicyComponent.java +++ b/source/java/org/alfresco/repo/policy/PolicyComponent.java @@ -1,218 +1,220 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - -import java.util.Collection; - -import org.alfresco.service.namespace.QName; - - -/** - * Policy Component for managing Policies and Behaviours. - *

- * This component provides the ability to: - *

- *

    - *
  • a) Register policies
  • - *
  • b) Bind behaviours to policies
  • - *
  • c) Invoke policy behaviours
  • - *
- *

- * A behaviour may be bound to a Policy before the Policy is registered. In - * this case, the behaviour is not validated (i.e. checked to determine if it - * supports the policy interface) until the Policy is registered. Otherwise, - * the behaviour is validated at bind-time. - * - * Policies may be selectively "turned off" by the Behaviour Filter. - * - * - * - * @see org.alfresco.repo.policy.BehaviourFilter - * - * @see org.alfresco.repo.node.NodeServicePolicies - * - * - * @author David Caruana - * - */ -public interface PolicyComponent -{ - /** - * Register a Class-level Policy - * - * @param

the policy interface - * @param policy the policy interface class - * @return A delegate for the class-level policy (typed by the policy interface) - */ - public

ClassPolicyDelegate

registerClassPolicy(Class

policy); - - /** - * Register a Property-level Policy - * - * @param

the policy interface - * @param policy the policy interface class - * @return A delegate for the property-level policy (typed by the policy interface) - */ - public

PropertyPolicyDelegate

registerPropertyPolicy(Class

policy); - - /** - * Register a Association-level Policy - * - * @param

the policy interface - * @param policy the policy interface class - * @return A delegate for the association-level policy (typed by the policy interface) - */ - public

AssociationPolicyDelegate

registerAssociationPolicy(Class

policy); - - /** - * Gets all registered Policies - * - * @return the collection of registered policy definitions - */ - public Collection getRegisteredPolicies(); - - /** - * Gets the specified registered Policy - * - * @param policyType the policy type - * @param policy the policy name - * @return the policy definition (or null, if it has not been registered) - */ - public PolicyDefinition getRegisteredPolicy(PolicyType policyType, QName policy); - - /** - * Determine if the specified policy has been registered - * - * @param policyType the policy type - * @param policy the fully qualified name of the policy - * @return true => registered, false => not yet - */ - public boolean isRegisteredPolicy(PolicyType policyType, QName policy); - - /** - * Bind a Class specific behaviour to a Class-level Policy. - *

- * So when the named policy, happens on the specified aspect or type, - * the specified behaviour is executed. - *

- * Example of calling this method - *

-     *         this.policyComponent.bindClassBehaviour(
-     *           NodeServicePolicies.BeforeUpdateNodePolicy.QNAME,
-     *           ContentModel.ASPECT_LOCKABLE,
-     *           new JavaBehaviour(this, "beforeUpdateNode"));
-     * 
- * @param policy the fully qualified policy name - * @param className the qualified name of a type or aspect that the policy is bound to - * @param behaviour the behaviour. What gets executed by the policy - * @return the registered behaviour definition - */ - public BehaviourDefinition bindClassBehaviour(QName policy, QName className, Behaviour behaviour); - - /** - * Bind a Service behaviour to a Class-level Policy - * - * @param policy the fully qualified policy name - * @param service the service (any object, in fact) - * @param behaviour the behaviour. What gets executed by the policy - * @return the registered behaviour definition - */ - public BehaviourDefinition bindClassBehaviour(QName policy, Object service, Behaviour behaviour); - - /** - * Bind a Property specific behaviour to a Property-level Policy - * - * @param policy the fully qualified policy name - * @param className the qualified name of the class (type or aspect) to bind against - * @param propertyName the name of the property to bind against - * @param behaviour the behaviour. What gets executed by the policy - * @return the registered behaviour definition - */ - public BehaviourDefinition bindPropertyBehaviour(QName policy, QName className, QName propertyName, Behaviour behaviour); - - /** - * Bind a Property specific behaviour to a Property-level Policy (for all properties of a Class) - * - * @param policy the fully qualified policy name - * @param className the name of the class (type or aspect) to bind against - * @param behaviour the behaviour, what gets executed by the policy - * @return the registered behaviour definition - */ - public BehaviourDefinition bindPropertyBehaviour(QName policy, QName className, Behaviour behaviour); - - /** - * Bind a Service specific behaviour to a Property-level Policy - * - * @param policy the fully qualified policy name - * @param service the binding service - * @param behaviour the behaviour - * @return the registered behaviour definition - */ - public BehaviourDefinition bindPropertyBehaviour(QName policy, Object service, Behaviour behaviour); - - /** - * Bind an Association specific behaviour to an Association-level Policy - *

- * For example, before a rule folder association is created. - *

-     *         policyComponent.bindAssociationBehaviour(
-     *           NodeServicePolicies.OnCreateChildAssociationPolicy.QNAME,
-     *           RuleModel.ASPECT_RULES,
-     *           RuleModel.ASSOC_RULE_FOLDER,
-     *           new JavaBehaviour(this, "OnCreateChildAssociation"));
-     * 
- * - * @param policy the policy name - * @param className the name of the class (type or aspect) to bind against - * @param assocName the name of the association to bind against - * @param behaviour the behaviour. What gets executed by the policy - * @return the registered behaviour definition - */ - public BehaviourDefinition bindAssociationBehaviour(QName policy, QName className, QName assocName, Behaviour behaviour); - - /** - * Bind an Association specific behaviour to an Association-level Policy (for all associations of a Class) - * - * @param policy the policy name - * @param className the name of the class (type or aspect) to bind against - * @param behaviour the behaviour. What gets executed by the policy - * @return the registered behaviour definition - */ - public BehaviourDefinition bindAssociationBehaviour(QName policy, QName className, Behaviour behaviour); - - /** - * Bind a Service specific behaviour to an Association-level Policy - * - * @param policy the policy name - * @param service the binding service - * @param behaviour the behaviour. What gets executed by the policy - * @return the registered behaviour definition - */ - public BehaviourDefinition bindAssociationBehaviour(QName policy, Object service, Behaviour behaviour); - - /** - * Unbind behaviour - * - * @param definition - */ - public void removeClassDefinition(BehaviourDefinition definition); - -} - - +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import java.util.Collection; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.namespace.QName; + + +/** + * Policy Component for managing Policies and Behaviours. + *

+ * This component provides the ability to: + *

+ *

    + *
  • a) Register policies
  • + *
  • b) Bind behaviours to policies
  • + *
  • c) Invoke policy behaviours
  • + *
+ *

+ * A behaviour may be bound to a Policy before the Policy is registered. In + * this case, the behaviour is not validated (i.e. checked to determine if it + * supports the policy interface) until the Policy is registered. Otherwise, + * the behaviour is validated at bind-time. + * + * Policies may be selectively "turned off" by the Behaviour Filter. + * + * + * + * @see org.alfresco.repo.policy.BehaviourFilter + * + * @see org.alfresco.repo.node.NodeServicePolicies + * + * + * @author David Caruana + * + */ +@AlfrescoPublicApi +public interface PolicyComponent +{ + /** + * Register a Class-level Policy + * + * @param

the policy interface + * @param policy the policy interface class + * @return A delegate for the class-level policy (typed by the policy interface) + */ + public

ClassPolicyDelegate

registerClassPolicy(Class

policy); + + /** + * Register a Property-level Policy + * + * @param

the policy interface + * @param policy the policy interface class + * @return A delegate for the property-level policy (typed by the policy interface) + */ + public

PropertyPolicyDelegate

registerPropertyPolicy(Class

policy); + + /** + * Register a Association-level Policy + * + * @param

the policy interface + * @param policy the policy interface class + * @return A delegate for the association-level policy (typed by the policy interface) + */ + public

AssociationPolicyDelegate

registerAssociationPolicy(Class

policy); + + /** + * Gets all registered Policies + * + * @return the collection of registered policy definitions + */ + public Collection getRegisteredPolicies(); + + /** + * Gets the specified registered Policy + * + * @param policyType the policy type + * @param policy the policy name + * @return the policy definition (or null, if it has not been registered) + */ + public PolicyDefinition getRegisteredPolicy(PolicyType policyType, QName policy); + + /** + * Determine if the specified policy has been registered + * + * @param policyType the policy type + * @param policy the fully qualified name of the policy + * @return true => registered, false => not yet + */ + public boolean isRegisteredPolicy(PolicyType policyType, QName policy); + + /** + * Bind a Class specific behaviour to a Class-level Policy. + *

+ * So when the named policy, happens on the specified aspect or type, + * the specified behaviour is executed. + *

+ * Example of calling this method + *

+     *         this.policyComponent.bindClassBehaviour(
+     *           NodeServicePolicies.BeforeUpdateNodePolicy.QNAME,
+     *           ContentModel.ASPECT_LOCKABLE,
+     *           new JavaBehaviour(this, "beforeUpdateNode"));
+     * 
+ * @param policy the fully qualified policy name + * @param className the qualified name of a type or aspect that the policy is bound to + * @param behaviour the behaviour. What gets executed by the policy + * @return the registered behaviour definition + */ + public BehaviourDefinition bindClassBehaviour(QName policy, QName className, Behaviour behaviour); + + /** + * Bind a Service behaviour to a Class-level Policy + * + * @param policy the fully qualified policy name + * @param service the service (any object, in fact) + * @param behaviour the behaviour. What gets executed by the policy + * @return the registered behaviour definition + */ + public BehaviourDefinition bindClassBehaviour(QName policy, Object service, Behaviour behaviour); + + /** + * Bind a Property specific behaviour to a Property-level Policy + * + * @param policy the fully qualified policy name + * @param className the qualified name of the class (type or aspect) to bind against + * @param propertyName the name of the property to bind against + * @param behaviour the behaviour. What gets executed by the policy + * @return the registered behaviour definition + */ + public BehaviourDefinition bindPropertyBehaviour(QName policy, QName className, QName propertyName, Behaviour behaviour); + + /** + * Bind a Property specific behaviour to a Property-level Policy (for all properties of a Class) + * + * @param policy the fully qualified policy name + * @param className the name of the class (type or aspect) to bind against + * @param behaviour the behaviour, what gets executed by the policy + * @return the registered behaviour definition + */ + public BehaviourDefinition bindPropertyBehaviour(QName policy, QName className, Behaviour behaviour); + + /** + * Bind a Service specific behaviour to a Property-level Policy + * + * @param policy the fully qualified policy name + * @param service the binding service + * @param behaviour the behaviour + * @return the registered behaviour definition + */ + public BehaviourDefinition bindPropertyBehaviour(QName policy, Object service, Behaviour behaviour); + + /** + * Bind an Association specific behaviour to an Association-level Policy + *

+ * For example, before a rule folder association is created. + *

+     *         policyComponent.bindAssociationBehaviour(
+     *           NodeServicePolicies.OnCreateChildAssociationPolicy.QNAME,
+     *           RuleModel.ASPECT_RULES,
+     *           RuleModel.ASSOC_RULE_FOLDER,
+     *           new JavaBehaviour(this, "OnCreateChildAssociation"));
+     * 
+ * + * @param policy the policy name + * @param className the name of the class (type or aspect) to bind against + * @param assocName the name of the association to bind against + * @param behaviour the behaviour. What gets executed by the policy + * @return the registered behaviour definition + */ + public BehaviourDefinition bindAssociationBehaviour(QName policy, QName className, QName assocName, Behaviour behaviour); + + /** + * Bind an Association specific behaviour to an Association-level Policy (for all associations of a Class) + * + * @param policy the policy name + * @param className the name of the class (type or aspect) to bind against + * @param behaviour the behaviour. What gets executed by the policy + * @return the registered behaviour definition + */ + public BehaviourDefinition bindAssociationBehaviour(QName policy, QName className, Behaviour behaviour); + + /** + * Bind a Service specific behaviour to an Association-level Policy + * + * @param policy the policy name + * @param service the binding service + * @param behaviour the behaviour. What gets executed by the policy + * @return the registered behaviour definition + */ + public BehaviourDefinition bindAssociationBehaviour(QName policy, Object service, Behaviour behaviour); + + /** + * Unbind behaviour + * + * @param definition + */ + public void removeClassDefinition(BehaviourDefinition definition); + +} + + diff --git a/source/java/org/alfresco/repo/policy/PolicyDefinition.java b/source/java/org/alfresco/repo/policy/PolicyDefinition.java index 589e5c684f..dc691ab47f 100644 --- a/source/java/org/alfresco/repo/policy/PolicyDefinition.java +++ b/source/java/org/alfresco/repo/policy/PolicyDefinition.java @@ -1,71 +1,73 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - -import org.alfresco.repo.policy.Policy.Arg; -import org.alfresco.service.namespace.QName; - - -/** - * Definition of a Policy - * - * @author David Caruana - * - * @param

the policy interface - */ -public interface PolicyDefinition

-{ - /** - * Gets the name of the Policy - * - * @return policy name - */ - public QName getName(); - - - /** - * Gets the Policy interface class - * - * @return the class - */ - public Class

getPolicyInterface(); - - - /** - * Gets the Policy type - * - * @return the policy type - */ - public PolicyType getType(); - - /** - * Gets Policy Argument definition for the specified argument index - * - * @param index argument index - * @return ARG.KEY or ARG.START_VALUE or ARG.END_VALUE - */ - public Arg getArgument(int index); - - /** - * Gets Policy Argument definitions for all arguments in order of arguments - * @return - */ - public Arg[] getArguments(); - -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.repo.policy.Policy.Arg; +import org.alfresco.service.namespace.QName; + + +/** + * Definition of a Policy + * + * @author David Caruana + * + * @param

the policy interface + */ +@AlfrescoPublicApi +public interface PolicyDefinition

+{ + /** + * Gets the name of the Policy + * + * @return policy name + */ + public QName getName(); + + + /** + * Gets the Policy interface class + * + * @return the class + */ + public Class

getPolicyInterface(); + + + /** + * Gets the Policy type + * + * @return the policy type + */ + public PolicyType getType(); + + /** + * Gets Policy Argument definition for the specified argument index + * + * @param index argument index + * @return ARG.KEY or ARG.START_VALUE or ARG.END_VALUE + */ + public Arg getArgument(int index); + + /** + * Gets Policy Argument definitions for all arguments in order of arguments + * @return + */ + public Arg[] getArguments(); + +} diff --git a/source/java/org/alfresco/repo/policy/PolicyException.java b/source/java/org/alfresco/repo/policy/PolicyException.java index 5e97decd81..306c8062ae 100644 --- a/source/java/org/alfresco/repo/policy/PolicyException.java +++ b/source/java/org/alfresco/repo/policy/PolicyException.java @@ -1,41 +1,43 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - - -/** - * Base Policy Exception. - * - * @author David Caruana - */ -public class PolicyException extends RuntimeException -{ - private static final long serialVersionUID = 3761122726173290550L; - - - public PolicyException(String msg) - { - super(msg); - } - - public PolicyException(String msg, Throwable cause) - { - super(msg, cause); - } -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Base Policy Exception. + * + * @author David Caruana + */ +@AlfrescoPublicApi +public class PolicyException extends RuntimeException +{ + private static final long serialVersionUID = 3761122726173290550L; + + + public PolicyException(String msg) + { + super(msg); + } + + public PolicyException(String msg, Throwable cause) + { + super(msg, cause); + } +} diff --git a/source/java/org/alfresco/repo/policy/PolicyList.java b/source/java/org/alfresco/repo/policy/PolicyList.java index 95bfa0ac0c..65397b06db 100644 --- a/source/java/org/alfresco/repo/policy/PolicyList.java +++ b/source/java/org/alfresco/repo/policy/PolicyList.java @@ -1,32 +1,34 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - -import java.util.Collection; - -/** - * @author David Caruana - */ -/*package*/ interface PolicyList

-{ - /** - * @return the set of policies within this policy set - */ - public Collection

getPolicies(); -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import java.util.Collection; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * @author David Caruana + */ +/*package*/ @AlfrescoPublicApi interface PolicyList

+{ + /** + * @return the set of policies within this policy set + */ + public Collection

getPolicies(); +} diff --git a/source/java/org/alfresco/repo/policy/PolicyType.java b/source/java/org/alfresco/repo/policy/PolicyType.java index bdad02b4df..fccebaa70e 100644 --- a/source/java/org/alfresco/repo/policy/PolicyType.java +++ b/source/java/org/alfresco/repo/policy/PolicyType.java @@ -1,33 +1,35 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - - -/** - * Type of Policy. - * - * @author David Caruana - * - */ -public enum PolicyType -{ - Class, - Property, - Association -}; +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Type of Policy. + * + * @author David Caruana + * + */ +@AlfrescoPublicApi +public enum PolicyType +{ + Class, + Property, + Association +}; diff --git a/source/java/org/alfresco/repo/policy/PropertyPolicy.java b/source/java/org/alfresco/repo/policy/PropertyPolicy.java index c2416b22de..2f17aca234 100644 --- a/source/java/org/alfresco/repo/policy/PropertyPolicy.java +++ b/source/java/org/alfresco/repo/policy/PropertyPolicy.java @@ -1,28 +1,31 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - -/** - * Marker interface for representing a Property-level Policy. - * - * @author David Caruana - */ -public interface PropertyPolicy extends Policy -{ -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Marker interface for representing a Property-level Policy. + * + * @author David Caruana + */ +@AlfrescoPublicApi +public interface PropertyPolicy extends Policy +{ +} diff --git a/source/java/org/alfresco/repo/policy/PropertyPolicyDelegate.java b/source/java/org/alfresco/repo/policy/PropertyPolicyDelegate.java index ac882e133d..64cee2362b 100644 --- a/source/java/org/alfresco/repo/policy/PropertyPolicyDelegate.java +++ b/source/java/org/alfresco/repo/policy/PropertyPolicyDelegate.java @@ -1,210 +1,212 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - - -/** - * Delegate for a Class Feature-level (Property and Association) Policies. Provides - * access to Policy Interface implementations which invoke the appropriate bound behaviours. - * - * @author David Caruana - * - * @param

the policy interface - */ -public class PropertyPolicyDelegate

-{ - private DictionaryService dictionary; - private CachedPolicyFactory factory; - - - /** - * Construct. - * - * @param dictionary the dictionary service - * @param policyClass the policy interface class - * @param index the behaviour index to query against - */ - @SuppressWarnings("unchecked") - /*package*/ PropertyPolicyDelegate(DictionaryService dictionary, Class

policyClass, BehaviourIndex index) - { - // Get list of all pre-registered behaviours for the policy and - // ensure they are valid. - Collection definitions = index.getAll(); - for (BehaviourDefinition definition : definitions) - { - definition.getBehaviour().getInterface(policyClass); - } - - // Rely on cached implementation of policy factory - // Note: Could also use PolicyFactory (without caching) - this.factory = new CachedPolicyFactory(policyClass, index); - this.dictionary = dictionary; - } - - /** - * Ensures the validity of the given property type - * - * @param assocTypeQName - * @throws IllegalArgumentException - */ - private void checkPropertyType(QName propertyQName) throws IllegalArgumentException - { - PropertyDefinition propertyDef = dictionary.getProperty(propertyQName); - if (propertyDef == null) - { - throw new IllegalArgumentException("Property " + propertyQName + " has not been defined in the data dictionary"); - } - } - - - /** - * Gets the Policy implementation for the specified Class and Propery - * - * When multiple behaviours are bound to the policy for the class feature, an - * aggregate policy implementation is returned which invokes each policy - * in turn. - * - * @param classQName the class qualified name - * @param propertyQName the property qualified name - * @return the policy - */ - public P get(QName classQName, QName propertyQName) - { - return get(null, classQName, propertyQName); - } - - /** - * Gets the Policy implementation for the specified Class and Propery - * - * When multiple behaviours are bound to the policy for the class feature, an - * aggregate policy implementation is returned which invokes each policy - * in turn. - * - * @param nodeRef the node reference - * @param classQName the class qualified name - * @param propertyQName the property qualified name - * @return the policy - */ - public P get(NodeRef nodeRef, QName classQName, QName propertyQName) - { - checkPropertyType(propertyQName); - return factory.create(new ClassFeatureBehaviourBinding(dictionary, nodeRef, classQName, propertyQName)); - } - - /** - * Gets the collection of Policy implementations for the specified Class and Property - * - * @param classQName the class qualified name - * @param propertyQName the property qualified name - * @return the collection of policies - */ - public Collection

getList(QName classQName, QName propertyQName) - { - return getList(null, classQName, propertyQName); - } - - /** - * Gets the collection of Policy implementations for the specified Class and Property - * - * @param nodeRef the node reference - * @param classQName the class qualified name - * @param propertyQName the property qualified name - * @return the collection of policies - */ - public Collection

getList(NodeRef nodeRef, QName classQName, QName propertyQName) - { - checkPropertyType(propertyQName); - return factory.createList(new ClassFeatureBehaviourBinding(dictionary, nodeRef, classQName, propertyQName)); - } - - /** - * Gets a Policy for all the given Class and Property - * - * @param classQNames the class qualified names - * @param propertyQName the property qualified name - * @return Return the policy - */ - public P get(Set classQNames, QName propertyQName) - { - return get(null, classQNames, propertyQName); - } - - /** - * Gets a Policy for all the given Class and Property - * - * @param nodeRef the node reference - * @param classQNames the class qualified names - * @param propertyQName the property qualified name - * @return Return the policy - */ - public P get(NodeRef nodeRef, Set classQNames, QName propertyQName) - { - checkPropertyType(propertyQName); - return factory.toPolicy(getList(nodeRef, classQNames, propertyQName)); - } - - /** - * Gets the Policy instances for all the given Classes and Properties - * - * @param classQNames the class qualified names - * @param propertyQName the property qualified name - * @return Return the policies - */ - public Collection

getList(Set classQNames, QName propertyQName) - { - return getList(null, classQNames, propertyQName); - } - - /** - * Gets the Policy instances for all the given Classes and Properties - * - * @param nodeRef the node reference - * @param classQNames the class qualified names - * @param propertyQName the property qualified name - * @return Return the policies - */ - public Collection

getList(NodeRef nodeRef, Set classQNames, QName propertyQName) - { - checkPropertyType(propertyQName); - Collection

policies = new HashSet

(); - for (QName classQName : classQNames) - { - P policy = factory.create(new ClassFeatureBehaviourBinding(dictionary, nodeRef, classQName, propertyQName)); - if (policy instanceof PolicyList) - { - policies.addAll(((PolicyList

)policy).getPolicies()); - } - else - { - policies.add(policy); - } - } - return policies; - } - -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + + +/** + * Delegate for a Class Feature-level (Property and Association) Policies. Provides + * access to Policy Interface implementations which invoke the appropriate bound behaviours. + * + * @author David Caruana + * + * @param

the policy interface + */ +@AlfrescoPublicApi +public class PropertyPolicyDelegate

+{ + private DictionaryService dictionary; + private CachedPolicyFactory factory; + + + /** + * Construct. + * + * @param dictionary the dictionary service + * @param policyClass the policy interface class + * @param index the behaviour index to query against + */ + @SuppressWarnings("unchecked") + /*package*/ PropertyPolicyDelegate(DictionaryService dictionary, Class

policyClass, BehaviourIndex index) + { + // Get list of all pre-registered behaviours for the policy and + // ensure they are valid. + Collection definitions = index.getAll(); + for (BehaviourDefinition definition : definitions) + { + definition.getBehaviour().getInterface(policyClass); + } + + // Rely on cached implementation of policy factory + // Note: Could also use PolicyFactory (without caching) + this.factory = new CachedPolicyFactory(policyClass, index); + this.dictionary = dictionary; + } + + /** + * Ensures the validity of the given property type + * + * @param assocTypeQName + * @throws IllegalArgumentException + */ + private void checkPropertyType(QName propertyQName) throws IllegalArgumentException + { + PropertyDefinition propertyDef = dictionary.getProperty(propertyQName); + if (propertyDef == null) + { + throw new IllegalArgumentException("Property " + propertyQName + " has not been defined in the data dictionary"); + } + } + + + /** + * Gets the Policy implementation for the specified Class and Propery + * + * When multiple behaviours are bound to the policy for the class feature, an + * aggregate policy implementation is returned which invokes each policy + * in turn. + * + * @param classQName the class qualified name + * @param propertyQName the property qualified name + * @return the policy + */ + public P get(QName classQName, QName propertyQName) + { + return get(null, classQName, propertyQName); + } + + /** + * Gets the Policy implementation for the specified Class and Propery + * + * When multiple behaviours are bound to the policy for the class feature, an + * aggregate policy implementation is returned which invokes each policy + * in turn. + * + * @param nodeRef the node reference + * @param classQName the class qualified name + * @param propertyQName the property qualified name + * @return the policy + */ + public P get(NodeRef nodeRef, QName classQName, QName propertyQName) + { + checkPropertyType(propertyQName); + return factory.create(new ClassFeatureBehaviourBinding(dictionary, nodeRef, classQName, propertyQName)); + } + + /** + * Gets the collection of Policy implementations for the specified Class and Property + * + * @param classQName the class qualified name + * @param propertyQName the property qualified name + * @return the collection of policies + */ + public Collection

getList(QName classQName, QName propertyQName) + { + return getList(null, classQName, propertyQName); + } + + /** + * Gets the collection of Policy implementations for the specified Class and Property + * + * @param nodeRef the node reference + * @param classQName the class qualified name + * @param propertyQName the property qualified name + * @return the collection of policies + */ + public Collection

getList(NodeRef nodeRef, QName classQName, QName propertyQName) + { + checkPropertyType(propertyQName); + return factory.createList(new ClassFeatureBehaviourBinding(dictionary, nodeRef, classQName, propertyQName)); + } + + /** + * Gets a Policy for all the given Class and Property + * + * @param classQNames the class qualified names + * @param propertyQName the property qualified name + * @return Return the policy + */ + public P get(Set classQNames, QName propertyQName) + { + return get(null, classQNames, propertyQName); + } + + /** + * Gets a Policy for all the given Class and Property + * + * @param nodeRef the node reference + * @param classQNames the class qualified names + * @param propertyQName the property qualified name + * @return Return the policy + */ + public P get(NodeRef nodeRef, Set classQNames, QName propertyQName) + { + checkPropertyType(propertyQName); + return factory.toPolicy(getList(nodeRef, classQNames, propertyQName)); + } + + /** + * Gets the Policy instances for all the given Classes and Properties + * + * @param classQNames the class qualified names + * @param propertyQName the property qualified name + * @return Return the policies + */ + public Collection

getList(Set classQNames, QName propertyQName) + { + return getList(null, classQNames, propertyQName); + } + + /** + * Gets the Policy instances for all the given Classes and Properties + * + * @param nodeRef the node reference + * @param classQNames the class qualified names + * @param propertyQName the property qualified name + * @return Return the policies + */ + public Collection

getList(NodeRef nodeRef, Set classQNames, QName propertyQName) + { + checkPropertyType(propertyQName); + Collection

policies = new HashSet

(); + for (QName classQName : classQNames) + { + P policy = factory.create(new ClassFeatureBehaviourBinding(dictionary, nodeRef, classQName, propertyQName)); + if (policy instanceof PolicyList) + { + policies.addAll(((PolicyList

)policy).getPolicies()); + } + else + { + policies.add(policy); + } + } + return policies; + } + +} diff --git a/source/java/org/alfresco/repo/policy/ServiceBehaviourBinding.java b/source/java/org/alfresco/repo/policy/ServiceBehaviourBinding.java index 18f7b0e536..d1aafc745d 100644 --- a/source/java/org/alfresco/repo/policy/ServiceBehaviourBinding.java +++ b/source/java/org/alfresco/repo/policy/ServiceBehaviourBinding.java @@ -1,83 +1,85 @@ -/* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.repo.policy; - - -/** - * Behaviour binding to a Service. - * - * @author David Caruana - * - */ -public class ServiceBehaviourBinding implements BehaviourBinding -{ - // The service - private Object service; - - /** - * Construct - * - * @param service the service - */ - /*package*/ ServiceBehaviourBinding(Object service) - { - this.service = service; - } - - /* (non-Javadoc) - * @see org.alfresco.repo.policy.BehaviourBinding#generaliseBinding() - */ - public BehaviourBinding generaliseBinding() - { - return null; - } - - /** - * Gets the Service - * - * @return the service - */ - public Object getService() - { - return service; - } - - @Override - public boolean equals(Object obj) - { - if (obj == null || !(obj instanceof ServiceBehaviourBinding)) - { - return false; - } - return service.equals(((ServiceBehaviourBinding)obj).service); - } - - @Override - public int hashCode() - { - return service.hashCode(); - } - - @Override - public String toString() - { - return "ServiceBinding[service=" + service + "]"; - } - -} +/* + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * Behaviour binding to a Service. + * + * @author David Caruana + * + */ +@AlfrescoPublicApi +public class ServiceBehaviourBinding implements BehaviourBinding +{ + // The service + private Object service; + + /** + * Construct + * + * @param service the service + */ + /*package*/ ServiceBehaviourBinding(Object service) + { + this.service = service; + } + + /* (non-Javadoc) + * @see org.alfresco.repo.policy.BehaviourBinding#generaliseBinding() + */ + public BehaviourBinding generaliseBinding() + { + return null; + } + + /** + * Gets the Service + * + * @return the service + */ + public Object getService() + { + return service; + } + + @Override + public boolean equals(Object obj) + { + if (obj == null || !(obj instanceof ServiceBehaviourBinding)) + { + return false; + } + return service.equals(((ServiceBehaviourBinding)obj).service); + } + + @Override + public int hashCode() + { + return service.hashCode(); + } + + @Override + public String toString() + { + return "ServiceBinding[service=" + service + "]"; + } + +} diff --git a/source/java/org/alfresco/repo/site/SiteModel.java b/source/java/org/alfresco/repo/site/SiteModel.java index 226c2d0921..639f1a09a5 100644 --- a/source/java/org/alfresco/repo/site/SiteModel.java +++ b/source/java/org/alfresco/repo/site/SiteModel.java @@ -22,6 +22,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.namespace.QName; /** @@ -29,6 +30,7 @@ import org.alfresco.service.namespace.QName; * * @author Roy Wetherall */ +@AlfrescoPublicApi public interface SiteModel { /** Site Model */ @@ -61,4 +63,4 @@ public interface SiteModel Collections.unmodifiableList( Arrays.asList( new String[] {SITE_MANAGER, SITE_COLLABORATOR, SITE_CONTRIBUTOR, SITE_CONSUMER} )); -} \ No newline at end of file +} diff --git a/source/java/org/alfresco/repo/transaction/DoNotRetryException.java b/source/java/org/alfresco/repo/transaction/DoNotRetryException.java index 428a568a21..be737501d4 100644 --- a/source/java/org/alfresco/repo/transaction/DoNotRetryException.java +++ b/source/java/org/alfresco/repo/transaction/DoNotRetryException.java @@ -18,6 +18,8 @@ */ package org.alfresco.repo.transaction; +import org.alfresco.api.AlfrescoPublicApi; + /** * Marker interface for the exceptions that should not trigger retries, regardless of * the contained causal exceptions. @@ -25,6 +27,7 @@ package org.alfresco.repo.transaction; * @author Derek Hulley * @since 3.4.6 */ +@AlfrescoPublicApi public interface DoNotRetryException { } diff --git a/source/java/org/alfresco/repo/transaction/RetryingTransactionHelper.java b/source/java/org/alfresco/repo/transaction/RetryingTransactionHelper.java index 667d5d7208..a1893932e4 100644 --- a/source/java/org/alfresco/repo/transaction/RetryingTransactionHelper.java +++ b/source/java/org/alfresco/repo/transaction/RetryingTransactionHelper.java @@ -34,6 +34,7 @@ import javax.transaction.RollbackException; import javax.transaction.Status; import javax.transaction.UserTransaction; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.ExceptionStackUtil; import org.alfresco.repo.security.permissions.AccessDeniedException; @@ -78,6 +79,7 @@ import org.springframework.jdbc.UncategorizedSQLException; * * @author Derek Hulley */ +@AlfrescoPublicApi public class RetryingTransactionHelper { private static final String MSG_READ_ONLY = "permissions.err_read_only"; @@ -207,6 +209,7 @@ public class RetryingTransactionHelper * Callback interface * @author Derek Hulley */ + @AlfrescoPublicApi public interface RetryingTransactionCallback { /** diff --git a/source/java/org/alfresco/repo/transaction/TooBusyException.java b/source/java/org/alfresco/repo/transaction/TooBusyException.java index f444081c41..88d46d7476 100644 --- a/source/java/org/alfresco/repo/transaction/TooBusyException.java +++ b/source/java/org/alfresco/repo/transaction/TooBusyException.java @@ -18,6 +18,7 @@ */ package org.alfresco.repo.transaction; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.error.AlfrescoRuntimeException; /** @@ -26,6 +27,7 @@ import org.alfresco.error.AlfrescoRuntimeException; * * @author dward */ +@AlfrescoPublicApi public class TooBusyException extends AlfrescoRuntimeException { private static final long serialVersionUID = 1L; diff --git a/source/java/org/alfresco/service/ServiceRegistry.java b/source/java/org/alfresco/service/ServiceRegistry.java index a7760958c5..331234f356 100644 --- a/source/java/org/alfresco/service/ServiceRegistry.java +++ b/source/java/org/alfresco/service/ServiceRegistry.java @@ -20,6 +20,7 @@ package org.alfresco.service; import java.util.Collection; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.cmis.CMISDictionaryService; import org.alfresco.cmis.CMISQueryService; import org.alfresco.cmis.CMISServices; @@ -92,6 +93,7 @@ import org.alfresco.wcm.webproject.WebProjectService; * * @author David Caruana */ +@AlfrescoPublicApi public interface ServiceRegistry { // Service Bean Names diff --git a/source/java/org/alfresco/service/cmr/action/Action.java b/source/java/org/alfresco/service/cmr/action/Action.java index 8e12006058..1b9f0dfa2a 100644 --- a/source/java/org/alfresco/service/cmr/action/Action.java +++ b/source/java/org/alfresco/service/cmr/action/Action.java @@ -23,6 +23,7 @@ import java.util.Date; import java.util.List; import java.util.Map; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.cmr.repository.NodeRef; @@ -31,6 +32,7 @@ import org.alfresco.service.cmr.repository.NodeRef; * * @author Roy Wetherall */ +@AlfrescoPublicApi public interface Action extends ParameterizedItem { /** diff --git a/source/java/org/alfresco/service/cmr/action/ActionCondition.java b/source/java/org/alfresco/service/cmr/action/ActionCondition.java index ed6a6be7ea..a42231c4f1 100644 --- a/source/java/org/alfresco/service/cmr/action/ActionCondition.java +++ b/source/java/org/alfresco/service/cmr/action/ActionCondition.java @@ -18,12 +18,14 @@ */ package org.alfresco.service.cmr.action; +import org.alfresco.api.AlfrescoPublicApi; /** * Rule condition interface * * @author Roy Wetherall */ +@AlfrescoPublicApi public interface ActionCondition extends ParameterizedItem { /** diff --git a/source/java/org/alfresco/service/cmr/action/ActionConditionDefinition.java b/source/java/org/alfresco/service/cmr/action/ActionConditionDefinition.java index 0d256ef91d..71e87e992d 100644 --- a/source/java/org/alfresco/service/cmr/action/ActionConditionDefinition.java +++ b/source/java/org/alfresco/service/cmr/action/ActionConditionDefinition.java @@ -18,13 +18,14 @@ */ package org.alfresco.service.cmr.action; - +import org.alfresco.api.AlfrescoPublicApi; /** * Rule condition interface * * @author Roy Wetherall */ +@AlfrescoPublicApi public interface ActionConditionDefinition extends ParameterizedItemDefinition { diff --git a/source/java/org/alfresco/service/cmr/action/ActionDefinition.java b/source/java/org/alfresco/service/cmr/action/ActionDefinition.java index d417085754..192ae7aacc 100644 --- a/source/java/org/alfresco/service/cmr/action/ActionDefinition.java +++ b/source/java/org/alfresco/service/cmr/action/ActionDefinition.java @@ -20,6 +20,7 @@ package org.alfresco.service.cmr.action; import java.util.Set; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.namespace.QName; /** @@ -27,6 +28,7 @@ import org.alfresco.service.namespace.QName; * * @author Roy Wetherall */ +@AlfrescoPublicApi public interface ActionDefinition extends ParameterizedItemDefinition { /** diff --git a/source/java/org/alfresco/service/cmr/action/ActionList.java b/source/java/org/alfresco/service/cmr/action/ActionList.java index bfe45dc623..9f657752bb 100644 --- a/source/java/org/alfresco/service/cmr/action/ActionList.java +++ b/source/java/org/alfresco/service/cmr/action/ActionList.java @@ -22,9 +22,12 @@ package org.alfresco.service.cmr.action; import java.io.Serializable; import java.util.List; +import org.alfresco.api.AlfrescoPublicApi; + /** * @author Nick Smith */ +@AlfrescoPublicApi public interface ActionList extends Serializable { /** diff --git a/source/java/org/alfresco/service/cmr/action/ActionService.java b/source/java/org/alfresco/service/cmr/action/ActionService.java index dd68586664..c8cfa5a51b 100644 --- a/source/java/org/alfresco/service/cmr/action/ActionService.java +++ b/source/java/org/alfresco/service/cmr/action/ActionService.java @@ -22,6 +22,7 @@ import java.io.Serializable; import java.util.List; import java.util.Map; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.Auditable; import org.alfresco.service.PublicService; import org.alfresco.service.cmr.repository.NodeRef; @@ -31,6 +32,7 @@ import org.alfresco.service.cmr.repository.NodeRef; * * @author Roy Wetherall */ +@AlfrescoPublicApi public interface ActionService { /** diff --git a/source/java/org/alfresco/service/cmr/action/ActionStatus.java b/source/java/org/alfresco/service/cmr/action/ActionStatus.java index 20a47a275d..c3af452fa5 100644 --- a/source/java/org/alfresco/service/cmr/action/ActionStatus.java +++ b/source/java/org/alfresco/service/cmr/action/ActionStatus.java @@ -20,13 +20,14 @@ package org.alfresco.service.cmr.action; import java.io.Serializable; - +import org.alfresco.api.AlfrescoPublicApi; /** * The various states an Action can be in. * * @author Nick Burch */ +@AlfrescoPublicApi public enum ActionStatus { /** diff --git a/source/java/org/alfresco/service/cmr/action/CompositeAction.java b/source/java/org/alfresco/service/cmr/action/CompositeAction.java index 1f9a6eee8a..c865a5dd34 100644 --- a/source/java/org/alfresco/service/cmr/action/CompositeAction.java +++ b/source/java/org/alfresco/service/cmr/action/CompositeAction.java @@ -19,11 +19,14 @@ package org.alfresco.service.cmr.action; +import org.alfresco.api.AlfrescoPublicApi; + /** * Composite action * * @author Roy Wetherall */ +@AlfrescoPublicApi public interface CompositeAction extends Action, ActionList { diff --git a/source/java/org/alfresco/service/cmr/action/CompositeActionCondition.java b/source/java/org/alfresco/service/cmr/action/CompositeActionCondition.java index 1ce66c8f18..685454fc4c 100644 --- a/source/java/org/alfresco/service/cmr/action/CompositeActionCondition.java +++ b/source/java/org/alfresco/service/cmr/action/CompositeActionCondition.java @@ -20,11 +20,14 @@ package org.alfresco.service.cmr.action; import java.util.List; +import org.alfresco.api.AlfrescoPublicApi; + /** * Composite action condition * * @author Jean Barmash */ +@AlfrescoPublicApi public interface CompositeActionCondition extends ActionCondition { diff --git a/source/java/org/alfresco/service/cmr/action/ParameterConstraint.java b/source/java/org/alfresco/service/cmr/action/ParameterConstraint.java index e47e150152..93c421d58e 100644 --- a/source/java/org/alfresco/service/cmr/action/ParameterConstraint.java +++ b/source/java/org/alfresco/service/cmr/action/ParameterConstraint.java @@ -22,11 +22,14 @@ package org.alfresco.service.cmr.action; import java.io.Serializable; import java.util.Map; +import org.alfresco.api.AlfrescoPublicApi; + /** * Parameter constraint. Helps to constraint the list of allowable values for a * * @author Roy Wetherall */ +@AlfrescoPublicApi public interface ParameterConstraint { /** diff --git a/source/java/org/alfresco/service/cmr/action/ParameterDefinition.java b/source/java/org/alfresco/service/cmr/action/ParameterDefinition.java index 3bbf018948..98acaae47a 100644 --- a/source/java/org/alfresco/service/cmr/action/ParameterDefinition.java +++ b/source/java/org/alfresco/service/cmr/action/ParameterDefinition.java @@ -18,6 +18,7 @@ */ package org.alfresco.service.cmr.action; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.namespace.QName; /** @@ -25,6 +26,7 @@ import org.alfresco.service.namespace.QName; * * @author Roy Wetherall */ +@AlfrescoPublicApi public interface ParameterDefinition { /** diff --git a/source/java/org/alfresco/service/cmr/action/ParameterizedItem.java b/source/java/org/alfresco/service/cmr/action/ParameterizedItem.java index a67828485d..a9f7c201c2 100644 --- a/source/java/org/alfresco/service/cmr/action/ParameterizedItem.java +++ b/source/java/org/alfresco/service/cmr/action/ParameterizedItem.java @@ -21,11 +21,14 @@ package org.alfresco.service.cmr.action; import java.io.Serializable; import java.util.Map; +import org.alfresco.api.AlfrescoPublicApi; + /** * Rule item interface * * @author Roy Wetherall */ +@AlfrescoPublicApi public interface ParameterizedItem { /** diff --git a/source/java/org/alfresco/service/cmr/action/ParameterizedItemDefinition.java b/source/java/org/alfresco/service/cmr/action/ParameterizedItemDefinition.java index 680ec0e0fa..d5e5ef5a8a 100644 --- a/source/java/org/alfresco/service/cmr/action/ParameterizedItemDefinition.java +++ b/source/java/org/alfresco/service/cmr/action/ParameterizedItemDefinition.java @@ -20,6 +20,9 @@ package org.alfresco.service.cmr.action; import java.util.List; +import org.alfresco.api.AlfrescoPublicApi; + +@AlfrescoPublicApi public interface ParameterizedItemDefinition { /** diff --git a/source/java/org/alfresco/service/cmr/attributes/AttributeService.java b/source/java/org/alfresco/service/cmr/attributes/AttributeService.java index 325d251019..55693ff0eb 100644 --- a/source/java/org/alfresco/service/cmr/attributes/AttributeService.java +++ b/source/java/org/alfresco/service/cmr/attributes/AttributeService.java @@ -20,6 +20,7 @@ package org.alfresco.service.cmr.attributes; import java.io.Serializable; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; /** @@ -35,6 +36,7 @@ import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; * @author Derek Hulley * @since 3.4 */ +@AlfrescoPublicApi public interface AttributeService { /** diff --git a/source/java/org/alfresco/service/cmr/coci/CheckOutCheckInService.java b/source/java/org/alfresco/service/cmr/coci/CheckOutCheckInService.java index d56e81638e..726a87266c 100644 --- a/source/java/org/alfresco/service/cmr/coci/CheckOutCheckInService.java +++ b/source/java/org/alfresco/service/cmr/coci/CheckOutCheckInService.java @@ -21,6 +21,7 @@ package org.alfresco.service.cmr.coci; import java.io.Serializable; import java.util.Map; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; @@ -31,6 +32,7 @@ import org.alfresco.service.namespace.QName; * * @author Roy Wetherall */ +@AlfrescoPublicApi public interface CheckOutCheckInService { /** diff --git a/source/java/org/alfresco/service/cmr/lock/LockService.java b/source/java/org/alfresco/service/cmr/lock/LockService.java index 261c27177a..997dc5f07c 100644 --- a/source/java/org/alfresco/service/cmr/lock/LockService.java +++ b/source/java/org/alfresco/service/cmr/lock/LockService.java @@ -21,6 +21,7 @@ package org.alfresco.service.cmr.lock; import java.util.Collection; import java.util.List; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.repo.lock.mem.Lifetime; import org.alfresco.repo.lock.mem.LockState; import org.alfresco.service.Auditable; @@ -33,6 +34,7 @@ import org.alfresco.service.cmr.repository.StoreRef; * * @author Roy Wetherall */ +@AlfrescoPublicApi public interface LockService { /** diff --git a/source/java/org/alfresco/service/cmr/lock/LockStatus.java b/source/java/org/alfresco/service/cmr/lock/LockStatus.java index 6bf213b322..6aef9e4ad5 100644 --- a/source/java/org/alfresco/service/cmr/lock/LockStatus.java +++ b/source/java/org/alfresco/service/cmr/lock/LockStatus.java @@ -18,6 +18,8 @@ */ package org.alfresco.service.cmr.lock; +import org.alfresco.api.AlfrescoPublicApi; + /** * Used to indicate lock status. * @@ -30,6 +32,7 @@ package org.alfresco.service.cmr.lock; * * @author Roy Wetherall */ +@AlfrescoPublicApi public enum LockStatus { /** diff --git a/source/java/org/alfresco/service/cmr/lock/LockType.java b/source/java/org/alfresco/service/cmr/lock/LockType.java index 34307f3682..19861f824b 100644 --- a/source/java/org/alfresco/service/cmr/lock/LockType.java +++ b/source/java/org/alfresco/service/cmr/lock/LockType.java @@ -18,11 +18,14 @@ */ package org.alfresco.service.cmr.lock; +import org.alfresco.api.AlfrescoPublicApi; + /** * The type of lock to be used by the lock service *

* The lock owner or the administrator can release the lock. */ +@AlfrescoPublicApi public enum LockType { /** diff --git a/source/java/org/alfresco/service/cmr/model/FileExistsException.java b/source/java/org/alfresco/service/cmr/model/FileExistsException.java index 318d43a65f..6916dd76e9 100644 --- a/source/java/org/alfresco/service/cmr/model/FileExistsException.java +++ b/source/java/org/alfresco/service/cmr/model/FileExistsException.java @@ -18,6 +18,7 @@ */ package org.alfresco.service.cmr.model; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.cmr.repository.NodeRef; /** @@ -26,6 +27,7 @@ import org.alfresco.service.cmr.repository.NodeRef; * * @author Derek Hulley */ +@AlfrescoPublicApi public class FileExistsException extends RuntimeException { private static final long serialVersionUID = -4133713912784624118L; diff --git a/source/java/org/alfresco/service/cmr/model/FileFolderService.java b/source/java/org/alfresco/service/cmr/model/FileFolderService.java index 6471de98b0..01dc8af41e 100644 --- a/source/java/org/alfresco/service/cmr/model/FileFolderService.java +++ b/source/java/org/alfresco/service/cmr/model/FileFolderService.java @@ -21,6 +21,7 @@ package org.alfresco.service.cmr.model; import java.util.List; import java.util.Set; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.query.PagingRequest; import org.alfresco.query.PagingResults; import org.alfresco.service.Auditable; @@ -41,6 +42,7 @@ import org.springframework.extensions.surf.util.I18NUtil; * * @author Derek Hulley */ +@AlfrescoPublicApi public interface FileFolderService { /** diff --git a/source/java/org/alfresco/service/cmr/model/FileFolderServiceType.java b/source/java/org/alfresco/service/cmr/model/FileFolderServiceType.java index c096df3b10..7f49c5f5d7 100644 --- a/source/java/org/alfresco/service/cmr/model/FileFolderServiceType.java +++ b/source/java/org/alfresco/service/cmr/model/FileFolderServiceType.java @@ -18,12 +18,15 @@ */ package org.alfresco.service.cmr.model; +import org.alfresco.api.AlfrescoPublicApi; + /** * The type for a file folder * * @author andyh * */ +@AlfrescoPublicApi public enum FileFolderServiceType { FILE, FOLDER, SYSTEM_FOLDER, INVALID; diff --git a/source/java/org/alfresco/service/cmr/model/FileInfo.java b/source/java/org/alfresco/service/cmr/model/FileInfo.java index 2330ab7da5..2bf3fbfa8c 100644 --- a/source/java/org/alfresco/service/cmr/model/FileInfo.java +++ b/source/java/org/alfresco/service/cmr/model/FileInfo.java @@ -22,6 +22,7 @@ import java.io.Serializable; import java.util.Date; import java.util.Map; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.repo.security.permissions.PermissionCheckValue; import org.alfresco.service.cmr.repository.ContentData; import org.alfresco.service.cmr.repository.NodeRef; @@ -34,6 +35,7 @@ import org.alfresco.service.namespace.QName; * * @author Derek Hulley */ +@AlfrescoPublicApi public interface FileInfo extends PermissionCheckValue, Serializable { /** diff --git a/source/java/org/alfresco/service/cmr/model/FileNotFoundException.java b/source/java/org/alfresco/service/cmr/model/FileNotFoundException.java index 39a72da604..c03df0e237 100644 --- a/source/java/org/alfresco/service/cmr/model/FileNotFoundException.java +++ b/source/java/org/alfresco/service/cmr/model/FileNotFoundException.java @@ -18,6 +18,7 @@ */ package org.alfresco.service.cmr.model; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.cmr.repository.NodeRef; /** @@ -25,6 +26,7 @@ import org.alfresco.service.cmr.repository.NodeRef; * * @author Derek Hulley */ +@AlfrescoPublicApi public class FileNotFoundException extends Exception { private static final long serialVersionUID = 2558540174977806285L; diff --git a/source/java/org/alfresco/service/cmr/model/SubFolderFilter.java b/source/java/org/alfresco/service/cmr/model/SubFolderFilter.java index 337f33ac4d..cc1ea2c5bc 100644 --- a/source/java/org/alfresco/service/cmr/model/SubFolderFilter.java +++ b/source/java/org/alfresco/service/cmr/model/SubFolderFilter.java @@ -2,6 +2,7 @@ package org.alfresco.service.cmr.model; import java.util.List; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.cmr.repository.ChildAssociationRef; /** @@ -9,6 +10,7 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef; * * @See FileFolderService */ +@AlfrescoPublicApi public interface SubFolderFilter { /** diff --git a/source/java/org/alfresco/service/cmr/repository/AspectMissingException.java b/source/java/org/alfresco/service/cmr/repository/AspectMissingException.java index 1278969a97..16197be094 100644 --- a/source/java/org/alfresco/service/cmr/repository/AspectMissingException.java +++ b/source/java/org/alfresco/service/cmr/repository/AspectMissingException.java @@ -20,6 +20,7 @@ package org.alfresco.service.cmr.repository; import java.text.MessageFormat; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.namespace.QName; /** @@ -27,6 +28,7 @@ import org.alfresco.service.namespace.QName; * * @author Roy Wetherall */ +@AlfrescoPublicApi public class AspectMissingException extends RuntimeException { private static final long serialVersionUID = 3257852099244210228L; diff --git a/source/java/org/alfresco/service/cmr/repository/ContentService.java b/source/java/org/alfresco/service/cmr/repository/ContentService.java index b474635882..4577c585e4 100644 --- a/source/java/org/alfresco/service/cmr/repository/ContentService.java +++ b/source/java/org/alfresco/service/cmr/repository/ContentService.java @@ -21,6 +21,7 @@ package org.alfresco.service.cmr.repository; import java.util.List; import java.util.Map; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.repo.content.transform.ContentTransformer; import org.alfresco.service.Auditable; import org.alfresco.service.cmr.dictionary.InvalidTypeException; @@ -47,6 +48,7 @@ import org.alfresco.service.namespace.QName; * * @author Derek Hulley */ +@AlfrescoPublicApi public interface ContentService { /** diff --git a/source/java/org/alfresco/service/cmr/repository/CopyService.java b/source/java/org/alfresco/service/cmr/repository/CopyService.java index c588146667..26f8450d21 100644 --- a/source/java/org/alfresco/service/cmr/repository/CopyService.java +++ b/source/java/org/alfresco/service/cmr/repository/CopyService.java @@ -20,6 +20,7 @@ package org.alfresco.service.cmr.repository; import java.util.List; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.query.PagingRequest; import org.alfresco.query.PagingResults; import org.alfresco.repo.security.permissions.PermissionCheckValue; @@ -34,6 +35,7 @@ import org.alfresco.service.namespace.QName; * * @author Roy Wetherall */ +@AlfrescoPublicApi public interface CopyService { /** diff --git a/source/java/org/alfresco/service/cmr/repository/NoTransformerException.java b/source/java/org/alfresco/service/cmr/repository/NoTransformerException.java index de07535492..4e66ec27a9 100644 --- a/source/java/org/alfresco/service/cmr/repository/NoTransformerException.java +++ b/source/java/org/alfresco/service/cmr/repository/NoTransformerException.java @@ -20,6 +20,7 @@ package org.alfresco.service.cmr.repository; import java.text.MessageFormat; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.error.AlfrescoRuntimeException; /** @@ -28,6 +29,7 @@ import org.alfresco.error.AlfrescoRuntimeException; * * @author Derek Hulley */ +@AlfrescoPublicApi public class NoTransformerException extends AlfrescoRuntimeException { private static final long serialVersionUID = 3689067335554183222L; diff --git a/source/java/org/alfresco/service/cmr/search/CategoryService.java b/source/java/org/alfresco/service/cmr/search/CategoryService.java index 2dc5ee3000..dad856d028 100644 --- a/source/java/org/alfresco/service/cmr/search/CategoryService.java +++ b/source/java/org/alfresco/service/cmr/search/CategoryService.java @@ -21,6 +21,7 @@ package org.alfresco.service.cmr.search; import java.util.Collection; import java.util.List; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.query.PagingRequest; import org.alfresco.query.PagingResults; import org.alfresco.service.Auditable; @@ -43,6 +44,7 @@ import org.alfresco.util.Pair; * @author Andy Hind * */ +@AlfrescoPublicApi public interface CategoryService { /** diff --git a/source/java/org/alfresco/service/cmr/security/AuthenticationService.java b/source/java/org/alfresco/service/cmr/security/AuthenticationService.java index 7d8eb04bcc..04cfd292bd 100644 --- a/source/java/org/alfresco/service/cmr/security/AuthenticationService.java +++ b/source/java/org/alfresco/service/cmr/security/AuthenticationService.java @@ -20,6 +20,7 @@ package org.alfresco.service.cmr.security; import java.util.Set; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.repo.security.authentication.AuthenticationException; import org.alfresco.service.Auditable; @@ -29,6 +30,7 @@ import org.alfresco.service.Auditable; * * @author Andy Hind */ +@AlfrescoPublicApi public interface AuthenticationService { /** diff --git a/source/java/org/alfresco/service/cmr/security/NoSuchPersonException.java b/source/java/org/alfresco/service/cmr/security/NoSuchPersonException.java index 0cb65df06b..8322c9fdcc 100644 --- a/source/java/org/alfresco/service/cmr/security/NoSuchPersonException.java +++ b/source/java/org/alfresco/service/cmr/security/NoSuchPersonException.java @@ -18,6 +18,7 @@ */ package org.alfresco.service.cmr.security; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.repo.security.person.PersonException; /** @@ -25,6 +26,7 @@ import org.alfresco.repo.security.person.PersonException; * * @author Derek Hulley */ +@AlfrescoPublicApi public class NoSuchPersonException extends PersonException { private static final long serialVersionUID = -8514361120995433997L; diff --git a/source/java/org/alfresco/service/cmr/security/PersonService.java b/source/java/org/alfresco/service/cmr/security/PersonService.java index e347d53f33..3fcd325f80 100644 --- a/source/java/org/alfresco/service/cmr/security/PersonService.java +++ b/source/java/org/alfresco/service/cmr/security/PersonService.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.query.PagingRequest; import org.alfresco.query.PagingResults; import org.alfresco.repo.security.permissions.PermissionCheckValue; @@ -44,6 +45,7 @@ import org.alfresco.util.Pair; * * @author Andy Hind */ +@AlfrescoPublicApi public interface PersonService { /** diff --git a/source/java/org/alfresco/service/cmr/site/SiteInfo.java b/source/java/org/alfresco/service/cmr/site/SiteInfo.java index be5091ad3c..76fb6e3b28 100644 --- a/source/java/org/alfresco/service/cmr/site/SiteInfo.java +++ b/source/java/org/alfresco/service/cmr/site/SiteInfo.java @@ -21,10 +21,12 @@ package org.alfresco.service.cmr.site; import java.io.Serializable; import java.util.Map; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.repo.security.permissions.PermissionCheckValue; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; +@AlfrescoPublicApi public interface SiteInfo extends PermissionCheckValue { /** @@ -122,4 +124,4 @@ public interface SiteInfo extends PermissionCheckValue */ public abstract Serializable getCustomProperty(QName name); -} \ No newline at end of file +} diff --git a/source/java/org/alfresco/service/cmr/site/SiteMemberInfo.java b/source/java/org/alfresco/service/cmr/site/SiteMemberInfo.java index ed0de35fec..b278b78c2e 100644 --- a/source/java/org/alfresco/service/cmr/site/SiteMemberInfo.java +++ b/source/java/org/alfresco/service/cmr/site/SiteMemberInfo.java @@ -19,12 +19,15 @@ package org.alfresco.service.cmr.site; +import org.alfresco.api.AlfrescoPublicApi; + /** * Site member's information. The member can either be an individual or a group. * * @author Jamal Kaabi-Mofrad * @since odin */ +@AlfrescoPublicApi public interface SiteMemberInfo { diff --git a/source/java/org/alfresco/service/cmr/site/SiteRole.java b/source/java/org/alfresco/service/cmr/site/SiteRole.java index 9c8bdb8e23..299929f4b9 100644 --- a/source/java/org/alfresco/service/cmr/site/SiteRole.java +++ b/source/java/org/alfresco/service/cmr/site/SiteRole.java @@ -1,5 +1,8 @@ package org.alfresco.service.cmr.site; +import org.alfresco.api.AlfrescoPublicApi; + +@AlfrescoPublicApi public enum SiteRole { // note: lexical ordering diff --git a/source/java/org/alfresco/service/cmr/site/SiteService.java b/source/java/org/alfresco/service/cmr/site/SiteService.java index f2ca78936c..1cacf757c3 100644 --- a/source/java/org/alfresco/service/cmr/site/SiteService.java +++ b/source/java/org/alfresco/service/cmr/site/SiteService.java @@ -22,6 +22,7 @@ import java.io.Serializable; import java.util.List; import java.util.Map; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.model.ContentModel; import org.alfresco.query.PagingRequest; import org.alfresco.query.PagingResults; @@ -42,6 +43,7 @@ import org.alfresco.util.Pair; * * @author Roy Wetherall */ +@AlfrescoPublicApi public interface SiteService { static String DOCUMENT_LIBRARY = "documentLibrary"; diff --git a/source/java/org/alfresco/service/cmr/site/SiteVisibility.java b/source/java/org/alfresco/service/cmr/site/SiteVisibility.java index e80f157c3a..f6cac1a45d 100644 --- a/source/java/org/alfresco/service/cmr/site/SiteVisibility.java +++ b/source/java/org/alfresco/service/cmr/site/SiteVisibility.java @@ -18,11 +18,14 @@ */ package org.alfresco.service.cmr.site; +import org.alfresco.api.AlfrescoPublicApi; + /** * Enumeration representing the different site visibilities. * * @author Roy Wetherall */ +@AlfrescoPublicApi public enum SiteVisibility { PUBLIC, // Public site. Visible and accessible by all diff --git a/source/java/org/alfresco/service/cmr/version/ReservedVersionNameException.java b/source/java/org/alfresco/service/cmr/version/ReservedVersionNameException.java index 85418215dd..752628f417 100644 --- a/source/java/org/alfresco/service/cmr/version/ReservedVersionNameException.java +++ b/source/java/org/alfresco/service/cmr/version/ReservedVersionNameException.java @@ -20,9 +20,12 @@ package org.alfresco.service.cmr.version; import java.text.MessageFormat; +import org.alfresco.api.AlfrescoPublicApi; + /** * @author Roy Wetherall */ +@AlfrescoPublicApi public class ReservedVersionNameException extends RuntimeException { /** diff --git a/source/java/org/alfresco/service/cmr/version/Version.java b/source/java/org/alfresco/service/cmr/version/Version.java index 098f8f8ef8..96ad82652f 100644 --- a/source/java/org/alfresco/service/cmr/version/Version.java +++ b/source/java/org/alfresco/service/cmr/version/Version.java @@ -22,10 +22,10 @@ import java.io.Serializable; import java.util.Date; import java.util.Map; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.repo.version.VersionBaseModel; import org.alfresco.service.cmr.repository.NodeRef; - /** * Version interface. * @@ -34,6 +34,7 @@ import org.alfresco.service.cmr.repository.NodeRef; * * @author Roy Wetherall, janv */ +@AlfrescoPublicApi public interface Version extends Serializable { /** diff --git a/source/java/org/alfresco/service/cmr/version/VersionHistory.java b/source/java/org/alfresco/service/cmr/version/VersionHistory.java index 9e3f60e2b4..7b852e064f 100644 --- a/source/java/org/alfresco/service/cmr/version/VersionHistory.java +++ b/source/java/org/alfresco/service/cmr/version/VersionHistory.java @@ -21,7 +21,7 @@ package org.alfresco.service.cmr.version; import java.io.Serializable; import java.util.Collection; - +import org.alfresco.api.AlfrescoPublicApi; /** * Version history interface. @@ -30,6 +30,7 @@ import java.util.Collection; * * @author Roy Wetherall */ +@AlfrescoPublicApi public interface VersionHistory extends Serializable { /** diff --git a/source/java/org/alfresco/service/cmr/version/VersionService.java b/source/java/org/alfresco/service/cmr/version/VersionService.java index 0ab40c6388..511b767cce 100644 --- a/source/java/org/alfresco/service/cmr/version/VersionService.java +++ b/source/java/org/alfresco/service/cmr/version/VersionService.java @@ -22,6 +22,7 @@ import java.io.Serializable; import java.util.Collection; import java.util.Map; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.repo.version.VersionServicePolicies.CalculateVersionLabelPolicy; import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.AspectMissingException; @@ -34,6 +35,7 @@ import org.alfresco.service.namespace.QName; * * @author Roy Wetherall, janv */ +@AlfrescoPublicApi public interface VersionService { /** diff --git a/source/java/org/alfresco/service/cmr/version/VersionType.java b/source/java/org/alfresco/service/cmr/version/VersionType.java index 6bcb03aae1..06acbb48f8 100644 --- a/source/java/org/alfresco/service/cmr/version/VersionType.java +++ b/source/java/org/alfresco/service/cmr/version/VersionType.java @@ -18,6 +18,8 @@ */ package org.alfresco.service.cmr.version; +import org.alfresco.api.AlfrescoPublicApi; + /** * Version type enum. *

@@ -26,4 +28,5 @@ package org.alfresco.service.cmr.version; * * @author Roy Wetherall */ -public enum VersionType {MAJOR, MINOR} \ No newline at end of file +@AlfrescoPublicApi +public enum VersionType {MAJOR, MINOR} diff --git a/source/java/org/alfresco/service/cmr/workflow/WorkflowDefinition.java b/source/java/org/alfresco/service/cmr/workflow/WorkflowDefinition.java index f89a2b19cb..0e33e20fe6 100644 --- a/source/java/org/alfresco/service/cmr/workflow/WorkflowDefinition.java +++ b/source/java/org/alfresco/service/cmr/workflow/WorkflowDefinition.java @@ -20,12 +20,15 @@ package org.alfresco.service.cmr.workflow; import java.io.Serializable; +import org.alfresco.api.AlfrescoPublicApi; + /** * Workflow Definition Data Object * * @author davidc */ +@AlfrescoPublicApi public class WorkflowDefinition implements Serializable { private static final long serialVersionUID = -4320345925926816927L; diff --git a/source/java/org/alfresco/service/cmr/workflow/WorkflowDeployment.java b/source/java/org/alfresco/service/cmr/workflow/WorkflowDeployment.java index 0a61095862..13d2ce470f 100644 --- a/source/java/org/alfresco/service/cmr/workflow/WorkflowDeployment.java +++ b/source/java/org/alfresco/service/cmr/workflow/WorkflowDeployment.java @@ -18,12 +18,14 @@ */ package org.alfresco.service.cmr.workflow; +import org.alfresco.api.AlfrescoPublicApi; /** * Workflow Definition Deployment * * @author davidc */ +@AlfrescoPublicApi public class WorkflowDeployment { /** Workflow Definition */ diff --git a/source/java/org/alfresco/service/cmr/workflow/WorkflowInstance.java b/source/java/org/alfresco/service/cmr/workflow/WorkflowInstance.java index 2699e82348..ba655ad5a1 100644 --- a/source/java/org/alfresco/service/cmr/workflow/WorkflowInstance.java +++ b/source/java/org/alfresco/service/cmr/workflow/WorkflowInstance.java @@ -21,6 +21,7 @@ package org.alfresco.service.cmr.workflow; import java.io.Serializable; import java.util.Date; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.cmr.repository.NodeRef; @@ -31,6 +32,7 @@ import org.alfresco.service.cmr.repository.NodeRef; * * @author davidc */ +@AlfrescoPublicApi public class WorkflowInstance implements Serializable { private static final long serialVersionUID = 4221926809419223452L; diff --git a/source/java/org/alfresco/service/cmr/workflow/WorkflowInstanceQuery.java b/source/java/org/alfresco/service/cmr/workflow/WorkflowInstanceQuery.java index d4e1dd51fb..2e290a4a39 100644 --- a/source/java/org/alfresco/service/cmr/workflow/WorkflowInstanceQuery.java +++ b/source/java/org/alfresco/service/cmr/workflow/WorkflowInstanceQuery.java @@ -22,8 +22,10 @@ import java.util.Date; import java.util.List; import java.util.Map; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.namespace.QName; +@AlfrescoPublicApi public class WorkflowInstanceQuery { public enum DatePosition diff --git a/source/java/org/alfresco/service/cmr/workflow/WorkflowNode.java b/source/java/org/alfresco/service/cmr/workflow/WorkflowNode.java index 20b3183fe0..6d4e6eb100 100644 --- a/source/java/org/alfresco/service/cmr/workflow/WorkflowNode.java +++ b/source/java/org/alfresco/service/cmr/workflow/WorkflowNode.java @@ -18,6 +18,7 @@ */ package org.alfresco.service.cmr.workflow; +import org.alfresco.api.AlfrescoPublicApi; /** * Workflow Node Data Object @@ -26,6 +27,7 @@ package org.alfresco.service.cmr.workflow; * * @author davidc */ +@AlfrescoPublicApi public class WorkflowNode { /** Workflow Node Name */ diff --git a/source/java/org/alfresco/service/cmr/workflow/WorkflowPath.java b/source/java/org/alfresco/service/cmr/workflow/WorkflowPath.java index a25f6151e4..887cfc034e 100644 --- a/source/java/org/alfresco/service/cmr/workflow/WorkflowPath.java +++ b/source/java/org/alfresco/service/cmr/workflow/WorkflowPath.java @@ -18,6 +18,7 @@ */ package org.alfresco.service.cmr.workflow; +import org.alfresco.api.AlfrescoPublicApi; /** * Workflow Path Data Object @@ -29,6 +30,7 @@ package org.alfresco.service.cmr.workflow; * * @author davidc */ +@AlfrescoPublicApi public class WorkflowPath { /** Unique id of Workflow Path */ diff --git a/source/java/org/alfresco/service/cmr/workflow/WorkflowService.java b/source/java/org/alfresco/service/cmr/workflow/WorkflowService.java index eb58f42706..653efd9887 100644 --- a/source/java/org/alfresco/service/cmr/workflow/WorkflowService.java +++ b/source/java/org/alfresco/service/cmr/workflow/WorkflowService.java @@ -23,6 +23,7 @@ import java.io.Serializable; import java.util.List; import java.util.Map; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; @@ -35,6 +36,7 @@ import org.alfresco.service.namespace.QName; * * @author davidc */ +@AlfrescoPublicApi public interface WorkflowService { // diff --git a/source/java/org/alfresco/service/cmr/workflow/WorkflowTask.java b/source/java/org/alfresco/service/cmr/workflow/WorkflowTask.java index e6a75cb679..f710be6afc 100644 --- a/source/java/org/alfresco/service/cmr/workflow/WorkflowTask.java +++ b/source/java/org/alfresco/service/cmr/workflow/WorkflowTask.java @@ -21,6 +21,7 @@ package org.alfresco.service.cmr.workflow; import java.io.Serializable; import java.util.Map; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.namespace.QName; @@ -31,6 +32,7 @@ import org.alfresco.service.namespace.QName; * * @author davidc */ +@AlfrescoPublicApi public class WorkflowTask { /** Unique id of Task */ diff --git a/source/java/org/alfresco/service/cmr/workflow/WorkflowTaskDefinition.java b/source/java/org/alfresco/service/cmr/workflow/WorkflowTaskDefinition.java index 1f15df29b9..cbe72b9c37 100644 --- a/source/java/org/alfresco/service/cmr/workflow/WorkflowTaskDefinition.java +++ b/source/java/org/alfresco/service/cmr/workflow/WorkflowTaskDefinition.java @@ -18,6 +18,7 @@ */ package org.alfresco.service.cmr.workflow; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.cmr.dictionary.TypeDefinition; @@ -29,6 +30,7 @@ import org.alfresco.service.cmr.dictionary.TypeDefinition; * * @author davidc */ +@AlfrescoPublicApi public class WorkflowTaskDefinition { /** Unique id of Workflow Task Definition */ diff --git a/source/java/org/alfresco/service/cmr/workflow/WorkflowTaskQuery.java b/source/java/org/alfresco/service/cmr/workflow/WorkflowTaskQuery.java index f81ea26154..6063c96a5e 100644 --- a/source/java/org/alfresco/service/cmr/workflow/WorkflowTaskQuery.java +++ b/source/java/org/alfresco/service/cmr/workflow/WorkflowTaskQuery.java @@ -20,6 +20,7 @@ package org.alfresco.service.cmr.workflow; import java.util.Map; +import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.namespace.QName; @@ -30,6 +31,7 @@ import org.alfresco.service.namespace.QName; * * @author davidc */ +@AlfrescoPublicApi public class WorkflowTaskQuery { // Engine Id diff --git a/source/java/org/alfresco/service/cmr/workflow/WorkflowTaskState.java b/source/java/org/alfresco/service/cmr/workflow/WorkflowTaskState.java index 1f98dcff68..029e27dd04 100644 --- a/source/java/org/alfresco/service/cmr/workflow/WorkflowTaskState.java +++ b/source/java/org/alfresco/service/cmr/workflow/WorkflowTaskState.java @@ -18,6 +18,7 @@ */ package org.alfresco.service.cmr.workflow; +import org.alfresco.api.AlfrescoPublicApi; /** * Workflow Task State @@ -30,6 +31,7 @@ package org.alfresco.service.cmr.workflow; * * @author davidc */ +@AlfrescoPublicApi public enum WorkflowTaskState { IN_PROGRESS, diff --git a/source/java/org/alfresco/service/cmr/workflow/WorkflowTimer.java b/source/java/org/alfresco/service/cmr/workflow/WorkflowTimer.java index 0b386b71df..238292b9e7 100644 --- a/source/java/org/alfresco/service/cmr/workflow/WorkflowTimer.java +++ b/source/java/org/alfresco/service/cmr/workflow/WorkflowTimer.java @@ -20,6 +20,9 @@ package org.alfresco.service.cmr.workflow; import java.util.Date; +import org.alfresco.api.AlfrescoPublicApi; + +@AlfrescoPublicApi public class WorkflowTimer { /** Timer Id */ diff --git a/source/java/org/alfresco/service/cmr/workflow/WorkflowTransition.java b/source/java/org/alfresco/service/cmr/workflow/WorkflowTransition.java index 39de399644..bda1ab4d09 100644 --- a/source/java/org/alfresco/service/cmr/workflow/WorkflowTransition.java +++ b/source/java/org/alfresco/service/cmr/workflow/WorkflowTransition.java @@ -18,12 +18,14 @@ */ package org.alfresco.service.cmr.workflow; +import org.alfresco.api.AlfrescoPublicApi; /** * Workflow Transition. * * @author davidc */ +@AlfrescoPublicApi public class WorkflowTransition { /** Transition Id */ diff --git a/source/java/org/alfresco/util/FileNameValidator.java b/source/java/org/alfresco/util/FileNameValidator.java index 3b961bafce..6b9d942c03 100644 --- a/source/java/org/alfresco/util/FileNameValidator.java +++ b/source/java/org/alfresco/util/FileNameValidator.java @@ -19,11 +19,14 @@ package org.alfresco.util; import java.util.regex.Pattern; +import org.alfresco.api.AlfrescoPublicApi; + /** * Static checker for valid file names. * * @author Derek Hulley */ +@AlfrescoPublicApi public class FileNameValidator { /**