KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > services > containers > JahiaContainersService


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.containers;
14
15 import java.io.IOException JavaDoc;
16 import java.util.Hashtable JavaDoc;
17 import java.util.Map JavaDoc;
18 import java.util.Properties JavaDoc;
19 import java.util.Set JavaDoc;
20 import java.util.SortedSet JavaDoc;
21 import java.util.Vector JavaDoc;
22
23 import org.jahia.data.JahiaDOMObject;
24 import org.jahia.data.JahiaData;
25 import org.jahia.data.containers.JahiaContainer;
26 import org.jahia.data.containers.JahiaContainerDefinition;
27 import org.jahia.data.containers.JahiaContainerList;
28 import org.jahia.data.containers.JahiaContainerSet;
29 import org.jahia.exceptions.JahiaException;
30 import org.jahia.params.ParamBean;
31 import org.jahia.services.JahiaService;
32 import org.jahia.services.pages.ContentPage;
33 import org.jahia.services.usermanager.JahiaUser;
34 import org.jahia.services.version.ActivationTestResults;
35 import org.jahia.services.version.EntryLoadRequest;
36 import org.jahia.services.version.JahiaSaveVersion;
37 import org.jahia.services.version.StateModificationContext;
38 import org.jahia.utils.xml.XMLSerializationOptions;
39 import org.jahia.utils.xml.XmlWriter;
40
41 public abstract class JahiaContainersService extends JahiaService {
42
43     /**
44      * Create a clone of the container list and all its contents (containers)
45      *
46      * @param cListID The containerList to clone
47      * @param newPageID The Id of the new page to which the cloned containerList must
48      * belong to.
49          * @param parentEntryID The id of the container which contains this containerList
50      * egal 0, if the containerList is in a page.
51      */

52     public abstract void cloneContainerList (int cListID, int newPageID,
53                                              int parentAclID,
54                                              boolean childrenCloned)
55         throws JahiaException;
56
57     /**
58      * Create a clone of the container list and all its contents (containers)
59      *
60      * @param cListID The containerList to clone
61      * @param newPageID The Id of the new page to which the cloned containerList must
62      * belong to.
63          * @param parentEntryID The id of the container which contains this containerList
64      * egal 0, if the containerList is in a page.
65      */

66     public abstract JahiaContainerList cloneContainerList (int cListID,
67         int newPageID, int parentEntryID, int parentAclID,
68         boolean childrenCloned)
69         throws JahiaException;
70
71     /**
72      * Create a clone of the container and all its contents (fields and containerList)
73      *
74      * @param theContainer The container to clone
75      * @param newPageID The Id of the new page to which the cloned containerList must
76      * belong to.
77      * @param newCListID The id of the container list which contains this container.
78      */

79     public abstract JahiaContainer cloneContainer (JahiaContainer theContainer,
80         int newCListID, int newPageID,
81         int parentAclID,
82         boolean childrenCloned)
83         throws JahiaException;
84
85     /**
86      * builds the complete container structure for a specific page
87      * builds the complete container structure (containerlists->containers->fields/containerlists)
88      * for a specific page
89      * DO NOT CACHE THIS METHOD (it depends on other caches values) !!
90      *
91      * @param jData JahiaData
92      *
93      * @return a Vector of containerlist IDs
94      */

95     public abstract JahiaContainerSet buildContainerStructureForPage (JahiaData
96         jData, EntryLoadRequest loadVersion)
97         throws JahiaException;
98
99     /**
100      * gets all container definitions ids on a page
101      *
102      * @param thePage the page object
103      *
104      * @return a Vector of container definition IDs
105      */

106     public abstract Vector JavaDoc getctndefidsInPage (ContentPage contentPage,
107                                                EntryLoadRequest
108                                                entryLoadRequest)
109         throws JahiaException;
110
111     /**
112      * gets all container list ids on a page, by their definition id
113      *
114      * @param pageID the page id
115      * @param defID the container definition id
116      *
117      * @return a Vector of containerlist IDs
118      */

119     public abstract Vector JavaDoc getContainerListIDs (int pageID, int defID,
120                                                 EntryLoadRequest loadVersion)
121         throws JahiaException;
122
123     /**
124      * gets all container list ids on a page
125      *
126      * @param pageID the page id
127      * @param defID the container definition id
128      *
129      * @return a Vector of containerlist IDs
130      */

131     public abstract Vector JavaDoc getContainerListIDsInPage (ContentPage
132         contentPage, EntryLoadRequest entryLoadRequest)
133         throws JahiaException;
134
135     /**
136      * Retrieves all the entry states for the container lists in a pages.
137      * This is a recursive operation that will trickle down to all the sub
138      * content.
139      *
140      * @param pageID the page for which to retrieve the entry states.
141      *
142      * @return a SortedSet of ContentFieldEntryStates of all the subcontent
143      * that we have processed
144      *
145      * @throws JahiaException thrown if there was an error communicating with
146      * the database.
147      */

148     public abstract SortedSet JavaDoc getContainerListInPageEntryStates (int pageID)
149         throws JahiaException;
150
151     /**
152      * gets all container ids for a given entryLoadRequest
153      *
154      * @param loadVersion
155      *
156      * @return
157      *
158      * @throws JahiaException
159      */

160     public abstract Vector JavaDoc getCtnIds (EntryLoadRequest loadVersion)
161         throws JahiaException;
162
163     /**
164      * gets all container ids in a container list
165      *
166      * @param listID the container list id
167      *
168      * @return a Vector of container IDs
169      */

170     public abstract Vector JavaDoc getctnidsInList (int listID,
171                                             EntryLoadRequest loadVersion)
172         throws JahiaException;
173
174     public abstract Vector JavaDoc getctnidsInList (int listID)
175         throws JahiaException;
176
177     /**
178          * Gets all container ids in a container list with ordering on a given field.
179      * If the fieldName is null, not ordering applied
180      *
181      * @param int listID the container list id
182      * @param String fieldName the fieldname on which to filter
183      * @param boolean asc Asc. or desc. ordering ( true = asc )
184      *
185      * @return a Vector of container IDs
186      *
187      * @todo we might want to cache these values in memory in order to
188      * improve performance.
189      * @author NK
190      */

191     public abstract Vector JavaDoc getctnidsInList (int listID, String JavaDoc fieldName,
192                                             boolean asc,
193                                             EntryLoadRequest loadVersion)
194         throws JahiaException;
195
196     /**
197      * gets all container ids for a given site. This list uses stored
198      * ranks to order its values
199      *
200      * @param int siteID, the given site id.
201      *
202      * @return Vector a vector of container IDs
203      */

204     public abstract Vector JavaDoc getCtnIds (int siteID)
205         throws JahiaException;
206
207     /**
208      * gets all container ids of the system.
209      *
210      * @return Vector a vector of container IDs
211      */

212     public abstract Vector JavaDoc getCtnIds ()
213         throws JahiaException;
214
215     /**
216     *
217     * @param orderByRanking if true, order by container ranking
218     * @return
219     * @throws JahiaException
220     */

221    public abstract Vector JavaDoc getCtnIds(boolean orderByRanking)
222        throws JahiaException;
223     
224     
225     /**
226      * gets all container list ids in a container.
227      *
228      * @param listID the container list id
229      *
230      * @return a Vector of container IDs
231      *
232      * @todo we might want to cache these values in memory in order to
233      * improve performance.
234      */

235     public abstract Vector JavaDoc getCtnListIDsInContainer (int ctnID)
236         throws JahiaException;
237
238     /**
239      * gets all field ids in a container
240      *
241      * @param ctnid the container id
242      *
243      * @return a Vector of field IDs
244      */

245     public abstract Vector JavaDoc getFieldIDsInContainer (int ctnid)
246         throws JahiaException;
247
248     /**
249      * gets all field ids in a container
250      *
251      * @param ctnid the container id
252      *
253      * @return a Vector of field IDs
254      */

255     public abstract Vector JavaDoc getFieldIDsInContainer (int ctnid,
256         EntryLoadRequest loadVersion)
257         throws JahiaException;
258
259     public abstract Map JavaDoc getFieldIDsAndDefsInContainer(int ctnid,
260             EntryLoadRequest loadVersion) throws JahiaException;
261     
262     /**
263      * gets a container list id by its container list name and page id
264      *
265      * @param containerName the container name
266      * @param pageID the page ID
267      *
268      * @return a Vector of field IDs
269      */

270     public abstract int getContainerListID (String JavaDoc containerName, int pageID)
271         throws JahiaException;
272
273     /**
274      * gets all container definition ids in Jahia
275      *
276      * @return a Vector of container definition IDs
277      */

278     public abstract Vector JavaDoc getAllContainerDefinitionIDs ()
279         throws JahiaException;
280
281     /**
282      * loads a container info, by its container id
283      *
284      * @param ctnid the container id
285      *
286      * @return a JahiaContainer object, without field values
287      *
288      * @see org.jahia.data.containers.JahiaContainer
289      */

290     public abstract JahiaContainer loadContainerInfo (int ctnid)
291         throws JahiaException;
292
293     public abstract JahiaContainer loadContainerInfo (int ctnid,
294         EntryLoadRequest loadVersion)
295         throws JahiaException;
296
297     /**
298      * loads a container by its container id
299      * loads a container info and fields by its container id, but not dependant containerlists
300      * this method cannot load request-specific values (i.e. applications);
301      * see the loadContainer( ctnid, loadFlag, jParams) for that.
302      * DO NOT CACHE THIS METHOD (it depends on other caches values) !!
303      *
304      * @param ctnid the container id
305      * @param loadFlag the loadFlag
306      *
307      * @see org.jahia.data.containers.JahiaContainer
308      * @see org.jahia.data.fields.LoadFlags
309      */

310     public abstract JahiaContainer loadContainer (int ctnid, int loadFlag)
311         throws JahiaException;
312
313     /**
314      * loads a container by its container id
315      * loads a container info and fields by its container id, but not dependant containerlists
316      * this method can load request-specific values (i.e. applications);
317      * DO NOT CACHE THIS METHOD (it depends on other caches values) !!
318      *
319      * @param ctnid the container id
320      * @param loadFlag the loadFlag
321      * @param jParams the ParamBean object, containing request and response
322      *
323      * @see org.jahia.data.containers.JahiaContainer
324      * @see org.jahia.data.fields.LoadFlags
325      */

326     public abstract JahiaContainer loadContainer (int ctnid, int loadFlag,
327                                                   ParamBean jParams)
328         throws JahiaException;
329
330     public abstract JahiaContainer loadContainer (int ctnid, int loadFlag,
331                                                   ParamBean jParams,
332                                                   EntryLoadRequest loadVersion)
333         throws JahiaException;
334
335
336     /**
337      *
338      * @param ctnid
339      * @param loadFlag
340      * @param jParams
341      * @param loadVersion
342      * @param cachedFieldsInContainer
343      * @return
344      * @throws JahiaException
345      */

346     // the hashtable cachedFieldsInContainer is here if we already have a hashtable
347
// with containerID as key, and a Vector of fieldIDs in object, see buildContainerStructure.
348
public abstract JahiaContainer loadContainer (int ctnid, int loadFlag,
349                                          ParamBean jParams,
350                                          EntryLoadRequest loadVersion,
351                                          Hashtable JavaDoc cachedFieldsInContainer,
352                                          Hashtable JavaDoc cachedContainersFromContainerLists,
353                                          Hashtable JavaDoc cachedContainerListsFromContainers)
354         throws JahiaException;
355
356
357     /**
358      * saves the container info
359      * saves the container info
360      * if id=0, assigns a new id to container and creates it in datasource
361          * if listid=0, assigns a new listid to container and creates it in datasource
362      *
363      * @param theContainer a JahiaContainer object
364      * @param parentID parent container id
365      * @param parentAclID the Acl parent ID
366      *
367      * @param jParams the current ParamBean
368      * @see org.jahia.data.containers.JahiaContainer
369      */

370     public abstract void saveContainerInfo (JahiaContainer theContainer,
371                                             int parentID,
372                                             int parentAclID,
373                                             ParamBean jParams)
374         throws JahiaException;
375
376     /**
377      * saves the container info and fields
378          * saves the container info and fields, but not the dependant container lists
379      * if id=0, assigns a new id to container and creates it in datasource
380          * if listid=0, assigns a new listid to container and creates it in datasource
381      *
382      * @param theContainer a JahiaContainer object
383      *
384      * @see org.jahia.data.containers.JahiaContainer
385      */

386     public abstract void saveContainer (JahiaContainer theContainer,
387                                         int containerParentID,
388                                         ParamBean jParams)
389         throws JahiaException;
390
391     /**
392      * deletes the container info, fields and sublists
393      * deletes the container info, fields and sublists
394      *
395      * @param ctnid the container id
396      * @param jParams the request parameters
397      *
398      * @see org.jahia.data.containers.JahiaContainer
399      * @deprecated use markContainerLanguageForDeletion instead
400      */

401     public abstract void deleteContainer (int ctnid, ParamBean jParams)
402         throws JahiaException;
403
404     /**
405      * Checks if a container is valid for activation, by checking the container
406      * info data as well as going down into the field. This may fail
407      * completely in the case where some of the fields don't match a mandatory
408      * criteria such as mandatory language values. A container will also not
409          * be valid for activation if any of it's fields is not valid for activation,
410      * guaranteeing integrity of the container.
411      *
412      * @param id the identifier of the container to activate.
413      * @param user the user who is requesting the activation
414      * @param saveVersion contains the version ID to use for the activation as
415      * well as versioning capability of this Jahia site
416          * @param jParams a ParamBean object mostly used to pass to the fields so
417      * they can use it for getting the current site information, current user,
418      * etc...
419      * @param withSubPages specifies whether subPages should be tested for
420      * activation validity also. If no, a page field contained in this
421      * container might fail.
422      *
423      * @return an ActivationTestResults objet containing a status, warnings
424          * and errors related to the activation validity of all the sub objects.
425      *
426      * @throws JahiaException thrown if there were errors accessing the
427      * content while processing the validity tests.
428      */

429     public abstract ActivationTestResults isContainerValidForActivation (
430         Set JavaDoc languageCodes,
431         int id, JahiaUser user, JahiaSaveVersion saveVersion,
432         ParamBean jParams, StateModificationContext stateModifContext)
433         throws JahiaException;
434
435     /**
436      * Tries to activate a container. Note that this method supposes you have
437      * validated all the fields it contains beforehand. All it does is check
438      * that the fields are ready for activation, by checking the container
439      * info data as well as going down into the field. This may fail
440      * completely in the case where some of the fields don't match a mandatory
441      * criteria such as mandatory language values. A container will also not
442          * be valid for activation if any of it's fields is not valid for activation,
443      * guaranteeing integrity of the container.
444      *
445      * @param id the identifier of the container to activate.
446      * @param user the user who is requesting the activation
447          * @param saveVersion contains the version ID to use for the activation as
448          * well as versioning capability of this Jahia site
449      * @param jParams a ParamBean object mostly used to pass to the fields so
450      * they can use it for getting the current site information, current user,
451      * etc...
452      * @param stateModifContext contains the current context of the activation,
453      * including the current tree path stack and options that indicate how
454      * the activation should be processed such as whether to recursively descend
455      * in sub pages.
456      *
457      * @return an ActivationTestResults objet containing a status, warnings
458          * and errors related to the activation validity of all the sub objects.
459      *
460      * @throws JahiaException thrown if there were errors accessing the
461      * content while processing the validity tests.
462      */

463     public abstract ActivationTestResults activateStagedContainer (
464         Set JavaDoc languageCodes,
465         int id, JahiaUser user, JahiaSaveVersion saveVersion,
466         ParamBean jParams, StateModificationContext stateModifContext)
467         throws JahiaException;
468
469     /**
470      * Validate the containers of the page to which the user has admin AND write access
471      * i.e. now Staged containers are Active.
472      *
473      * @param saveVersion it must contain the right versionID and staging/versioning
474      * info of the current site
475      * @param stateModifContext contains the current context of the activation,
476      * including the current tree path stack and options that indicate how
477      * the activation should be processed such as whether to recursively descend
478      * in sub pages.
479      *
480      * @return true if all the containers were successfully validated
481      */

482     public abstract ActivationTestResults activateStagedContainers (
483         Set JavaDoc languageCodes,
484         int pageID, JahiaUser user, JahiaSaveVersion saveVersion,
485         ParamBean jParams, StateModificationContext stateModifContext)
486         throws JahiaException;
487
488     /**
489      * Validate the container lists of the page to which the user has admin AND write access
490      * i.e. now Staged container lists are Active.
491      *
492      * @param saveVersion it must contain the right versionID and staging/versioning
493      * info of the current site
494      * @param stateModifContext contains the current context of the activation,
495      * including the current tree path stack and options that indicate how
496      * the activation should be processed such as whether to recursively descend
497      * in sub pages.
498      *
499      * @return true if the container list and it's content where sucessfully validated
500      */

501     public abstract ActivationTestResults activateStagedContainerLists (
502         Set JavaDoc languageCodes,
503         int pageID, JahiaUser user,
504         JahiaSaveVersion saveVersion,
505         StateModificationContext stateModifContext)
506         throws JahiaException;
507
508     /**
509      * @param languageCodes
510      * @param pageID
511      * @param user
512      * @param saveVersion
513      * @param jParams
514      * @param stateModifContext contains the current context of the activation,
515      * including the current tree path stack and options that indicate how
516      * the activation should be processed such as whether to recursively descend
517      * in sub pages.
518      *
519      * @return
520      *
521      * @throws JahiaException
522      */

523     public abstract ActivationTestResults areContainersValidForActivation (
524         Set JavaDoc languageCodes,
525         int pageID,
526         JahiaUser user,
527         JahiaSaveVersion saveVersion,
528         ParamBean jParams,
529         StateModificationContext stateModifContext)
530         throws JahiaException;
531
532     /**
533      * @param languageCodes
534      * @param pageID
535      * @param user
536      * @param saveVersion
537      * @param stateModifContext contains the current context of the activation,
538      * including the current tree path stack and options that indicate how
539      * the activation should be processed such as whether to recursively descend
540      * in sub pages.
541      *
542      * @return
543      *
544      * @throws JahiaException
545      */

546     public abstract ActivationTestResults areContainerListsValidForActivation (
547         Set JavaDoc languageCodes,
548         int pageID,
549         JahiaUser user,
550         JahiaSaveVersion saveVersion,
551         StateModificationContext stateModifContext)
552         throws JahiaException;
553
554     /**
555      * loads a container list info
556      * loads container list info, but not dependant fields and container lists
557      *
558      * @param containerListID the container list id
559      *
560      * @see org.jahia.data.containers.JahiaContainerList
561      */

562     public abstract JahiaContainerList loadContainerListInfo (int
563         containerListID)
564         throws JahiaException;
565
566     public abstract JahiaContainerList loadContainerListInfo (int
567         containerListID, EntryLoadRequest loadVersion)
568         throws JahiaException;
569
570     /**
571      * loads a container list
572          * loads container list info and containers, but not dependant container lists
573      * this method cannot load request-specific values (i.e. applications);
574      * see the loadContainerList( containerListID, loadFlag, jParams) for that.
575      * DO NOT CACHE THIS METHOD (it depends on other caches values) !!
576      *
577      * @param containerListID the container list id
578      * @param loadFlag the loadFlag
579      *
580      * @see org.jahia.data.containers.JahiaContainerList
581      * @see org.jahia.data.fields.LoadFlags
582      */

583     public abstract JahiaContainerList loadContainerList (int containerListID,
584         int loadFlag)
585         throws JahiaException;
586
587     /**
588      * loads a container list
589          * loads container list info and containers, but not dependant container lists
590      * this method can load request-specific values (i.e. applications)
591      * DO NOT CACHE THIS METHOD (it depends on other caches values) !!
592      *
593      * @param containerListID the container list id
594      * @param loadFlag the loadFlag
595          * @param jParams the ParamBean object, containing request and response
596      *
597      * @see org.jahia.data.containers.JahiaContainerList
598      * @see org.jahia.data.fields.LoadFlags
599      */

600     public abstract JahiaContainerList loadContainerList (int containerListID,
601         int loadFlag, ParamBean jParams)
602         throws JahiaException;
603
604     /**
605      * Loads a set of containers for a given container list
606      * Loads container list info and all containers, but not dependant container lists
607      * this method can load request-specific values (i.e. applications).
608      * DO NOT CACHE THIS METHOD (it depends on other caches values) !!
609      *
610      * @param containerListID the container list id
611      * @param loadFlag the loadFlag
612          * @param jParams the ParamBean object, containing request and response
613      *
614      * @author NK
615      * @see org.jahia.data.containers.JahiaContainerList
616      * @see org.jahia.data.fields.LoadFlags
617      */

618     public abstract JahiaContainerList loadContainerList (int containerListID,
619         int loadFlag,
620         ParamBean jParams,
621         EntryLoadRequest loadVersion,
622         Hashtable JavaDoc cachedFieldsInContainer,
623         Hashtable JavaDoc cachedContainersFromContainerLists,
624         Hashtable JavaDoc cachedContainerListsFromContainers)
625         throws JahiaException;
626
627     /**
628      * Loads a set of containers for a given container list
629          * Loads container list info and containers, but not dependant container lists
630      * this method can load request-specific values (i.e. applications).
631      * DO NOT CACHE THIS METHOD (it depends on other caches values) !!
632      *
633      * @param containerListID the container list id
634      * @param Vector ctnids, vector of container ids to load.
635      * @param loadFlag the loadFlag
636          * @param jParams the ParamBean object, containing request and response
637      *
638      * @author NK
639      * @see org.jahia.data.containers.JahiaContainerList
640      * @see org.jahia.data.fields.LoadFlags
641      */

642     public abstract JahiaContainerList loadContainerList (int containerListID,
643         Vector JavaDoc ctnids,
644         int loadFlag,
645         ParamBean jParams,
646         EntryLoadRequest loadVersion,
647         Hashtable JavaDoc cachedFieldsInContainer,
648         Hashtable JavaDoc cachedContainersFromContainerLists,
649         Hashtable JavaDoc cachedContainerListsFromContainers)
650         throws JahiaException;
651
652     /**
653      * saves a container list info
654      * saves container list info, but not dependant fields and container lists
655          * if id=0, attributes a new id to container list and creates it in datasource
656      *
657      * @param theContainerList a JahiaContainerList object
658      * @param parentAclID the Acl parent ID
659      *
660      * @see org.jahia.data.containers.JahiaContainerList
661      */

662     public abstract void saveContainerListInfo (JahiaContainerList
663                                                 theContainerList,
664                                                 int parentAclID)
665         throws JahiaException;
666
667     /***
668      * deletes a container list info
669      * deletes a container list info, but not dependant containers
670      * see deleteContainerList for that
671      *
672      * @param listID the container list id to delete
673      *
674      */

675 // public abstract void deleteContainerListInfo( int listID )
676
// throws JahiaException;
677

678     /**
679      * deletes a container list info
680      * deletes a container list info, including dependant containers
681      * see deleteContainerList for that
682      *
683      * @param listID the container list id to delete
684      */

685     public abstract void deleteContainerList (int listID, ParamBean jParams)
686         throws JahiaException;
687
688     /**
689      * loads a container definition by its id
690      *
691      * @param definitionID the container definition id
692      *
693      * @return a JahiaContainerDefinition object
694      *
695      * @see org.jahia.data.containers.JahiaContainerDefinition
696      * @see org.jahia.data.containers.JahiaContainerStructure
697      */

698     public abstract JahiaContainerDefinition loadContainerDefinition (int
699         definitionID)
700         throws JahiaException;
701
702     /**
703      * Load a container definition by it's site ID and it's definition name
704      *
705          * @param siteID the site identifier on which to retrieve the definition
706      * @param definitionName the unique name for the definition
707      *
708      * @return a JahiaContainerDefinition if found
709      *
710      * @throws JahiaException in case there was a problem communicating with
711      * the database
712      */

713     public abstract JahiaContainerDefinition loadContainerDefinition (int
714         siteID,
715         String JavaDoc definitionName)
716         throws JahiaException;
717
718     /**
719      * saves a container definition
720          * if id=0, assigns a new id to the definition and creates it in the datasource
721      *
722      * @param theDefinition the JahiaContainerDefinition to save
723      *
724      * @see org.jahia.data.containers.JahiaContainerDefinition
725      * @see org.jahia.data.containers.JahiaContainerStructure
726      */

727     public abstract void saveContainerDefinition (JahiaContainerDefinition
728                                                   theDefinition)
729         throws JahiaException;
730
731     /**
732      * deletes a container definition
733      *
734      * @param theDefinition the JahiaContainerDefinition to delete
735      *
736      * @see org.jahia.data.containers.JahiaContainerDefinition
737      * @see org.jahia.data.containers.JahiaContainerStructure
738      */

739     public abstract void deleteContainerDefinition (int definitionID)
740         throws JahiaException;
741
742     //--------------------------------------------------------------------------
743
/**
744      * returns a DOM representation of all containers of a site
745      *
746      * @param int siteID
747      *
748      * @auhtor NK
749      */

750     public abstract JahiaDOMObject getContainersAsDOM (int siteID)
751         throws JahiaException;
752
753     //--------------------------------------------------------------------------
754
/**
755      * returns a DOM representation of all container lists of a site
756      *
757      * @param int siteID
758      *
759      * @auhtor NK
760      */

761     public abstract JahiaDOMObject getContainerListsAsDOM (int siteID)
762         throws JahiaException;
763
764     //--------------------------------------------------------------------------
765
/**
766      * returns a DOM representation of all container lists props of a site
767      *
768      * @param int siteID
769      *
770      * @auhtor NK
771      */

772     public abstract JahiaDOMObject getContainerListPropsAsDOM (int siteID)
773         throws JahiaException;
774
775     //--------------------------------------------------------------------------
776
/**
777      * returns a DOM representation of all container def of a site
778      *
779      * @param int siteID
780      *
781      * @auhtor NK
782      */

783     public abstract JahiaDOMObject getContainerDefsAsDOM (int siteID)
784         throws JahiaException;
785
786     //--------------------------------------------------------------------------
787
/**
788      * returns a DOM representation of all container def prop of a site
789      *
790      * @param int siteID
791      *
792      * @auhtor NK
793      */

794     public abstract JahiaDOMObject getContainerDefPropsAsDOM (int siteID)
795         throws JahiaException;
796
797     //--------------------------------------------------------------------------
798
/**
799          * returns a DOM representation of all containers extented properties of a site
800      *
801      * @param int siteID
802      */

803     public abstract JahiaDOMObject getContainerExtendedPropsAsDOM (int siteID)
804         throws JahiaException;
805
806     //--------------------------------------------------------------------------
807
/**
808      * returns a DOM representation of all container structure of a site
809      *
810      * @param int siteID
811      *
812      * @auhtor NK
813      */

814     public abstract JahiaDOMObject getContainerStructsAsDOM (int siteID)
815         throws JahiaException;
816
817     //--------------------------------------------------------------------------
818
/**
819      * Returns a vector of all Acl ID used by container for a site
820      * Need this for site extraction
821      *
822      * @param int siteID
823      *
824      * @auhtor NK
825      */

826     public abstract Vector JavaDoc getAclIDs (int siteID)
827         throws JahiaException;
828
829     //--------------------------------------------------------------------------
830
/**
831      * Returns a vector of all ctn lists fields ( field def ) Acl ID for a site
832      * Used for site extraction
833      *
834      * @param int siteID
835      *
836      * @auhtor NK
837      */

838     public abstract Vector JavaDoc getCtnListFieldAclIDs (int siteID)
839         throws JahiaException;
840
841     /**
842      * Marks all the container lists in a given page for deletion. Prior to
843      * calling this method you should have already marked all the fields in
844      * the page for deletion, in the languages that are to be deleted.
845      *
846      * @param pageID the page for which to flag all the content
847      * @param user the user performing this marking operation.
848      * @param languageCode the language to mark for deletion
849      * @param stateModifContext use to detect loop in deletions
850      *
851      * @return true if all the content could be removed, or false if some
852      * containers lists were not completely removed.
853      *
854      * @throws JahiaException in case there were problems communicating with
855      * the persistant store
856      */

857     public abstract boolean markPageContainerListsLanguageForDeletion (int
858         pageID,
859         JahiaUser user,
860         String JavaDoc languageCode,
861         StateModificationContext stateModifContext)
862         throws JahiaException;
863
864     /**
865      * Removes all the data in the containers lists for the given page ID,
866      * including all the versions, etc...
867      *
868      * @param pageID the page for which to purge the container lists.
869      *
870      * @throws JahiaException thrown if an error occurs while purging the
871      * container lists.
872      */

873     public abstract void purgePageContainerLists (int pageID)
874         throws JahiaException;
875
876     /**
877      * Marks a specific container list for deletion. Prior to calling this all
878      * the marking on the fields should have already been done for the various
879      * languages as this is not done by this method.
880      *
881      * @param listID the list to mark for deletion if possible (only marked if
882      * all the containers can be marked for deletion)
883      * @param user the user performing this marking operation.
884      * @param languageCode the language to mark for deletion
885      * @param stateModifContext use to detect loop in deletions
886      *
887          * @return true if this container list was successfully marked for deletion,
888      * implying that all the containers inside it were also successfully marked
889      * for deletion.
890      *
891      * @throws JahiaException in case there were problems communicating with
892      * the persistant store
893      */

894     public abstract boolean markContainerListLanguageForDeletion (int listID,
895         JahiaUser user,
896         String JavaDoc languageCode,
897         StateModificationContext
898         stateModifContext)
899         throws JahiaException;
900
901     /**
902      * Marks a specific container for deletion. Prior to calling this all
903      * the marking on the fields should have already been done for the various
904      * languages as this is not done by this method.
905      *
906      * @param id the container to mark for deletion if possible (only marked if
907      * all the fields can be marked for deletion in all the languages)
908      * @param user the user performing this marking operation.
909      * @param languageCode the language to mark for deletion.
910      * @param stateModifContext use to detect loop in deletions
911      * @param withFieldContent specifies whether the field's specific content
912      * should be marked for deletion or not. Useful for pages in certain
913      * cases.
914      *
915      * @return true if this container was successfully marked for deletion,
916          * implying that all the fields inside it were also successfully marked
917      * for deletion in all languages.
918      *
919      * @throws JahiaException in case there were problems communicating with
920      * the persistant store
921      */

922     public abstract boolean markContainerLanguageForDeletion (
923         int id, JahiaUser user, String JavaDoc languageCode,
924         StateModificationContext stateModifContext)
925         throws JahiaException;
926
927     /**
928      * Serializes all the container lists on a page and their content to an
929      * XML writer object.
930      * This method will go into every container list on the page, including
931      * the containers, sub container lists and fields, to serializes the whole
932      * thing to XML.
933      *
934      * @param xmlWriter the XML writer object to output the serialization into
935      * @param xmlSerializationOptions various options to control the details
936      * outputed in the XML file
937      * @param pageID the page ID for which to output the container lists and
938      * their content.
939      * @param paramBean specifies context of serialization, such as current
940      * user, current request parameters, entry load request, URL generation
941      * information such as ServerName, ServerPort, ContextPath, etc... URL
942      * generation is an important part of XML serialization and this is why
943      * we pass this parameter down, as well as user rights checking.
944      *
945      * @throws IOException thrown if an error occurs while writing to the
946      * XML writer.
947      */

948     public abstract void serializePageContainerListsToXML (XmlWriter xmlWriter,
949         XMLSerializationOptions xmlSerializationOptions,
950         int pageID, ParamBean paramBean)
951         throws IOException JavaDoc;
952
953     /**
954      * Serialize a container list and all of it's sub data into XML. This
955      * serializes everything according to the options specified, but it DOES
956      * always include containers sub container lists.
957      *
958      * @param xmlWriter the XML writer object to output the serialization into
959      * @param xmlSerializationOptions various options to control the details
960      * outputed in the XML file
961          * @param containerListID the identifier to the container list to be
962      * serialized to XML.
963      * @param paramBean specifies context of serialization, such as current
964      * user, current request parameters, entry load request, URL generation
965      * information such as ServerName, ServerPort, ContextPath, etc... URL
966      * generation is an important part of XML serialization and this is why
967      * we pass this parameter down, as well as user rights checking.
968      *
969      * @throws IOException thrown if an error occurs while writing to the
970      * XML writer.
971      */

972     public abstract void serializeContainerListToXML (XmlWriter xmlWriter,
973         XMLSerializationOptions xmlSerializationOptions,
974         int containerListID, ParamBean paramBean)
975         throws IOException JavaDoc;
976
977     /**
978      * Serialize a container and all of it's sub data into XML. This
979      * serializes everything according to the options specified, but it DOES
980      * always include containers sub container lists.
981      *
982      * @param xmlWriter the XML writer object to output the serialization into
983      * @param xmlSerializationOptions various options to control the details
984      * outputed in the XML file
985      * @param containerID the identifier to the container to be
986      * serialized to XML.
987      * @param paramBean specifies context of serialization, such as current
988      * user, current request parameters, entry load request, URL generation
989      * information such as ServerName, ServerPort, ContextPath, etc... URL
990      * generation is an important part of XML serialization and this is why
991      * we pass this parameter down, as well as user rights checking.
992      *
993      * @throws IOException thrown if an error occurs while writing to the
994      * XML writer.
995      */

996     public abstract void serializeContainerToXML (XmlWriter xmlWriter,
997                                                   XMLSerializationOptions
998                                                   xmlSerializationOptions,
999                                                   int containerID,
1000                                                  ParamBean paramBean)
1001        throws IOException JavaDoc;
1002
1003    /**
1004     * Retrieves all the top level container lists IDs for a given page and
1005     * load request.
1006     *
1007     * @param pageID
1008     * @param loadRequest
1009     *
1010         * @return a SortedSet of container list IDs for the top level container lists
1011     * for this EntryLoadRequest.
1012     *
1013     * @throws JahiaException
1014     */

1015    public abstract SortedSet JavaDoc getAllPageTopLevelContainerListIDs (int pageID,
1016        EntryLoadRequest loadRequest)
1017        throws JahiaException;
1018
1019    /**
1020     * Returns a set of subContainerDefinitionIDs that contain the container
1021     * definition ID we are looking for.
1022     *
1023     * @param containerDefinitionID an integer specifying the container
1024     * definition for which to find the parent sub definitions.
1025     *
1026         * @return a SortedSet containing Integer that are subContainerDefinitionIDs
1027     * that contain the container definition we are looking for.
1028     *
1029         * @throws JahiaException if there was an error while communicating with the
1030     * database
1031     */

1032    public abstract SortedSet JavaDoc getContainerDefinitionParents (int
1033        containerDefinitionID)
1034        throws JahiaException;
1035
1036    /**
1037     * Retrieves all the container list IDs in a site that correspond to the
1038     * passed name. Note that the structure of these lists may be different
1039     * because they may have originated in different templates !
1040     *
1041         * @param siteID the site for which to retrieve the container lists by name
1042     * @param name the name (definition name) for which to retrieve the
1043     * container lists in the site.
1044     * @param loadRequest the EntryLoadRequest for which to retrieve the
1045     * container list IDs. Maybe null if we want to get absolutely EVERY
1046     * container list regardless of status/version, etc...
1047     *
1048         * @return a SortedSet containing Integer that are subContainerDefinitionIDs
1049     * that contain the container definition we are looking for.
1050     *
1051         * @throws JahiaException if there was an error while communicating with the
1052     * database
1053     */

1054    public abstract SortedSet JavaDoc getSiteTopLevelContainerListsIDsByName (int
1055        siteID,
1056        String JavaDoc name,
1057        EntryLoadRequest loadRequest)
1058        throws JahiaException;
1059
1060    /**
1061     * Retrieves all the properties for a given container
1062     *
1063     * @param containerID the identifier of the container whose properties
1064     * we want to retrieve from the database
1065     *
1066     * @return a Properties object that contains all the properties that are
1067     * available for this container in the database
1068     *
1069     * @throws JahiaException generated if there were problems executing the
1070     * query or communicating with the database.
1071     */

1072    public abstract Properties JavaDoc getContainerProperties (int containerID)
1073        throws JahiaException;
1074
1075    /**
1076     * Save a property in the database for the specified container.
1077     *
1078     * @param containerID the container whose properties we are serializing
1079     * in the database.
1080     * @param jahiaID the site id
1081     * @param propertyName name of the property to be set
1082     * @param propertyValue value of the property to be set
1083     *
1084     * @throws JahiaException generated if there were problems executing the
1085     * query or communicating with the database.
1086     */

1087    public abstract void setContainerProperty (int containerID,
1088                                               int jahiaID,
1089                                               String JavaDoc propertyName,
1090                                               String JavaDoc propertyValue)
1091        throws JahiaException;
1092    
1093    /**
1094     * Saves a whole set of properties in the database for the specified
1095     * container.
1096     *
1097     * @param containerID the container whose properties we are serializing
1098     * in the database.
1099     * @param jahiaID the site id
1100     * @param containerProperties the Properties object that contains all
1101     * the properties to save in the database. Only what is passed here will
1102     * exist in the database. If the database contained properties that aren't
1103     * in this hashtable they will be deleted.
1104     *
1105     * @throws JahiaException generated if there were problems executing the
1106     * query or communicating with the database.
1107     */

1108    public abstract void setContainerProperties (int containerID,
1109                                                 int jahiaID,
1110                                                 Properties JavaDoc containerProperties)
1111        throws JahiaException;
1112
1113    /**
1114     * Returns the staging workflow state of the containers for all the languages
1115     * on the specified page.
1116     *
1117     * Note this method does NOT retrieve the language state of the
1118     * containers child fields or container lists.
1119     *
1120     * Normally as currently we only do state changes on a page basis these
1121     * should all be equal. This does not retrieve the state of absolute containers.
1122     *
1123     * @param pageID the page id on which to retrieve the containers workflow state
1124     *
1125     * @return a Map that contains all the states of the languages for the
1126     * containers on the page (for the moment we assume all the objects are in the
1127     * same state)
1128     *
1129     * @throws JahiaException in the case we couldn't load a field.
1130     */

1131    public abstract Map JavaDoc getContainersLanguagesState (int pageID)
1132        throws JahiaException;
1133
1134    /**
1135     * Removes all container infos from the cache if it was present in the cache. If not,
1136     * this does nothing.
1137     *
1138     * @param containerID the identifier for the container to try to remove from the
1139     * cache.
1140     */

1141    public abstract void invalidateContainerFromCache (int containerID);
1142
1143    /**
1144     * Removes all container list from the cache if it was present in the cache. If not,
1145     * this does nothing.
1146     *
1147     * @param containerListID the identifier for the container list to try to remove from the
1148     * cache.
1149     */

1150    public abstract void invalidateContainerListFromCache (int containerListID);
1151
1152} // end JahiaContainersService
Popular Tags