KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > jcr > dictionary > VersionableMixin


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.jcr.dictionary;
18
19 import java.io.Serializable JavaDoc;
20 import java.util.HashMap JavaDoc;
21 import java.util.Map JavaDoc;
22
23
24 import org.alfresco.jcr.session.SessionImpl;
25 import org.alfresco.model.ContentModel;
26 import org.alfresco.service.cmr.repository.NodeRef;
27 import org.alfresco.service.namespace.QName;
28
29 /**
30  * Encapsulate Versionable Mixin behaviour mapping to Alfresco
31  *
32  * @author davidc
33  */

34 public class VersionableMixin implements ClassMap.AddMixin, ClassMap.RemoveMixin
35 {
36
37     /*
38      * (non-Javadoc)
39      * @see org.alfresco.jcr.dictionary.ClassMap.AddMixin#preAddMixin(org.alfresco.jcr.session.SessionImpl, org.alfresco.service.cmr.repository.NodeRef)
40      */

41     public Map JavaDoc<QName, Serializable JavaDoc> preAddMixin(SessionImpl session, NodeRef nodeRef)
42     {
43         // switch off auto-versioning
44
Map JavaDoc<QName, Serializable JavaDoc> properties = new HashMap JavaDoc<QName, Serializable JavaDoc>();
45         properties.put(ContentModel.PROP_INITIAL_VERSION, false);
46         properties.put(ContentModel.PROP_AUTO_VERSION, false);
47         return properties;
48     }
49
50     /*
51      * (non-Javadoc)
52      * @see org.alfresco.jcr.dictionary.ClassMap.AddMixin#postAddMixin(org.alfresco.jcr.session.SessionImpl, org.alfresco.service.cmr.repository.NodeRef)
53      */

54     public void postAddMixin(SessionImpl session, NodeRef nodeRef)
55     {
56     }
57
58     /*
59      * (non-Javadoc)
60      * @see org.alfresco.jcr.dictionary.ClassMap.RemoveMixin#preRemoveMixin(org.alfresco.jcr.session.SessionImpl, org.alfresco.service.cmr.repository.NodeRef)
61      */

62     public void preRemoveMixin(SessionImpl session, NodeRef nodeRef)
63     {
64     }
65
66     /*
67      * (non-Javadoc)
68      * @see org.alfresco.jcr.dictionary.ClassMap.RemoveMixin#postRemoveMixin(org.alfresco.jcr.session.SessionImpl, org.alfresco.service.cmr.repository.NodeRef)
69      */

70     public void postRemoveMixin(SessionImpl session, NodeRef nodeRef)
71     {
72     }
73
74 }
75
Popular Tags