KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > node > ReferenceableAspect


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.repo.node;
18
19 import org.alfresco.model.ContentModel;
20 import org.alfresco.repo.copy.CopyServicePolicies;
21 import org.alfresco.repo.policy.JavaBehaviour;
22 import org.alfresco.repo.policy.PolicyComponent;
23 import org.alfresco.repo.policy.PolicyScope;
24 import org.alfresco.service.cmr.repository.NodeRef;
25 import org.alfresco.service.cmr.repository.StoreRef;
26 import org.alfresco.service.namespace.NamespaceService;
27 import org.alfresco.service.namespace.QName;
28 import org.apache.commons.logging.Log;
29 import org.apache.commons.logging.LogFactory;
30
31 /**
32  * Registers and contains the behaviour specific to the
33  * {@link org.alfresco.model.ContentModel#ASPECT_REFERENCEABLE referencable aspect}.
34  *
35  * @author Derek Hulley
36  */

37 public class ReferenceableAspect implements CopyServicePolicies.OnCopyNodePolicy
38 {
39     // Logger
40
private static final Log logger = LogFactory.getLog(ReferenceableAspect.class);
41
42     // Dependencies
43
private PolicyComponent policyComponent;
44
45     /**
46      * @param policyComponent the policy component to register behaviour with
47      */

48     public void setPolicyComponent(PolicyComponent policyComponent)
49     {
50         this.policyComponent = policyComponent;
51     }
52     
53     /**
54      * Initialise the Referencable Aspect
55      * <p>
56      * Ensures that the {@link ContentModel#ASPECT_REFERENCEABLE referencable aspect}
57      * copy behaviour is disabled.
58      */

59     public void init()
60     {
61         // disable copy for referencable aspect
62
this.policyComponent.bindClassBehaviour(
63                 QName.createQName(NamespaceService.ALFRESCO_URI, "onCopyNode"),
64                 ContentModel.ASPECT_REFERENCEABLE,
65                 new JavaBehaviour(this, "onCopyNode"));
66     }
67
68     /**
69      * Does nothing
70      */

71     public void onCopyNode(
72             QName classRef,
73             NodeRef sourceNodeRef,
74             StoreRef destinationStoreRef,
75             boolean copyToNewNode,
76             PolicyScope copyDetails)
77     {
78         // don't copy
79
}
80 }
81
Popular Tags