KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > controllers > kernel > impl > simple > WorkflowDefinitionController


1 /* ===============================================================================
2  *
3  * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4  *
5  * ===============================================================================
6  *
7  * Copyright (C)
8  *
9  * This program is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License version 2, as published by the
11  * Free Software Foundation. See the file LICENSE.html for more information.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19  * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20  *
21  * ===============================================================================
22  */

23
24 package org.infoglue.cms.controllers.kernel.impl.simple;
25
26 import java.util.List JavaDoc;
27
28 import org.exolab.castor.jdo.Database;
29 import org.infoglue.cms.entities.kernel.BaseEntityVO;
30 import org.infoglue.cms.entities.management.ContentTypeDefinitionVO;
31 import org.infoglue.cms.entities.workflow.WorkflowDefinition;
32 import org.infoglue.cms.entities.workflow.WorkflowDefinitionVO;
33 import org.infoglue.cms.entities.workflow.impl.simple.WorkflowDefinitionImpl;
34 import org.infoglue.cms.exception.Bug;
35 import org.infoglue.cms.exception.ConstraintException;
36 import org.infoglue.cms.exception.SystemException;
37
38 /**
39  * @author Mattias Bogeblad
40  */

41
42 public class WorkflowDefinitionController extends BaseController
43 {
44
45     /**
46      * Factory method
47      */

48
49     public static WorkflowDefinitionController getController()
50     {
51         return new WorkflowDefinitionController();
52     }
53
54     public WorkflowDefinitionVO getWorkflowDefinitionVOWithId(Integer JavaDoc workflowDefinitionId) throws SystemException, Bug
55     {
56         return (WorkflowDefinitionVO) getVOWithId(WorkflowDefinitionImpl.class, workflowDefinitionId);
57     }
58
59     public WorkflowDefinition getWorkflowDefinitionWithId(Integer JavaDoc workflowDefinitionId, Database db) throws SystemException, Bug
60     {
61         return (WorkflowDefinition) getObjectWithId(WorkflowDefinitionImpl.class, workflowDefinitionId, db);
62     }
63
64     public List JavaDoc getWorkflowDefinitionVOList() throws SystemException, Bug
65     {
66         /*
67         String key = "contentTypeDefinitionVOList";
68         logger.info("key:" + key);
69         List cachedContentTypeDefinitionVOList = (List)CacheController.getCachedObject("contentTypeDefinitionCache", key);
70         if(cachedContentTypeDefinitionVOList != null)
71         {
72             logger.info("There was an cached contentTypeDefinitionVOList:" + cachedContentTypeDefinitionVOList.size());
73             return cachedContentTypeDefinitionVOList;
74         }
75         */

76         
77         List JavaDoc workflowDefinitionVOList = getAllVOObjects(WorkflowDefinitionImpl.class, "workflowDefinitionId");
78
79         //CacheController.cacheObject("contentTypeDefinitionCache", key, contentTypeDefinitionVOList);
80

81         return workflowDefinitionVOList;
82     }
83     
84
85     public WorkflowDefinitionVO create(WorkflowDefinitionVO workflowDefinitionVO) throws ConstraintException, SystemException
86     {
87         WorkflowDefinition workflowDefinition = new WorkflowDefinitionImpl();
88         workflowDefinition.setValueObject(workflowDefinitionVO);
89         workflowDefinition = (WorkflowDefinition) createEntity(workflowDefinition);
90         return workflowDefinition.getValueObject();
91     }
92
93     public void delete(WorkflowDefinitionVO workflowDefinitionVO) throws ConstraintException, SystemException
94     {
95         deleteEntity(WorkflowDefinitionImpl.class, workflowDefinitionVO.getWorkflowDefinitionId());
96     }
97
98     public WorkflowDefinitionVO update(WorkflowDefinitionVO workflowDefinitionVO) throws ConstraintException, SystemException
99     {
100         return (WorkflowDefinitionVO) updateEntity(WorkflowDefinitionImpl.class, workflowDefinitionVO);
101     }
102
103     /**
104      * This is a method that gives the user back an newly initialized ValueObject for this entity that the controller
105      * is handling.
106      */

107
108     public BaseEntityVO getNewVO()
109     {
110         return new ContentTypeDefinitionVO();
111     }
112 }
113
Popular Tags