KickJava   Java API By Example, From Geeks To Geeks.

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


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

13 package org.jahia.services.pages;
14
15 import java.util.ArrayList JavaDoc;
16 import java.util.Enumeration JavaDoc;
17 import java.util.List JavaDoc;
18 import java.util.Map JavaDoc;
19 import java.util.Set JavaDoc;
20 import java.util.Vector JavaDoc;
21
22 import org.jahia.data.JahiaDOMObject;
23 import org.jahia.exceptions.JahiaException;
24 import org.jahia.exceptions.JahiaPageNotFoundException;
25 import org.jahia.exceptions.JahiaTemplateNotFoundException;
26 import org.jahia.params.ParamBean;
27 import org.jahia.services.JahiaInitializableService;
28 import org.jahia.services.usermanager.JahiaUser;
29 import org.jahia.services.version.ActivationTestResults;
30 import org.jahia.services.version.EntryLoadRequest;
31 import org.jahia.services.version.JahiaSaveVersion;
32 import org.jahia.services.version.StateModificationContext;
33
34 /**
35  * This interface defines all the methods a page service should implement, so that
36  * it can be intergrated into Jahia.
37  *
38  * @version 2.0
39  */

40 public abstract class JahiaPageService extends JahiaInitializableService {
41
42     // the Page Properties cache by page ID name.
43
// public static final String PAGE_CHILD_CACHE = "PageChildCache";
44

45     //-------------------------------------------------------------------------
46
/**
47      * Create a new page.
48      *
49      * @param siteID The Jahia ID (site ID).
50      * @param parentID The parent page ID.
51      * @param pageType The page type (see constants in JahiaPage).
52      * @param title The page title.
53      * @param pageDefID The page defiNition ID.
54      * @param creator The creators nickname used by Jahia internally.
55      * @param parentAclID The parent ACL ID.
56      * @param jParam The Jahia parameters.
57      *
58      * @return Return a new JahiaPage instanciated object.
59      *
60      * @throws JahiaException Throws this exception when any error occured in the page
61      * creation process.
62      */

63     public abstract JahiaPage createPage (
64             int siteID,
65             int parentID,
66             int pageType,
67             String JavaDoc title,
68             int pageDefID,
69             String JavaDoc remoteURL,
70             int pageLinkID,
71             String JavaDoc creator,
72             int parentAclID,
73             ParamBean jParam)
74             throws JahiaException;
75
76     //-------------------------------------------------------------------------
77
/**
78      * Deletes a page information, and its contents (fields, containers, etc.)
79      *
80      * @param pageID The page to be deleted.
81      *
82      * @throws JahiaException Return this exception if any failure occured in the deletion
83      * process.
84      */

85     public abstract void deletePage (JahiaPage theVictim, ParamBean jParam)
86             throws JahiaException;
87
88     //-------------------------------------------------------------------------
89
/**
90      * Finds a page id from a page id, and going up a certain number of levels
91      *
92      * @param pageID The page id
93      * @param levelNb The number of levels to go up
94      *
95      * @return the page id if found, -1 if not found
96      */

97     public abstract int findPageIDFromLevel (int pageID, int levelNb,
98                                              ParamBean jParams)
99             throws JahiaException;
100
101     //-------------------------------------------------------------------------
102
/**
103      * Get all pages of the specified "website".
104      * If the submitted user is not null, then this method won't return
105      * pages that the user can't read.
106      *
107      * @param siteID The jahia site ID
108      * @param loadFlag Mask of page types to be loaded. See
109      * {@link org.jahia.services.pages.PageLoadFlags PageLoadFlags}
110      * class constants for more informaion.
111      * @param jParam Jahia parameters. This parameter can be set to
112      * null in case no dynamic context is needed.
113      * @param theUser The current user, to check rights
114      *
115      * @return a Vector of JahiaPage objects
116      *
117      * @throws JahiaException Return this exception if any failure occured.
118      */

119     public abstract Enumeration JavaDoc getAllPages (
120             int siteID,
121             int loadFlag,
122             ParamBean jParam,
123             JahiaUser user)
124             throws JahiaException;
125
126     //-------------------------------------------------------------------------
127
/**
128      * Return all the site IDs.
129      *
130      * @return Return a Vector holding all the site IDs as Integers.
131      */

132     public abstract Vector JavaDoc getAllSiteIDs ()
133             throws JahiaException;
134
135     //--------------------------------------------------------------------------
136
/**
137      * Gets all the page IDs of a specified site.
138      *
139      * @param siteID The jahia site ID.
140      *
141      * @return Return a valid Vector of page IDs stored as Integers. The Vector
142      * might be empty if no page was found.
143      *
144      * @throws JahiaException Return this exception if any failure occured.
145      */

146     public abstract Vector JavaDoc getPageIDsInSite (int siteID)
147             throws JahiaException;
148
149     //--------------------------------------------------------------------------
150
/**
151      * Get the jahia page id in a site corresponding to a specified link type.
152      *
153      * @param siteID The jahia site ID.
154      * @param linkType One of these TYPE_DIRECT, TYPE_LINK, TYPE_URL links.
155      *
156      * @return Return a valid Vector of page IDs stored as Integers. The Vector
157      * might be empty if no page was found.
158      *
159      * @throws JahiaException Return this exception if any failure occured.
160      */

161     public abstract Vector JavaDoc getPageIDsInSite (int siteID, int linkType)
162             throws JahiaException;
163
164     //--------------------------------------------------------------------------
165
/**
166      * Retrieves all the page IDs that use the specified template
167      *
168      * @param templateID the identifier of the template we want the page IDs
169      * for
170      *
171      * @throws JahiaException Return this exception if any failure occured.
172      * @returns Returns a Vector of page IDs stored as Integers. The Vector
173      * might be empty if no page was found.
174      */

175     public abstract Vector JavaDoc getPageIDsWithTemplate (int templateID)
176             throws JahiaException;
177
178     //-------------------------------------------------------------------------
179
/**
180      * Returns the page field id that is parent of the given pageId.
181      * The order is by workflows state from most staged to active.
182      * Without marked for delete
183      *
184      * @param pageID int
185      * @throws JahiaException
186      * @return int
187      */

188     public abstract int getPageFieldID (int pageID)
189         throws JahiaException;
190
191     //-------------------------------------------------------------------------
192
/**
193      * Returns the active page field id that is parent of the given pageId.
194      *
195      * @param pageID int
196      * @throws JahiaException
197      * @return int
198      */

199     public abstract int getActivePageFieldID (int pageID)
200             throws JahiaException;
201
202     //-------------------------------------------------------------------------
203
/**
204      * Returns the staged page field id that is parent of the given pageId.
205      *
206      * @param pageID int
207      * @throws JahiaException
208      * @return int
209      */

210     public abstract int getStagedPageFieldID (int pageID)
211             throws JahiaException;
212
213     /**
214      * In case of a page move, a same page is pointed by both an active page field and a staged page field
215      * This method return a set of theses pages fields.
216      * The ids are sorted by workflows state ( most staged first )
217      *
218      * @param pageID int
219      * @return Vector
220      */

221     public abstract Vector JavaDoc getStagingAndActivePageFieldIDs (int pageID)
222         throws JahiaException;
223
224     /**
225      * Returns all the different field of type page IDs in staging mode in a given page.
226      *
227      * @param pageID the page for which to retrieve the field of type page
228      * @return always returns a Set object, but it might be empty. If non
229      * empty it contains Integer objects that represent the page IDs.
230      * @throws JahiaException
231      */

232     public abstract Set JavaDoc getStagingPageFieldIDsInPage (int pageID)
233         throws
234     JahiaException;
235
236     //-------------------------------------------------------------------------
237
/**
238      * Return a vector holding all the child pages of the specified page. The
239      * loading flag filters the kind of pages to return.
240      *
241      * @param pageID Page unique identification number.
242      * @param loadFlag Mask of page types to be loaded. See
243      * {@link org.jahia.services.pages.PageLoadFlags PageLoadFlags}
244      * class constants for more informaion.
245      * @param jParam Jahia parameters. This parameter can be set to
246      * null in case no dynamic context is needed.
247      *
248      * @return Return a Vector of JahiaPage objects. The returned vector is
249      * always non-null, but might have no pages if the specified page
250      * has not childs, or if no childs matching the loading flag were
251      * found.
252      *
253      * @throws JahiaException Return this exception if any failure occured.
254      */

255     public abstract Vector JavaDoc getPageChilds (
256             int pageID,
257             int loadFlag,
258             ParamBean jParam)
259             throws JahiaException;
260
261     public abstract Vector JavaDoc getPageChilds (int pageID, int loadFlag,
262                                           EntryLoadRequest loadRequest)
263             throws JahiaException;
264
265     //-------------------------------------------------------------------------
266
/**
267      * Return a vector holding all the child pages of the specified page. The
268      * loading flag filters the kind of pages to return.
269      *
270      * @param pageID Page unique identification number.
271      * @param loadFlag Mask of page types to be loaded. See
272      * {@link org.jahia.services.pages.PageLoadFlags PageLoadFlags}
273      * class constants for more informaion.
274      * @param user Jahia User.
275      *
276      * @return Return a Vector of JahiaPage objects. The returned vector is
277      * always non-null, but might have no pages if the specified page
278      * has not childs, or if no childs matching the loading flag were
279      * found.
280      *
281      * @throws JahiaException Return this exception if any failure occured.
282      */

283     public abstract Vector JavaDoc getPageChilds (
284             int pageID,
285             int loadFlag,
286             JahiaUser user)
287             throws JahiaException;
288
289     /**
290      * Return an enumeration holding all the child PAGE(!) of the specified page.
291      * This method checks the rights for a user and loads only the pages a user
292      * is allowed to see.
293      *
294      * @param pageID The source page ID
295      * @param user A JahiaUser object for which to check the rights on the
296      * pages
297      * @param pageInfoFlag, if Archived, return all
298      * @param languageCode, if null, return all language
299      *
300      * @return a Vector of JahiaPage objects that are the childs of this
301      * page
302      *
303      * @throws JahiaException thrown in the case we have problems while loading
304      * data from the persistent storage
305      */

306     public abstract Vector JavaDoc getDirectContentPageChilds (int pageID,
307         JahiaUser user,
308                                                        int pageInfosFlag, String JavaDoc languageCode)
309             throws JahiaException;
310
311     /**
312      * Return an enumeration holding all the child PAGE(!) of the specified page.
313      * This method checks the rights for a user and loads only the pages a user
314      * is allowed to see.
315      *
316      * @param pageID The source page ID
317      * @param user A JahiaUser object for which to check the rights on the
318      * pages
319      * @param pageInfoFlag, if Archived, return all
320      * @param languageCode, if null, return all language
321      * @param directPageOnly, sould we return only direct page or not
322      *
323      * @return a Vector of JahiaPage objects that are the childs of this
324      * page
325      *
326      * @throws JahiaException thrown in the case we have problems while loading
327      * data from the persistent storage
328      */

329     public abstract Vector JavaDoc getContentPageChilds (int pageID, JahiaUser user,
330                                                  int pageInfosFlag,
331                                                  String JavaDoc languageCode,
332                                                  boolean directPageOnly)
333             throws JahiaException;
334
335     /**
336      * An implementation that support versioning !
337      *
338      * if pageInfosFlag is ContentPage.ACTIVE_PAGE_INFOS,
339      * returns active child pages only
340      *
341      * if pageInfosFlag is ContentPage.STAGING_PAGE_INFOS,
342      * returns staging and child pages ( returns pages that are marked for delete too )
343      *
344      * if pageInfosFlag is ContentPage.ARCHIVED_PAGE_INFOS,
345      * returns child pages ( returns pages that are active or deleted too )
346      *
347      * if pageInfosFlag is ContentPage.ACTIVE_PAGE_INFOS & ContentPage.STAGING_PAGE_INFOS,
348      * returns child pages ( returns pages that are active or deleted or only staged )
349      *
350      * Return an enumeration holding all the child PAGE(!) of the specified page.
351      * This method checks the rights for a user and loads only the pages a user
352      * is allowed to see.
353      *
354      * @param pageID the source page ID
355      * @param user a <code>JahiaUser</code> reference for which to check
356      * the rights on the
357      * pages
358      * @param pageInfosFlag if Archived, return all
359      * @param languageCode if <code>null</code>, return all language
360      * @param versionId used only if pageInfosFlag = ContentPage.ARCHIVED_PAGE_INFOS
361      * @param directPageOnly sould we return only direct page or not
362      * @return a Vector of JahiaPage objects that are the childs of this page
363      * @throws JahiaException thrown in the case we have problems while loading data from the persistent storage
364      */

365     public abstract Vector JavaDoc getContentPageChilds (int pageID,
366                                         JahiaUser user,
367                                         int pageInfosFlag,
368                                         String JavaDoc languageCode,
369                                         int versionId,
370                                         boolean directPageOnly) throws JahiaException;
371
372     /**
373      * Should be used in place of getPagePath , use ContentPage instead of JahiaPage
374      *
375      * @param pageID
376      * @param loadRequest
377      * @param opMode
378      * @param user
379      *
380      * @return
381      *
382      * @throws JahiaException
383      */

384     public abstract Vector JavaDoc getContentPagePath (int pageID,
385                                                EntryLoadRequest loadRequest,
386                                                String JavaDoc opMode, JahiaUser user)
387             throws JahiaException;
388
389     //-------------------------------------------------------------------------
390
/**
391      * Return the page path. The page path consist of all the parent pages of
392      * the specified page until the site's root page.
393      *
394      * @param pageID The page id
395      * @param jParam Jahia parameter reference. Specify null if to
396      * page context is needed.
397      *
398      * @return Return a valid Vector of JahiaPage objects defining the path.
399      * The first element will be the root page, and the specified
400      * page will be the last element in the Vector. In case the
401      * specified page is the root page, only this page will be
402      * present in the Vector.
403      *
404      * @throws JahiaException Return this exception if any failure occured.
405      * @deprecated used getContentPagePath
406      */

407     public abstract Vector JavaDoc getPagePath (int pageID, ParamBean jParams)
408             throws JahiaException;
409
410     public abstract Vector JavaDoc getPagePath (int pageID,
411                                         EntryLoadRequest loadRequest,
412                                         String JavaDoc opMode, JahiaUser user)
413             throws JahiaException;
414
415     /**
416      * Vector of contentPagePath
417      *
418      * @param pageID
419      * @param jParams
420      *
421      * @return
422      *
423      * @throws JahiaException
424      */

425     public abstract Vector JavaDoc getContentPagePath (int pageID, ParamBean jParams)
426             throws JahiaException;
427
428     //-------------------------------------------------------------------------
429
/**
430      * Return a list of pages pointing on the specified page. Pages can hold
431      * the context information if needed.
432      *
433      * @param pageID the page ID on which the pages should point to.
434      * @param jParam Jahia parameter reference. Specify null if to
435      * page context is needed.
436      *
437      * @return Return Vector of page objects
438      *
439      * @throws JahiaException Return this exception if any failure occured.
440      */

441     public abstract Vector JavaDoc getPagesPointingOnPage (int pageID, ParamBean jParam)
442             throws JahiaException;
443
444     /**
445      * Return a list of pages pointing on the specified page.
446      *
447      * @param pageID the page ID on which the pages should point to.
448      * @param loadRequest the load request for which to load the pages.
449      *
450      * @return Return Vector of page objects
451      *
452      * @throws JahiaException Return this exception if any failure occured.
453      */

454     public abstract Vector JavaDoc getPagesPointingOnPage (int pageID,
455                                                    EntryLoadRequest loadRequest)
456             throws JahiaException;
457
458     //-------------------------------------------------------------------------
459
/**
460      * Gets complete subtree under page.
461      *
462      * @param pageID Page unique identification number.
463      * @param loadFlag Mask of page types to be loaded. See
464      * {@link org.jahia.services.pages.PageLoadFlags PageLoadFlags}
465      * class constants for more informaion.
466      * @param jParam Jahia parameters. This parameter can be set to null in case no
467      * dynamic context is needed.
468      *
469      * @return Return a Vector of JahiaPage objects
470      *
471      * @throws JahiaException Return this exception if any failure occured.
472      */

473     public abstract Vector JavaDoc getPageSubTree (
474             int pageID,
475             int loadFlag,
476             ParamBean jParam)
477             throws JahiaException;
478
479     //-------------------------------------------------------------------------
480
/**
481      * Try to find the specified page. Create a new JahiaPage object, in
482      * which will be included a reference to the raw page info, a reference
483      * to the page definition associated to the page, a reference to the page's
484      * ACL object and finally a reference to the current Jahia parameters.
485      *
486      * @param pageID The ID of the page to be looked up.
487      * @param jParam Jahia parameters.
488      *
489      * @return Return a valid instance of a JahiaPage class. If the page does
490      * not exist, or any of its content is unavailable (ACL, page
491      * definition) then an exception will be thrown.
492      *
493      * @throws JahiaException Throws this exception if any error occured in the lookup process.
494      * @throws JahiaPageNotFoundException Throws this exception when the page could not be found in the
495      * database.
496      */

497     public abstract JahiaPage lookupPage (int pageID, ParamBean jParam)
498             throws JahiaException,
499             JahiaPageNotFoundException,
500             JahiaTemplateNotFoundException;
501
502     /**
503      *
504      * @param pageID int
505      * @param loadRequest EntryLoadRequest
506      * @param withTemplates boolean
507      * @return JahiaPage
508      * @throws JahiaException
509      * @throws JahiaPageNotFoundException
510      * @throws JahiaTemplateNotFoundException
511      * @deprecated, use lookupPage (int pageID, EntryLoadRequest loadRequest,
512                                  JahiaUser user, boolean withTemplates) instead, otherwize this is the site's default guest user that is used for permission access
513      */

514     public abstract JahiaPage lookupPage (int pageID, EntryLoadRequest loadRequest,
515                                  boolean withTemplates)
516         throws JahiaException,
517         JahiaPageNotFoundException,
518         JahiaTemplateNotFoundException;
519
520     /**
521      *
522      * @param pageID int
523      * @param loadRequest EntryLoadRequest
524      * @param user JahiaUser
525      * @return JahiaPage
526      */

527     public abstract JahiaPage lookupPage(int pageID,
528                                      EntryLoadRequest loadRequest,
529                                      JahiaUser user,
530                                      boolean withTemplates) throws
531         JahiaException,
532         JahiaPageNotFoundException,
533         JahiaTemplateNotFoundException;
534
535     /**
536      *
537      * @param pageID int
538      * @param loadRequest EntryLoadRequest
539      * @return JahiaPage
540      * @throws JahiaException
541      * @throws JahiaPageNotFoundException
542      * @throws JahiaTemplateNotFoundException
543      * @deprecated, use lookupPage (int pageID, EntryLoadRequest loadRequest, JahiaUser user) instead, otherwize this is the site's default guest user that is used for permission access
544      */

545     public abstract JahiaPage lookupPage (int pageID,
546                                           EntryLoadRequest loadRequest)
547             throws JahiaException,
548             JahiaPageNotFoundException,
549             JahiaTemplateNotFoundException;
550
551     /**
552      *
553      * @param pageID int
554      * @param loadRequest EntryLoadRequest
555      * @return JahiaPage
556      * @throws JahiaException
557      * @throws JahiaPageNotFoundException
558      * @throws JahiaTemplateNotFoundException
559      * @deprecated, use lookupPage (int pageID, EntryLoadRequest loadRequest, JahiaUser user) instead, otherwize this is the site's default guest user that is used for permission access
560      */

561     public abstract JahiaPage lookupPage (int pageID,
562                                           EntryLoadRequest loadRequest,
563                                           JahiaUser user)
564             throws JahiaException,
565             JahiaPageNotFoundException,
566             JahiaTemplateNotFoundException;
567
568     public abstract JahiaPage lookupPage (int pageID,
569                                           EntryLoadRequest loadRequest,
570                                           String JavaDoc operationMode,
571                                           JahiaUser user,
572                                           boolean withTemplates)
573             throws JahiaException,
574             JahiaPageNotFoundException,
575             JahiaTemplateNotFoundException;
576
577     /**
578      * Retrieves the page content object, that represents all the page versions
579      * both active and staging. This object also contains all the multiple
580      * language version of a page.
581      *
582      * @param pageID the identifier of the page to load.
583      * @param withTemplates specifies whether page templates should be also
584      * loaded or not.
585      *
586      * @return a ContentPage object.
587      *
588      * @throws JahiaException
589      * @throws JahiaPageNotFoundException
590      * @throws JahiaTemplateNotFoundException
591      */

592     public abstract ContentPage lookupContentPage (int pageID,
593         boolean withTemplates)
594             throws JahiaException,
595             JahiaPageNotFoundException,
596             JahiaTemplateNotFoundException;
597
598     /**
599      * Retrieves the page content object, that represents all the page versions
600      * both active and staging. This object also contains all the multiple
601      * language version of a page.
602      *
603      * @param pageID the identifier of the page to load.
604      * @param withTemplates specifies whether page templates should be also
605      * loaded or not.
606      * @param bypassCache false if page can be read from cache
607      *
608      * @return a ContentPage object.
609      *
610      * @throws JahiaException
611      * @throws JahiaPageNotFoundException
612      * @throws JahiaTemplateNotFoundException
613      */

614     public abstract ContentPage lookupContentPage (int pageID,
615         boolean withTemplates, boolean bypassCache)
616             throws JahiaException,
617             JahiaPageNotFoundException,
618             JahiaTemplateNotFoundException;
619     
620     /**
621      * Retrieves the page content object, that represents all the page versions
622      * both active and staging. This object also contains all the multiple
623      * language version of a page.
624      *
625      * @param pageID the identifier of the page to load.
626      * @param loadRequest specifies the EntryLoadRequest to specify which
627      * contains the entry to be loaded, such as deleted, versioned (with
628      * version ID, etc...)
629      * @param withTemplates specifies whether page templates should be also
630      * loaded or not.
631      *
632      * @return a ContentPage object.
633      *
634      * @throws JahiaException
635      * @throws JahiaPageNotFoundException
636      * @throws JahiaTemplateNotFoundException
637      */

638     public abstract ContentPage lookupContentPage (int pageID,
639                                                    EntryLoadRequest loadRequest,
640                                                    boolean withTemplates)
641             throws JahiaException,
642             JahiaPageNotFoundException,
643             JahiaTemplateNotFoundException;
644
645     //-------------------------------------------------------------------------
646
/**
647      * Try to find the specified page. Create a new JahiaPage object, in
648      * which will be included a reference to the raw page info, a reference
649      * to the page definition associated to the page, a reference to the page's
650      * ACL object and finally a reference to the current Jahia parameters.
651      *
652      * @param pageID The ID of the page to be looked up.
653      *
654      * @return Return a valid instance of a JahiaPage class. If the page does
655      * not exist, or any of its content is unavailable (ACL, page
656      * definition) then an exception will be thrown.
657      *
658      * @throws JahiaException Throws this exception if any error occured in the lookup process.
659      * @throws JahiaPageNotFoundException Throws this exception when the page could not be found in the
660      * database.
661      */

662
663     public abstract JahiaPage lookupPage (int pageID)
664             throws JahiaException,
665             JahiaPageNotFoundException,
666             JahiaTemplateNotFoundException;
667
668     //-------------------------------------------------------------------------
669
/**
670      * return a copy (clone) of the jahia page.
671      * all the page content and the acl are cloned too.
672      *
673      * @param newParentID int parentID of the cloned page
674      * if -1, newParentID = parentID of the page to clone.
675      * @param pageToClone JahiaPage the page to clone.
676      *
677      * @return return a JahiaPage which is the clone of the page in parameter.
678      */

679     public abstract JahiaPage clonePage (int newParentID,
680                                          int newParentAclID,
681                                          JahiaPage pageToClone,
682                                          ParamBean jParam,
683                                          boolean childrenCloned)
684             throws JahiaException;
685
686     //-------------------------------------------------------------------------
687
/**
688      * Return the number of pages in the database.
689      *
690      * @return Return the number of pages.
691      */

692     public abstract int getNbPages ()
693             throws JahiaException;
694
695     //-------------------------------------------------------------------------
696
/**
697      * Return the number of pages in the database.
698      *
699      * @return Return the number of pages.
700      */

701     public abstract int getNbPages (int siteID)
702             throws JahiaException;
703
704     //-------------------------------------------------------------------------
705
/**
706      * Return the number of pages in the database.
707      *
708      * @return Return the number of pages.
709      */

710     public abstract int getRealActiveNbPages ()
711             throws JahiaException;
712
713     //-------------------------------------------------------------------------
714
/**
715      * Return the number of pages in the database.
716      *
717      * @return Return the number of pages.
718      */

719     public abstract int getRealActiveNbPages (int siteID)
720             throws JahiaException;
721
722     //--------------------------------------------------------------------------
723
/**
724      * returns a DOM representation of all pages of a site
725      *
726      * @param int siteID
727      *
728      * @auhtor NK
729      */

730     public abstract JahiaDOMObject getPagesAsDOM (int siteID)
731             throws JahiaException;
732
733     //--------------------------------------------------------------------------
734
/**
735      * Returns a vector of all Acl ID used by pages for a site
736      * Need this for site extraction
737      *
738      * @param int siteID
739      *
740      * @auhtor NK
741      */

742     public abstract Vector JavaDoc getAclIDs (int siteID)
743             throws JahiaException;
744
745     /**
746      * Invalidate all page related cache info in this service
747      *
748      * @param pageID the identifier of the page for which to flush all page
749      * cached-info.
750      */

751     public abstract void invalidatePageCache (int pageID);
752
753     /**
754      * Return the map containing the page's properties
755      *
756      * @param pageID
757      *
758      * @return
759      */

760     public abstract Map JavaDoc getPageProperties (int pageID)
761             throws JahiaException;
762
763     /**
764      * Looks up PageProperties by using the value. This is useful when we have
765      * unique values and we want to lookup a page by a property value.
766      * @param propertyValue String the value used to search the properties
767      * @throws JahiaException thrown in case there was a problem communicating
768      * with the database.
769      * @return ArrayList returns a list of PageProperty objects that contain
770      * the search value.
771      */

772     public abstract ArrayList JavaDoc getPagePropertiesByValue (String JavaDoc propertyValue)
773         throws JahiaException;
774     
775     /**
776      * Retrieve a page ID from its key and site ID.
777      * @param pageKey
778      * @param siteValue
779      * @return
780      * @throws JahiaException
781      */

782     public abstract int getPageIDFromPageKeyAndSiteID( String JavaDoc pageKey, int siteValue )throws JahiaException;
783     
784     /**
785      * Check for page url key uniqueness.
786      * @param key
787      * @param siteID
788      * @param currentPageID
789      * @return true if given key is already used in supplied site ID.
790      * @throws JahiaException
791      */

792     public abstract boolean isKeyAlreadyUsedInSiteWithID( String JavaDoc key, int siteID, int currentPageID )
793         throws JahiaException;
794
795     /**
796      * Update the ContentPage cache so that clusters are informed of the
797      * changes.
798      * @param contentPage ContentPage
799      */

800     public abstract void updateContentPageCache(ContentPage contentPage);
801
802     /**
803      * sort pages child first
804      *
805      * @param pageIDs List list of pageIDs
806      * @throws JahiaException
807      * @return Vector
808      */

809     public abstract Vector JavaDoc sortPages(List JavaDoc pageIDs, EntryLoadRequest loadRequest,
810                             JahiaUser user, String JavaDoc operationMode)
811     throws JahiaException;
812
813     /**
814      * Tests fields to know if they are ready for an activation process,
815          * generating either warnings (such as a depending page not being validated)
816      * or errors (such as a mandatory language missing)
817      *
818      * @param pageID
819      * @param user
820      * @param saveVersion
821      * @param jParams
822      * @param stateModifContext
823      *
824      * @return test results
825      *
826      * @throws JahiaException
827      */

828     public abstract ActivationTestResults arePageFieldsValidForActivation (
829         Set JavaDoc languageCodes,
830         int pageID,
831         JahiaUser user,
832         JahiaSaveVersion saveVersion,
833         ParamBean jParams,
834         StateModificationContext stateModifContext)
835         throws JahiaException;
836 }
837
Popular Tags