KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > raptus > owxv3 > modules > submitter > SubmitterObject


1 /*
2  * eAdmin/OWX
3  * Copyright (C) 1996-2003 OWX-Project Team <owx-team@gmx.net>
4  */

5
6 package com.raptus.owxv3.modules.submitter;
7
8 import java.sql.SQLException JavaDoc;
9 import java.text.*;
10 import java.util.*;
11
12 import com.raptus.owxv3.*;
13 import com.raptus.owxv3.api.*;
14 import com.raptus.owxv3.api.components.*;
15 import com.raptus.owxv3.api.dataxs.*;
16
17 // only import needed stuff
18
import com.raptus.owxv3.modules.base.BaseObject;
19 import com.raptus.owxv3.modules.base.NwslistManager;
20 import com.raptus.owxv3.modules.base.Nwslist;
21 import com.raptus.owxv3.modules.base.PubBaseEntry;
22
23 /**
24  * Contains
25  *
26  * <hr>
27  * <table width="100%" border="0">
28  * <tr>
29  * <td width="24%"><b>Filename</b></td><td width="76%">SubmitterConstants.java</td>
30  * </tr>
31  * <tr>
32  * <td width="24%"><b>Author</b></td><td width="76%">Guy Zuercher (gzuercher@raptus.com)</td>
33  * </tr>
34  * <tr>
35  * <td width="24%"><b>Date</b></td><td width="76%">16th of September 2003</td>
36  * </tr>
37  * </table>
38  * <hr>
39  * <table width="100%" border="0">
40  * <tr>
41  * <td width="24%"><b>Date / Author</b></td><td width="76%"><b>Changes</b></td>
42  * </tr>
43  * </table>
44  * <hr>
45  */

46 public class SubmitterObject extends BusinessObject
47                              implements ComponentBusinessObject
48 {
49     /**
50      *
51      */

52     protected NwslistManager nwsList = null;
53     
54     /**
55      *
56      */

57     protected GlobalResources gres = null;
58
59     /**
60      *
61      */

62     
63     public SubmitterObject(VModule vm, Locale lcle)
64     {
65         super(vm, lcle);
66         gres = new GlobalResources();
67     }
68     
69     /**
70      * this loads the VM list for every vmodule and put these lists into EASubmitterListBean
71      * in order to give it to the JSP part
72      */

73     public Vector loadEASubmitterListEntries()
74     {
75         // which modules to load
76
XMLConfigManager cm = XMLConfigManager.getInstance();
77         String JavaDoc[] selvmodules = cm.getStringArrayByTree("virtualhost/vmodules/vmodule?name=" +
78                                                        vmodule.getIdentification() +
79                                                        "/properties/property?name=vmodules","items");
80
81         VModuleManager vmm = VModuleManager.getInstance();
82         Vector submList = new Vector(selvmodules.length);
83         for(int i = 0; i < selvmodules.length; i ++)
84         {
85             // look for vm title in eadmin
86
String JavaDoc vmtitle = cm.getPropertyByTree("virtualhost/vmodules/vmodule?name=" + selvmodules[i] +
87                                                   "/section/eadmin/element?name=index" +
88                                                   "/property?name=displayname/label?locale=" +
89                                                   locale.toString(),"value");
90             
91             // get listpart ; jsp which knows how to handle its data
92
String JavaDoc listpart = cm.getPropertyByTree("virtualhost/vmodules/vmodule?name=" + vmodule.getIdentification() +
93                                                    "/properties/property?name=" + selvmodules[i] +
94                                                    "/property?name=listpart","value");
95
96             // init vm for use with bo
97
VModule vm = vmm.getVModule(selvmodules[i]);
98             Vector vmentrylist = loadAllEntriesForVModule(vm);
99             
100             // pass along other params as needed
101
EASubmitterListEntry sle = new EASubmitterListEntry();
102             sle.setTitle(vmtitle);
103             sle.setListpart(listpart);
104             
105             // put these objects BUNDLED into the final list
106
PairOfObjects po = new PairOfObjects(sle, vmentrylist);
107             submList.insertElementAt(po, 0);
108         }
109         
110         return submList;
111     }
112     
113     protected Vector loadAllEntriesForVModule(VModule vm)
114     {
115         Vector newsPubList = null;
116         nwsList = new NwslistManager(vm.getIdentification());
117         nwsList.setDataSource(vm.getDatasource());
118
119         String JavaDoc table = nwsList.getTableID();
120         try
121         {
122             String JavaDoc where = "flagVisible = false OR flagVisible = true";
123             Nwslist[] list = nwsList.loadByWhere(where, "entrydte DESC", 0);
124
125             newsPubList = new Vector(list.length); // speed up allocation
126
boolean entry_valid=true;
127             for(int i = 0; i < list.length; i ++)
128             {
129                 Nwslist entry = list[i];
130                 entry_valid=true;
131                 PubBaseEntry pne = new PubBaseEntry();
132                 pne.setBaseID(entry.getRowid());
133
134                 pne.setEntryDate( getLocaleFormattedDate(entry.getEntrydte()) );
135                 pne.setFieldList( gres.loadFields(table,entry.getRowid()) );
136                 pne.setLocalizedFieldList( gres.loadLocalizedFields(table, entry.getRowid()) );
137
138                 newsPubList.addElement(pne);
139             }
140         }
141         catch(SQLException JavaDoc e) {
142             LoggingManager.log("SQLException during retrieval of pub news list! " + e.getMessage(), this);
143         }
144
145         nwsList = null;
146         return newsPubList;
147     }
148
149     /**
150      *
151      */

152     public boolean loadComponentData(ComponentContainer cc)
153     {
154         return false;
155     }
156     
157     /**
158      *
159      */

160     public boolean loadComponentDefaultData(ComponentContainer cc)
161     {
162         return false;
163     }
164  
165     /**
166      *
167      */

168     public boolean saveComponentData(ComponentContainer cc)
169     {
170         return false;
171     }
172
173 }
174
175 // eof
176
Popular Tags