KickJava   Java API By Example, From Geeks To Geeks.

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


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  *
14  * ----- BEGIN LICENSE BLOCK -----
15  * Version: JCSL 1.0
16  *
17  * The contents of this file are subject to the Jahia Community Source License
18  * 1.0 or later (the "License"); you may not use this file except in
19  * compliance with the License. You may obtain a copy of the License at
20  * http://www.jahia.org/license
21  *
22  * Software distributed under the License is distributed on an "AS IS" basis,
23  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
24  * for the rights, obligations and limitations governing use of the contents
25  * of the file. The Original and Upgraded Code is the Jahia CMS and Portal
26  * Server. The developer of the Original and Upgraded Code is JAHIA Ltd. JAHIA
27  * Ltd. owns the copyrights in the portions it created. All Rights Reserved.
28  *
29  * The Shared Modifications are Jahia View Helper.
30  *
31  * The Developer of the Shared Modifications is Jahia Solution S�rl.
32  * Portions created by the Initial Developer are Copyright (C) 2002 by the
33  * Initial Developer. All Rights Reserved.
34  *
35  * Contributor(s):
36  * 22-AUG-2003, Jahia Solutions Sarl, Fulco Houkes
37  *
38  * ----- END LICENSE BLOCK -----
39  */

40
41 package org.jahia.services.containers;
42
43 import org.jahia.data.containers.*;
44 import org.jahia.exceptions.JahiaException;
45 import org.jahia.params.ParamBean;
46 import org.jahia.services.version.EntryLoadRequest;
47
48 import java.util.Hashtable JavaDoc;
49
50
51 /**
52  * Container List Factory Proxy
53  *
54  * @author Khue Nguyen <a HREF="mailto:khue@jahia.org">khue@jahia.org</a>
55  */

56
57 public class ContainerListFactoryProxy {
58
59     private static org.apache.log4j.Logger logger =
60             org.apache.log4j.Logger.getLogger (ContainerListFactoryProxy.class);
61
62     private int loadFlag;
63     private ParamBean jParams;
64     private EntryLoadRequest loadRequest;
65     private Hashtable JavaDoc cachedFieldsFromContainers;
66     private Hashtable JavaDoc cachedContainersFromContainerLists;
67     private Hashtable JavaDoc cachedContainerListsFromContainers;
68
69     //--------------------------------------------------------------------------
70
/**
71      *
72      * @param loadFlag
73      * @param jParams
74      * @param loadRequest
75      * @param cachedFieldsFromContainers
76      * @param cachedContainersFromContainerLists
77      * @param cachedContainerListsFromContainers
78      */

79     public ContainerListFactoryProxy (int loadFlag,
80                                        ParamBean jParams,
81                                        EntryLoadRequest loadRequest,
82                                        Hashtable JavaDoc cachedFieldsFromContainers,
83                                        Hashtable JavaDoc cachedContainersFromContainerLists,
84                                        Hashtable JavaDoc cachedContainerListsFromContainers)
85     {
86         this.loadFlag = loadFlag;
87         this.jParams = jParams;
88         this.loadRequest = loadRequest;
89         this.cachedFieldsFromContainers = cachedFieldsFromContainers;
90         if ( this.cachedFieldsFromContainers == null ){
91             this.cachedFieldsFromContainers = new Hashtable JavaDoc();
92         }
93         this.cachedContainersFromContainerLists = cachedContainersFromContainerLists;
94         if ( this.cachedContainersFromContainerLists == null ){
95             this.cachedContainersFromContainerLists = new Hashtable JavaDoc();
96         }
97         this.cachedContainerListsFromContainers = cachedContainerListsFromContainers;
98         if ( this.cachedContainerListsFromContainers == null ){
99             this.cachedContainerListsFromContainers = new Hashtable JavaDoc();
100         }
101     }
102
103     /**
104      * Load this container's sub containers list if not already loaded
105      *
106      */

107     public void load(JahiaContainerList containerList){
108         if ( containerList == null || containerList.isContainersLoaded() ){
109             return;
110         }
111         try {
112             ContainerFactory.getInstance()
113                 .fullyLoadContainerList(containerList,
114                 loadFlag, jParams, loadRequest, cachedFieldsFromContainers,
115                 this.cachedContainersFromContainerLists,
116                 this.cachedContainerListsFromContainers);
117             containerList.setIsContainersLoaded(true);
118         } catch ( JahiaException je){
119             logger.debug("Exception occured when loading Container List ["
120             + containerList.getID() + "]", je);
121         }
122     }
123 }
124
Popular Tags