KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > action > executer > CreateVersionActionExecuter


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.action.executer;
18
19 import java.util.List JavaDoc;
20
21 import org.alfresco.model.ContentModel;
22 import org.alfresco.service.cmr.action.Action;
23 import org.alfresco.service.cmr.action.ParameterDefinition;
24 import org.alfresco.service.cmr.repository.NodeRef;
25 import org.alfresco.service.cmr.repository.NodeService;
26 import org.alfresco.service.cmr.version.VersionService;
27
28 /**
29  * Add features action executor implementation.
30  *
31  * @author Roy Wetherall
32  */

33 public class CreateVersionActionExecuter extends ActionExecuterAbstractBase
34 {
35     /**
36      * Action constants
37      */

38     public static final String JavaDoc NAME = "create-version";
39     
40     public NodeService nodeService;
41     
42     public VersionService versionService;
43     
44     public void setNodeService(NodeService nodeService)
45     {
46         this.nodeService = nodeService;
47     }
48     
49     public void setVersionService(VersionService versionService)
50     {
51         this.versionService = versionService;
52     }
53
54     /**
55      * @see org.alfresco.repo.action.executer.ActionExecuter#execute(org.alfresco.service.cmr.repository.NodeRef, NodeRef)
56      */

57     public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef)
58     {
59         if (this.nodeService.exists(actionedUponNodeRef) == true &&
60             this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE) == true)
61         {
62             // TODO would be nice to be able to set the version details
63
this.versionService.createVersion(actionedUponNodeRef, null);
64         }
65     }
66
67     /**
68      * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefintions(java.util.List)
69      */

70     @Override JavaDoc
71     protected void addParameterDefintions(List JavaDoc<ParameterDefinition> paramList)
72     {
73     }
74
75 }
76
Popular Tags