KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > services > pages > JahiaPageTemplateService


1 //
2
// ____.
3
// __/\ ______| |__/\. _______
4
// __ .____| | \ | +----+ \
5
// _______| /--| | | - \ _ | : - \_________
6
// \\______: :---| : : | : | \________>
7
// |__\---\_____________:______: :____|____:_____\
8
// /_____|
9
//
10
// . . . i n j a h i a w e t r u s t . . .
11
//
12
// 22.01.2001 NK added page definition properties, ACL
13

14
15 package org.jahia.services.pages;
16
17 import org.jahia.data.JahiaDOMObject;
18 import org.jahia.exceptions.JahiaException;
19 import org.jahia.services.JahiaService;
20 import org.jahia.services.usermanager.JahiaUser;
21
22 import java.util.Enumeration JavaDoc;
23 import java.util.Vector JavaDoc;
24
25
26 /**
27  * This interface defines all the methods a page template service should
28  * implement, so that it can be intergrated into Jahia.
29  *
30  * @author Fulco Houkes
31  * @version 1.0
32  */

33 public abstract class JahiaPageTemplateService extends JahiaService {
34
35     /**
36      * Create a new page template.
37      *
38      * @param siteID the site identification number
39      * @param name The page template name.
40      * @param sourcePath The page template source path.
41      * @param isAvailable True is the page template is available in edition
42      * mode or false if it should be hidden.
43      * @param image Image path.
44      * @param parentAclID The parent ACL id
45      *
46      * @return Return a new page template instanciation.
47      *
48      * @throws JahiaException Throws this exception when any error occured
49      * in the page template creation process.
50      */

51     public abstract JahiaPageDefinition createPageTemplate (
52             int siteID,
53             String JavaDoc name,
54             String JavaDoc sourcePath,
55             boolean isAvailable,
56             String JavaDoc image,
57             int parentAclID)
58             throws JahiaException;
59
60
61     /**
62      * Deletes the specified page template.
63      *
64      * @param templateID The page template ID.
65      *
66      * @throws JahiaException Throws this exception if any error occured in the deletion process.
67      * @throws JahiaException Return this exception if any failure occured.
68      */

69     public abstract void deletePageTemplate (int templateID)
70             throws JahiaException;
71
72
73     /**
74      * Gets all the page template IDs.
75      *
76      * @return Return a Vector of page template IDs
77      *
78      * @throws JahiaException Return this exception if any failure occured.
79      */

80     public abstract Vector JavaDoc getAllPageTemplateIDs ()
81             throws JahiaException;
82
83
84     /**
85      * Check if a page already has the same source path
86      *
87      * @param siteID the site identification number
88      * @param path the full path with filename to the template file to check
89      *
90      * @return Return the reference on the page template having the same
91      * specified source path. Return null if no template exists,
92      * matching the source path.
93      */

94     public abstract JahiaPageDefinition getPageTemplateBySourcePath (int siteID, String JavaDoc path)
95             throws JahiaException;
96
97
98     /**
99      * Try to find the specified page template.
100      *
101      * @param templateID The page template ID.
102      *
103      * @return Return a valid instance of a JahiaPageDefinition class. If the
104      * page template doesn't exist an exception is thrown.
105      *
106      * @throws JahiaException Throws this exception if any error occured in the lookup process.
107      */

108     public abstract JahiaPageDefinition lookupPageTemplate (int templateID)
109             throws JahiaException;
110
111
112     /**
113      * Try to find the specified page template.
114      *
115      * @param name the name of the requested page template.
116      * @param siteID the site identification number
117      *
118      * @return Return a valid instance of a JahiaPageDefinition class. If the
119      * page template doesn't exist an exception is thrown.
120      *
121      * @throws JahiaException Throws this exception if any error occured in the lookup process.
122      */

123     public abstract JahiaPageDefinition lookupPageTemplateByName (String JavaDoc name, int siteID)
124             throws JahiaException;
125
126
127     /**
128      * Return a list of all the page templates depending of the site ID and
129      * if there are available or not (according to the passed paramters).
130      *
131      * @param siteID the site identification number
132      * @param availableOnly Set true to get all the available template, or
133      * false to the other ones.
134      *
135      * @return Return an Enumeration holding all the page templates matching
136      * the site ID and the visibility requierments.
137      */

138     public abstract Enumeration JavaDoc getPageTemplates (int siteID, boolean availableOnly)
139             throws JahiaException;
140
141
142     /**
143      * Return a list of all the page templates depending of the site ID, the
144      * user and if there are available or not (according to the passed paramters).
145      *
146      * @param user A Jahia user having access to the page template.
147      * @param siteID the site identification number
148      * @param availableOnly Set true to get all the available template, or
149      * false to the other ones.
150      *
151      * @return Return an Enumeration holding all the page templates matching
152      * the site ID and the visibility requierments.
153      */

154     public abstract Enumeration JavaDoc getPageTemplates (JahiaUser user, int siteID,
155                                                   boolean availableOnly)
156             throws JahiaException;
157
158
159     /**
160      * Return the number of page templates in the database.
161      *
162      * @return Return the number of page templates.
163      */

164     public abstract int getNbPageTemplates ()
165             throws JahiaException;
166
167
168     /**
169      * Return the number of page templates in the database for a gived site.
170      *
171      * @param siteID the site identification number
172      *
173      * @return Return the number of page templates.
174      */

175     public abstract int getNbPageTemplates (int siteID)
176             throws JahiaException;
177
178
179
180     /**
181      * returns a DOM representation of all page def of a site
182      *
183      * @param siteID the site identification number
184      */

185     public abstract JahiaDOMObject getPageDefsAsDOM (int siteID)
186             throws JahiaException;
187
188
189     /**
190      * returns a DOM representation of all page def props of a site
191      *
192      * @param siteID the site identification number
193      */

194     public abstract JahiaDOMObject getPageDefPropsAsDOM (int siteID)
195             throws JahiaException;
196
197
198     /**
199      * Returns a vector of all page templates' Acl ID of this site
200      * Need this for site extraction
201      *
202      * @param siteID the site identification number
203      */

204     public abstract Vector JavaDoc getAclIDs (int siteID)
205         throws JahiaException;
206
207     /**
208      * Update page template in database and cache.
209      * @param thePageTemplate JahiaPageDefinition
210      * @throws JahiaException
211      */

212     public abstract void updatePageTemplate(JahiaPageDefinition thePageTemplate)
213         throws JahiaException;
214
215     // Patch ---------------------------------------------------
216
// 30.01.2002 : NK patch for old databases containing templates without ACL
217
// Do create ACL for them.
218
public abstract void patchTemplateWithoutACL () throws JahiaException;
219
220
221 }
222
223
Popular Tags