KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > cms > publication > DocumentType


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17
18 /* $Id: DocumentType.java 42598 2004-03-01 16:18:28Z gregor $ */
19
20 package org.apache.lenya.cms.publication;
21
22 import org.apache.lenya.cms.authoring.ParentChildCreatorInterface;
23
24
25 /**
26  * A document type.
27  */

28 public class DocumentType {
29     public static final String JavaDoc NAMESPACE = "http://apache.org/cocoon/lenya/doctypes/1.0";
30     public static final String JavaDoc DEFAULT_PREFIX = "dt";
31
32     /** Creates a new instance of DocumentType
33      *
34      * @param name the name of the document type
35      *
36      */

37     protected DocumentType(String JavaDoc name) {
38         assert name != null;
39         this.name = name;
40     }
41
42     private String JavaDoc name;
43
44     /**
45     * Returns the name of this document type.
46      * @return A string value.
47      */

48     public String JavaDoc getName() {
49         return name;
50     }
51
52     private ParentChildCreatorInterface creator = null;
53
54     /**
55      * Get the creator for this document type.
56      *
57      * @return a <code>ParentChildCreatorInterface</code>
58      */

59     public ParentChildCreatorInterface getCreator() {
60         return creator;
61     }
62
63     /**
64      * Set the creator
65      *
66      * @param creator a <code>ParentChildCreatorInterface</code>
67      */

68     protected void setCreator(ParentChildCreatorInterface creator) {
69         assert creator != null;
70         this.creator = creator;
71     }
72
73     private String JavaDoc workflowFile = null;
74
75     /**
76      * Returns if this document type has a workflow definition.
77      *
78      * @return A boolean value.
79      */

80     public boolean hasWorkflow() {
81         return workflowFile != null;
82     }
83
84     /**
85      * Get the file name of the workflow file.
86      *
87      * @return a <code>String</code>
88      *
89      * @throws DocumentTypeBuildException if the document type has no workflow
90      */

91     public String JavaDoc getWorkflowFileName() throws DocumentTypeBuildException {
92         if (!hasWorkflow()) {
93             throw new DocumentTypeBuildException("The document type '" + getName() +
94                 "' has no workflow!");
95         }
96
97         return workflowFile;
98     }
99
100     /**
101      * Set the file name of the workflow file.
102      *
103      * @param string the new file name
104      */

105     public void setWorkflowFileName(String JavaDoc string) {
106         assert string != null;
107         workflowFile = string;
108     }
109
110     /** (non-Javadoc)
111      * @see java.lang.Object#toString()
112      */

113     public String JavaDoc toString() {
114         return getName();
115     }
116 }
117
Popular Tags