KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jaspersoft > jasperserver > util > ExportResource


1 /*
2  * Copyright (C) 2006 JasperSoft http://www.jaspersoft.com
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed WITHOUT ANY WARRANTY; and without the
10  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
15  * or write to:
16  *
17  * Free Software Foundation, Inc.,
18  * 59 Temple Place - Suite 330,
19  * Boston, MA USA 02111-1307
20  */

21 package com.jaspersoft.jasperserver.util;
22
23 /**
24  * @author tkavanagh
25  * @version $Id: ExportResource.java 4652 2006-09-22 08:14:23Z lucian $
26  */

27
28 import java.io.File JavaDoc;
29 import java.io.FileOutputStream JavaDoc;
30 import java.io.FileWriter JavaDoc;
31 import java.util.ArrayList JavaDoc;
32 import java.util.Iterator JavaDoc;
33 import java.util.List JavaDoc;
34 import java.util.Map JavaDoc;
35 import java.util.Set JavaDoc;
36
37 import com.jaspersoft.jasperserver.api.common.domain.ExecutionContext;
38 import com.jaspersoft.jasperserver.api.engine.scheduling.domain.ReportJob;
39 import com.jaspersoft.jasperserver.api.engine.scheduling.domain.ReportJobIdHolder;
40 import com.jaspersoft.jasperserver.api.engine.scheduling.domain.ReportJobMailNotification;
41 import com.jaspersoft.jasperserver.api.engine.scheduling.domain.ReportJobRepositoryDestination;
42 import com.jaspersoft.jasperserver.api.engine.scheduling.domain.ReportJobSource;
43 import com.jaspersoft.jasperserver.api.engine.scheduling.domain.ReportJobSummary;
44 import com.jaspersoft.jasperserver.api.engine.scheduling.domain.ReportJobTrigger;
45 import com.jaspersoft.jasperserver.api.engine.scheduling.service.ReportJobsPersistenceService;
46 import com.jaspersoft.jasperserver.api.metadata.common.domain.ContentResource;
47 import com.jaspersoft.jasperserver.api.metadata.common.domain.DataSource;
48 import com.jaspersoft.jasperserver.api.metadata.common.domain.DataType;
49 import com.jaspersoft.jasperserver.api.metadata.common.domain.FileResource;
50 import com.jaspersoft.jasperserver.api.metadata.common.domain.FileResourceData;
51 import com.jaspersoft.jasperserver.api.metadata.common.domain.Folder;
52 import com.jaspersoft.jasperserver.api.metadata.common.domain.InputControl;
53 import com.jaspersoft.jasperserver.api.metadata.common.domain.ListOfValues;
54 import com.jaspersoft.jasperserver.api.metadata.common.domain.ListOfValuesItem;
55 import com.jaspersoft.jasperserver.api.metadata.common.domain.Query;
56 import com.jaspersoft.jasperserver.api.metadata.common.domain.Resource;
57 import com.jaspersoft.jasperserver.api.metadata.common.domain.ResourceLookup;
58 import com.jaspersoft.jasperserver.api.metadata.common.domain.ResourceReference;
59 import com.jaspersoft.jasperserver.api.metadata.common.service.RepositoryService;
60 import com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JdbcReportDataSource;
61 import com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.JndiJdbcReportDataSource;
62 import com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.ReportDataSource;
63 import com.jaspersoft.jasperserver.api.metadata.jasperreports.domain.ReportUnit;
64 import com.jaspersoft.jasperserver.api.metadata.olap.domain.MondrianConnection;
65 import com.jaspersoft.jasperserver.api.metadata.olap.domain.MondrianXMLADefinition;
66 import com.jaspersoft.jasperserver.api.metadata.olap.domain.OlapClientConnection;
67 import com.jaspersoft.jasperserver.api.metadata.olap.domain.OlapUnit;
68 import com.jaspersoft.jasperserver.api.metadata.olap.domain.XMLAConnection;
69 import com.jaspersoft.jasperserver.api.metadata.user.domain.Role;
70 import com.jaspersoft.jasperserver.api.metadata.user.domain.User;
71 import com.jaspersoft.jasperserver.api.metadata.user.domain.client.RoleImpl;
72 import com.jaspersoft.jasperserver.api.metadata.user.domain.impl.hibernate.RepoRole;
73 import com.jaspersoft.jasperserver.api.metadata.user.domain.impl.hibernate.RepoUser;
74 import com.jaspersoft.jasperserver.api.metadata.user.service.UserAuthorityService;
75 import com.jaspersoft.jasperserver.api.metadata.view.domain.FilterCriteria;
76 import com.jaspersoft.jasperserver.util.FileResourceBean;
77
78 import org.apache.commons.logging.Log;
79 import org.apache.commons.logging.LogFactory;
80
81 import org.exolab.castor.mapping.Mapping;
82 import org.exolab.castor.xml.Marshaller;
83 import org.xml.sax.InputSource JavaDoc;
84
85 /**
86  * This module handles the exporting of metadata from the JasperServer
87  * repository to an XML file. This XML file and the binary data that is
88  * written to disk is used to import to a target repository.
89  *
90  * Users can specify which resources in the repository are desired for export.
91  * For example, this can be a FileResource (such as an image, jrxml, etc), a
92  * ReportUnit, a DataSource, a Folder, etc. If the exported resource is a folder,
93  * all of the files and folders will be recursively exported.
94  *
95  * The attributes of the resource are written to a "bean" representation class.
96  * This class is processed (unmarshalled) by the Castor library to turn it
97  * directly into XML.
98  *
99  * This process is very straightforward for an object such as a DataSource which
100  * does not contain any binary information. However, for a FileResource such as
101  * an image, a jar, or even a JRXML, this module must manage the writing out of this
102  * binary (or in the case of JRXML, text data) information to disk in order to save
103  * it. Binary data is written out to disk and saved under a folder/directory structure
104  * that matches the repository URI structure specified by the uriString member variable
105  * for each resource.
106  *
107  * A typical export structure would look like the following:
108  *
109  * ji-catalog/ji-catalog.xml - xml file describing all exported resources
110  * /dir1/dir2/myImage - data on disk
111  * /dir1/dir2/myJrxml - data on disk
112  * /dir1/dir2/myClassJar - data on disk
113  *
114  * There is a heirarchy of bean objects that can hold each of the exported resources.
115  * The highest level bean object is ExportImportBean.
116  *
117  */

118
119 public class ExportResource {
120
121     private static final Log log = LogFactory.getLog(ExportResource.class);
122
123     public static final String JavaDoc PATH_SEP = "/";
124     
125     public static final String JavaDoc CATALOG_DIR_NAME = "target/ji-catalog";
126     public static final String JavaDoc CATALOG_FILE_NAME = "ji-catalog.xml";
127     
128     public static final String JavaDoc PRODUCT_VERSION_1_0 = "1.0";
129     public static final String JavaDoc PRODUCT_VERSION_0_9_2 = "0.9.2";
130     public static final String JavaDoc PRODUCT_VERSION_1_1_0 = "1.1.0";
131     public static final String JavaDoc PRODUCT_VERSION = PRODUCT_VERSION_1_1_0;
132     
133     public static final boolean TOP_LEVEL_OBJECT = true;
134     public static final boolean NOT_TOP_LEVEL_OBJECT = false;
135     
136     private RepositoryService mRepo;
137     private UserAuthorityService mAuth;
138     private ReportJobsPersistenceService mSched;
139     private ExecutionContext mContext;
140     private String JavaDoc mStartUri;
141     private boolean mProcessUsersRoles;
142     private String JavaDoc[] mUserNames;
143     private String JavaDoc[] mRoleNames;
144     private boolean mProcessReportJobs;
145     private String JavaDoc[] mReportJobUnitNames;
146     private String JavaDoc mCatalogDirName;
147     private String JavaDoc mCatalogFileName;
148     
149     private FilterCriteria filterCriteria;
150     
151     /*
152      * ExportImportBean it the top level data holder
153      * "bean" object. It is used for marshalling and
154      * unmarshalling from java objects to XML and back.
155      *
156      * It holds child beans such as:
157      *
158      * ResourceBean
159      * UserRoleHolderBean,
160      * ReportJobBeans
161      * etc.
162      */

163     private ExportImportBean mExportImportBean;
164     
165     /*
166      * Processing operation indicators
167      */

168     boolean mProcessUserRoleOnly = false;
169     boolean mProcessUriOnly = false;
170     boolean mProcessReportJobsOnly = false;
171     boolean mProcessAll = false;
172     boolean mProcessNothing = false;
173
174     /*
175      * Processing operation indicators for Users/Roles
176      */

177     private boolean mIsAllUsersRoles = false;
178     private boolean mIsNamedUsers = false;
179     private boolean mIsNamedRoles = false;
180     private boolean mIsNamedUsersRoles = false;
181
182     
183     /**
184      * @param args
185      */

186     public static void main(String JavaDoc[] args) {
187
188     }
189     
190
191     /**
192      * Constructor
193      *
194      * @param repo
195      * @param userAuthService
196      * @param reportJobsPersistenceService
197      * @param context
198      * @param startUri
199      * @param processUsersRoles
200      * @param userNames
201      * @param roleNames
202      * @param processReportJobs
203      * @param reportJobUnitNames
204      * @param catalogDirName
205      * @param catalogFile
206      */

207     public ExportResource(RepositoryService repo,
208             UserAuthorityService userAuthService,
209             ReportJobsPersistenceService reportJobsPersistenceService,
210             ExecutionContext context,
211             String JavaDoc startUri,
212             boolean processUsersRoles,
213             String JavaDoc[] userNames,
214             String JavaDoc[] roleNames,
215             boolean processReportJobs,
216             String JavaDoc[] reportJobUnitNames,
217             String JavaDoc catalogDirName,
218             String JavaDoc catalogFileName) {
219     
220         this.mRepo = repo;
221         this.mAuth = userAuthService;
222         this.mSched = reportJobsPersistenceService;
223         this.mContext = context;
224         this.mStartUri = startUri;
225         this.mProcessUsersRoles = processUsersRoles;
226         this.mUserNames = userNames;
227         this.mRoleNames = roleNames;
228         this.mProcessReportJobs = processReportJobs;
229         this.mReportJobUnitNames = reportJobUnitNames;
230         this.mCatalogDirName = catalogDirName;
231         this.mCatalogFileName = catalogFileName;
232         
233         this.filterCriteria = new FilterCriteria(); // not currently used for search
234
}
235
236
237     /*
238      * Check the processing input values to see what operations
239      * are being requested.
240      *
241      * In the 1.0 system there are three main processing types:
242      *
243      * - All resources that implement the Resource interface
244      * (ie repository resources)
245      *
246      * - Users, Roles (and related objects)
247      *
248      * - ReportJob Scheduling related objects
249      *
250      * There are separate processing/logic trees for each of these main types.
251      */

252     protected void checkForProcessing() {
253
254         boolean processUri = false;
255         
256         if (mStartUri == null || mStartUri.length() == 0) {
257             processUri = false;
258         } else {
259             processUri = true;
260         }
261
262         if (processUri && mProcessUsersRoles) {
263             mProcessAll = true;
264         } else if (processUri && !mProcessUsersRoles) {
265             mProcessUriOnly = true;
266         } else if (!processUri && mProcessUsersRoles) {
267             mProcessUserRoleOnly = true;
268         } else {
269             
270             // We will include ReportJobs if we have processAll
271
// so, just check for job processing only operation
272
if (!processUri && !mProcessUsersRoles && mProcessReportJobs) {
273                 mProcessReportJobsOnly = true;
274                 
275             } else {
276                 mProcessNothing = true;
277                 log.error("ERROR: Nothing to process. Check for valid inputs.");
278             }
279         }
280         
281         log.warn("----- Processing Values:");
282         log.warn(" mProcessAll=" + mProcessAll);
283         log.warn(" mProcessUriOnly=" + mProcessUriOnly);
284         log.warn(" mProcessUserRoleOnly=" + mProcessUserRoleOnly);
285         log.warn(" mProcessReportJobsOnly=" + mProcessReportJobsOnly);
286         log.warn(" mProcessNothing=" + mProcessNothing);
287         
288         System.out.println("----- Processing Values:");
289         System.out.println(" mProcessAll=" + mProcessAll);
290         System.out.println(" mProcessUriOnly=" + mProcessUriOnly);
291         System.out.println(" mProcessUserRoleOnly=" + mProcessUserRoleOnly);
292         System.out.println(" mProcessReportJobsOnly=" + mProcessReportJobsOnly);
293         System.out.println(" mProcessNothing=" + mProcessNothing);
294     }
295     
296     /*
297      * This is the top level processing method.
298      *
299      */

300     public void process() {
301         System.out.println("ExportResource: top of process()");
302         log.debug("top of process()");
303         
304         mExportImportBean = new ExportImportBean();
305         mExportImportBean.setVersion(PRODUCT_VERSION);
306         
307         checkForProcessing();
308         
309         if (mProcessUriOnly) {
310             
311             processUri();
312             
313         } else if (mProcessUserRoleOnly) {
314             
315             processUsersRoles();
316             
317         } else if (mProcessReportJobsOnly) {
318             
319             processReportJobs(TOP_LEVEL_OBJECT);
320             
321         } else if (mProcessAll) {
322             
323             processUsersRoles();
324             
325             processReportJobs(TOP_LEVEL_OBJECT);
326             
327             processUri();
328             
329         } else if (mProcessNothing) {
330             // put up usage messsage
331
log.warn("WARN: Nothing to process. Check for valid inputs");
332         } else {
333             log.error("ERROR: Unknown processing operation. Check for valid inputs");
334         }
335     }
336     
337     /**
338      * Main processing routine for all repository resources that inherit
339      * from the Resource interface (and are handled by the RepositoryService).
340      *
341      */

342     public void processUri() {
343         
344         try {
345             /*
346              * Figure out if we have a resource or a folder. The Repository
347              * Service handles folders and other resources a bit differently
348              * (ie with different methods).
349              */

350             
351             Resource res = mRepo.getResource(null, mStartUri);
352             
353             if (res == null) { // not a resource, must be a folder
354

355                 Folder folder = mRepo.getFolder(null, mStartUri);
356                 
357                 if (folder != null) {
358                     
359                     process(folder, TOP_LEVEL_OBJECT);
360                     
361                 } else {
362                     throw new Exception JavaDoc("unknown resource uri, uri=" + mStartUri);
363                 }
364             } else {
365                 
366                 if (res instanceof ReportUnit) {
367                     process( (ReportUnit) res, TOP_LEVEL_OBJECT);
368
369                 } else if (res instanceof OlapUnit) {
370                     process( (OlapUnit) res, TOP_LEVEL_OBJECT);
371                     
372                 } else if (res instanceof FileResource) {
373                     process( (FileResource) res, TOP_LEVEL_OBJECT);
374
375                 } else if (res instanceof ContentResource) {
376                     process( (ContentResource) res, TOP_LEVEL_OBJECT);
377                         
378                 } else if (res instanceof DataSource) {
379                     process( (DataSource) res, TOP_LEVEL_OBJECT);
380                     
381                 } else if (res instanceof OlapClientConnection) {
382                     process( (OlapClientConnection) res, TOP_LEVEL_OBJECT);
383
384                 } else if (res instanceof MondrianXMLADefinition) {
385                     process( (MondrianXMLADefinition) res, TOP_LEVEL_OBJECT);
386                     
387                 } else if (res instanceof InputControl) {
388                     process( (InputControl) res, TOP_LEVEL_OBJECT);
389
390                 } else if (res instanceof DataType) {
391                     process( (DataType) res, TOP_LEVEL_OBJECT);
392                     
393                 } else if (res instanceof ListOfValues) {
394                     process( (ListOfValues) res, TOP_LEVEL_OBJECT);
395                         
396                 } else if (res instanceof Query) {
397                     process( (Query) res, TOP_LEVEL_OBJECT);
398                                         
399                 } else {
400                     throw new Exception JavaDoc("Unhandled resourceType, resourceType=" + res.getResourceType());
401                 }
402             }
403         } catch (Exception JavaDoc e) {
404             log.error(" caught exception: " + e.getMessage());
405             e.printStackTrace();
406         }
407     }
408     
409     
410     /**
411      * Main processing routine for Users and Roles.
412      *
413      * Users and Roles are handled by the UserAuthorityService (not RepositoryService).
414      * They do not inherit from the Resource interface and do not have URIs associated
415      * with them. However, they are stored in the repository as are any JasperIntelligence
416      * objects.
417      *
418      * Processing of Users and Roles has four operations:
419      * 1) if usernames and rolenames are empty, get all users and roles
420      * in the system
421      * 2) if usernames array has values, export all of these names and
422      * keep information on any roles they reference
423      * 3) if rolenames array has values *and* usernames does not have values,
424      * export all of these roles and include all users that reference these
425      * roles (but don't include any additional roles that users reference)
426      * 4) if usernames and rolesnames has values then export the users and export
427      * the roles.
428      *
429      * @return
430      */

431     public void processUsersRoles() {
432         
433         checkForUserRoleProcessing();
434         
435         UserRoleHolderBean bean = null;
436         
437         if (mIsAllUsersRoles) {
438             
439             bean = processAllUsersRoles(TOP_LEVEL_OBJECT);
440             
441         } else if (mIsNamedUsers) {
442             
443             bean = processNamedUsers(mUserNames, TOP_LEVEL_OBJECT);
444             
445         } else if (mIsNamedRoles) {
446             
447             bean = processNamedRoles(mRoleNames, TOP_LEVEL_OBJECT);
448             
449         } else if (mIsNamedUsersRoles) {
450             
451             bean = processNamedUsersRoles(mUserNames, mRoleNames, TOP_LEVEL_OBJECT);
452             
453         } else {
454             log.error("ERROR: unknown user-role operation type");
455         }
456         
457         mExportImportBean.setUserRoleHolder(bean);
458         
459         if (mProcessUserRoleOnly) {
460             
461             writeCatalogFile(mExportImportBean);
462         }
463     }
464
465     
466     /**
467      * Main processing routine for Report Jobs (ie scheduled reports).
468      *
469      * This routine processes all jobs for reportUris that are specified via a
470      * constructor parameter.
471      *
472      */

473     public void processReportJobs(boolean isTopLevel) {
474         
475         if (mReportJobUnitNames != null) {
476             
477             List JavaDoc reportJobBeanList = new ArrayList JavaDoc();
478             
479             for (int i = 0; i < mReportJobUnitNames.length; i++) {
480
481                 if (mSched.listJobs(mContext, mReportJobUnitNames[i]) != null) {
482                 
483                     List JavaDoc jobs = mSched.listJobs(mContext, mReportJobUnitNames[i]);
484                     
485                     for(Iterator JavaDoc it = jobs.iterator(); it.hasNext();) {
486                     
487                         ReportJobSummary sum = (ReportJobSummary) it.next();
488                         ReportJob job = mSched.loadJob(mContext, new ReportJobIdHolder(sum.getId()));
489     
490                         reportJobBeanList.add( process( job, NOT_TOP_LEVEL_OBJECT));
491                     }
492                 }
493             }
494             
495             ReportJobBean[] reportJobs = null;
496             
497             if (reportJobBeanList != null && reportJobBeanList.size() > 0) {
498             
499                 reportJobs = new ReportJobBean[reportJobBeanList.size()];
500                 
501                 int j = 0;
502                 for (Iterator JavaDoc it2 = reportJobBeanList.iterator(); it2.hasNext(); j++) {
503                     
504                     reportJobs[j] = (ReportJobBean) it2.next();
505                 }
506             }
507             
508             mExportImportBean.setReportJobs(reportJobs);
509             
510             if (mProcessReportJobsOnly) {
511                 
512                 writeCatalogFile(mExportImportBean);
513             }
514         }
515     }
516     
517     
518     public FolderBean process(Folder topFolder, boolean isTopLevel) {
519
520         FolderBean topFolderBean = new FolderBean();
521         
522         fillCommonBeanFields(topFolderBean, topFolder);
523         
524         /*
525          * process the files (resources) in the folder
526          */

527         
528         ResourceBean[] resourceBeans = handleResourcesInFolder(topFolder);
529         
530         topFolderBean.setResources(resourceBeans);
531         
532         /*
533          * process the subfolders in the folder
534          */

535             
536         /*
537          * recurse subfolders
538          */

539         List JavaDoc subFolders = mRepo.getSubFolders(null, topFolder.getURIString());
540         FolderBean[] subFolderBeans = new FolderBean[subFolders.size()];
541         
542         int i = 0;
543         for (Iterator JavaDoc it = subFolders.iterator(); it.hasNext(); i++) {
544             
545             subFolderBeans[i] = new FolderBean();
546             processFolder( (Folder) it.next(), subFolderBeans[i]);
547         }
548         topFolderBean.setFolders(subFolderBeans);
549
550         /*
551          * write everything to disk
552          */

553         if (isTopLevel) {
554             mExportImportBean.setResource(topFolderBean);
555             writeCatalogFile(mExportImportBean);
556             writeCatalogData(topFolderBean);
557         }
558         
559         return topFolderBean;
560     }
561     
562     // todo: see about removing this method
563
public void processFolder(Folder folder, FolderBean bean) {
564         
565         fillCommonBeanFields(bean, folder);
566
567         ResourceBean[] resourceBeans = handleResourcesInFolder(folder);
568         bean.setResources(resourceBeans);
569
570         List JavaDoc subFolders = mRepo.getSubFolders(null, folder.getURIString());
571         FolderBean[] subFolderBeans = new FolderBean[subFolders.size()];
572         
573         int i = 0;
574         for (Iterator JavaDoc it = subFolders.iterator(); it.hasNext(); i++) {
575             
576             subFolderBeans[i] = new FolderBean();
577             processFolder( (Folder) it.next(), subFolderBeans[i]);
578         }
579         bean.setFolders(subFolderBeans);
580     }
581     
582     
583     public FileResourceBean process(FileResource fileResource, boolean isTopLevel) {
584         
585         FileResourceBean bean = new FileResourceBean();
586
587         fillBean(bean, fileResource);
588         
589         if (fileResource.isReference()) {
590             
591             /*
592              * If isReference is true, then the FileResource is a "link" to
593              * a target FileResource. We will build the target (linked to)
594              * FileResourceBean and save it in the linkTarget member variable.
595              * referenceURI points to the target object.
596              *
597              * Also, a "link" FileResource (in the repository) does not a
598              * fileType setting.
599              */

600             
601             bean.setIsReference(fileResource.isReference());
602             bean.setReferenceUri(fileResource.getReferenceURI());
603             
604             FileResourceBean targetBean =
605                 process((FileResource) mRepo.getResource(mContext, fileResource.getReferenceURI()),
606                         NOT_TOP_LEVEL_OBJECT);
607             
608             bean.setLinkTarget(targetBean);
609             
610         } else {
611             
612             bean.setFileType(fileResource.getFileType());
613         }
614                 
615         if (isTopLevel) {
616             mExportImportBean.setResource(bean);
617             writeCatalogFile(mExportImportBean);
618             writeCatalogData(bean);
619         }
620         
621         return bean;
622     }
623
624
625     /*
626      * ContentResource java class has a different implementation than the FileResource
627      * java class even though the functionality is very similar. Thus, creating new
628      * method to handle ContentResource.
629      */

630     public ContentResourceBean process(ContentResource contentResource, boolean isTopLevel) {
631         log.debug("top of process(ContentResource)");
632         
633         ContentResourceBean bean = new ContentResourceBean();
634
635         fillBean(bean, contentResource);
636         
637         if (contentResource.isReference()) {
638             
639             /*
640              * If isReference is true, then the ContentResource is a "link" to
641              * a target ContentResource. We will build the target (linked to)
642              * ContentResourceBean and save it in the linkTarget member variable.
643              * referenceURI points to the target object.
644              *
645              * Also, a "link" ContentResource (in the repository) does not have a
646              * fileType setting.
647              */

648             
649             bean.setReferenceUri(contentResource.getReferenceURI());
650             
651             ContentResourceBean targetBean =
652                 process((ContentResource) mRepo.getResource(mContext, contentResource.getReferenceURI()),
653                         NOT_TOP_LEVEL_OBJECT);
654             
655             bean.setLinkTarget(targetBean);
656             
657             bean.setFileType(contentResource.getFileType());
658             
659         } else {
660             
661             bean.setFileType(contentResource.getFileType());
662         }
663             
664         /*
665          * ContentResource can hold a list of ContentResources. This is typically
666          * an html parent that has a list of child images.
667          *
668          * NOTE: assuming that the children are of type ContentResource
669          */

670         if (contentResource.getResources() != null) {
671             
672             List JavaDoc resources = contentResource.getResources();
673             ContentResourceBean[] childResources = new ContentResourceBean[resources.size()];
674             
675             int i = 0;
676             for (Iterator JavaDoc it = resources.iterator(); it.hasNext(); i++) {
677                 childResources[i] = process( (ContentResource) it.next(), NOT_TOP_LEVEL_OBJECT);
678             }
679             
680             bean.setResources( childResources );
681         }
682         
683         if (isTopLevel) {
684             mExportImportBean.setResource(bean);
685             writeCatalogFile(mExportImportBean);
686             writeCatalogData(bean);
687         }
688         
689         return bean;
690     }
691
692         
693     // doc: because of the way that dataSource and mainReport are handled (by
694
// being stored as a ReferenceResource - it's not necessary to
695
// store a whole separate object (the target object). Instead,
696
// all our uri/parentFolder info is correct whether it's a
697
// reference or stored directly in the reportUnit object...
698
// isReference is a "traditional" link style
699
// isUriReference ### (change to isRUReference?) - is link within
700
// context of RU only
701
//
702
// doc: so processing mainReport may be confusing... ie. it's both
703
// process mainReport in combo way of ds and fileResource
704

705     public ReportUnitBean process(ReportUnit reportUnit, boolean isTopLevel) {
706         
707         ReportUnitBean bean = new ReportUnitBean();
708         
709         fillCommonBeanFields(bean, reportUnit);
710
711         /*
712          * get data source
713          */

714         if(reportUnit.getDataSource() != null) {
715             
716             Resource dataSource = dereference(null, reportUnit.getDataSource());
717                         
718             DataSourceBean dsBean = process( (DataSource) dataSource, NOT_TOP_LEVEL_OBJECT);
719             
720             /*
721              * check whether it's local to the report unit or not
722              */

723             if (reportUnit.getDataSource().isLocal()) {
724                 
725                 dsBean.setIsUriReference(false);
726             } else {
727                 dsBean.setIsUriReference(true);
728             }
729                     
730             bean.setDataSource(dsBean);
731         }
732
733         /*
734          * get query
735          */

736         if(reportUnit.getQuery() != null) {
737             Query query = (Query) dereference(null, reportUnit.getQuery());
738             QueryBean queryBean = process(query, NOT_TOP_LEVEL_OBJECT);
739
740             /*
741              * check whether it's local to the report unit or not
742              */

743             if (reportUnit.getQuery().isLocal()) {
744                 queryBean.setIsUriReference(false);
745             } else {
746                 queryBean.setIsUriReference(true);
747             }
748
749             bean.setQuery(queryBean);
750         }
751         
752         /*
753          * get main jrxml
754          */

755         if (reportUnit.getMainReport() != null) {
756             
757             FileResource reportRes = (FileResource) dereference(null, reportUnit.getMainReport());
758             
759             FileResourceBean reportBean = process(reportRes, NOT_TOP_LEVEL_OBJECT);
760             
761             if (reportUnit.getMainReport().isLocal()) {
762                 reportBean.setIsUriReference(false);
763             } else {
764                 reportBean.setIsUriReference(true);
765             }
766             
767             bean.setMainReport(reportBean);
768         }
769         
770         /*
771          * get input controls
772          */

773         if (reportUnit.getInputControls() != null) {
774             
775             InputControlBean[] inputControlBeans = handleInputControls(reportUnit, NOT_TOP_LEVEL_OBJECT);
776                             
777             bean.setInputControls(inputControlBeans);
778         }
779         
780         /*
781          * get resources (ie FileResources)
782          */

783         
784         if (reportUnit.getResources() != null) {
785             List JavaDoc resources = reportUnit.getResources();
786     
787             FileResourceBean[] resourcesArray = new FileResourceBean[resources.size()];
788             int i = 0;
789             for (Iterator JavaDoc it = resources.iterator(); it.hasNext(); i++) {
790                 
791                 FileResource res = (FileResource) dereference(null, (ResourceReference) it.next());
792                 
793                 if (res instanceof FileResource) {
794                     
795                     FileResourceBean frBean = process(res, NOT_TOP_LEVEL_OBJECT);
796                     
797                     resourcesArray[i] = frBean;
798                 } else {
799                     log.error("ERROR: unexpected report unit resource type, res.name=" + res.getName());
800                 }
801             }
802             bean.setResources(resourcesArray);
803         }
804         
805         if (isTopLevel) {
806             mExportImportBean.setResource(bean);
807             writeCatalogFile(mExportImportBean);
808             writeCatalogData(bean);
809         }
810         return bean;
811     }
812     
813     public OlapUnitBean process(OlapUnit unit, boolean isTopLevel) {
814         log.debug("top of process(OlapUnit)");
815         
816         OlapUnitBean bean = new OlapUnitBean();
817         
818         fillBean(bean, unit);
819
820         /*
821          * get olap client connection
822          */

823         
824         OlapClientConnection conn = (OlapClientConnection) dereference(mContext, unit.getOlapClientConnection());
825         
826         OlapClientConnectionBean connBean = process(conn, NOT_TOP_LEVEL_OBJECT);
827         
828         if (unit.getOlapClientConnection().isLocal()) {
829             
830             connBean.setIsUriReference(false);
831             
832         } else {
833             connBean.setIsUriReference(true);
834         }
835         
836         bean.setOlapClientConnection(connBean);
837         
838         if (isTopLevel) {
839             mExportImportBean.setResource(bean);
840             writeCatalogFile(mExportImportBean);
841             writeCatalogData(bean);
842         }
843         return bean;
844     }
845     
846     public OlapClientConnectionBean process(OlapClientConnection conn, boolean isTopLevel) {
847         log.debug("top of process(OlapClientConnection)");
848         
849         if (conn instanceof XMLAConnection) {
850             
851             return process( (XMLAConnection) conn, isTopLevel);
852             
853         } else if (conn instanceof MondrianConnection) {
854             
855             return process( (MondrianConnection) conn, isTopLevel);
856             
857         } else {
858             log.error("Unknown OlapClientConnection type, conn.uri=" + conn.getURIString());
859             return null;
860         }
861     }
862     
863     public XmlaConnectionBean process(XMLAConnection conn, boolean isTopLevel) {
864         
865         XmlaConnectionBean bean = new XmlaConnectionBean();
866         
867         fillBean(bean, conn);
868
869         if (isTopLevel) {
870             mExportImportBean.setResource(bean);
871             writeCatalogFile(mExportImportBean);
872         }
873         
874         return bean;
875     }
876     
877     public MondrianConnectionBean process(MondrianConnection conn, boolean isTopLevel) {
878         
879         MondrianConnectionBean bean = new MondrianConnectionBean();
880         
881         fillBean(bean, conn);
882
883         /*
884          * get schema
885          */

886         FileResource schema = (FileResource) dereference(mContext, conn.getSchema());
887         
888         FileResourceBean schemaBean = process(schema, NOT_TOP_LEVEL_OBJECT);
889         
890         if (conn.getSchema().isLocal()) {
891             schemaBean.setIsUriReference(false);
892         } else {
893             schemaBean.setIsUriReference(true);
894         }
895         
896         bean.setSchema(schemaBean);
897         
898         /*
899          * get data source
900          */

901         DataSource ds = (DataSource) dereference(mContext, conn.getDataSource());
902         
903         DataSourceBean dsBean = process(ds, NOT_TOP_LEVEL_OBJECT);
904         
905         if (conn.getDataSource().isLocal()) {
906             dsBean.setIsUriReference(false);
907         } else {
908             dsBean.setIsUriReference(true);
909         }
910         
911         bean.setDataSource(dsBean);
912         
913         if (isTopLevel) {
914             mExportImportBean.setResource(bean);
915             writeCatalogFile(mExportImportBean);
916             writeCatalogData(bean);
917         }
918         
919         return bean;
920     }
921     
922     
923     public MondrianXmlaDefinitionBean process(MondrianXMLADefinition xDef, boolean isTopLevel) {
924         log.debug("top of process(MondrianXMLADefinition)");
925         
926         MondrianXmlaDefinitionBean bean = new MondrianXmlaDefinitionBean();
927         
928         fillBean(bean, xDef);
929         
930         /*
931          * get mondrian connection
932          */

933         MondrianConnection conn = (MondrianConnection) dereference(mContext, xDef.getMondrianConnection());
934         
935         MondrianConnectionBean mondBean = process(conn, NOT_TOP_LEVEL_OBJECT);
936         
937         if (xDef.getMondrianConnection().isLocal()) {
938             mondBean.setIsUriReference(false);
939         } else {
940             mondBean.setIsUriReference(true);
941         }
942         
943         bean.setMondrianConnection(mondBean);
944
945         if (isTopLevel) {
946             mExportImportBean.setResource(bean);
947             writeCatalogFile(mExportImportBean);
948             writeCatalogData(bean);
949         }
950
951         return bean;
952     }
953     
954     public DataSourceBean process(DataSource dataSource, boolean isTopLevel) {
955         
956         if (dataSource instanceof JdbcReportDataSource) {
957             
958             return process( (JdbcReportDataSource) dataSource, isTopLevel);
959             
960         } else if (dataSource instanceof JndiJdbcReportDataSource) {
961             
962             return process((JndiJdbcReportDataSource) dataSource, isTopLevel);
963             
964         } else {
965             log.error("Unknown datasource type, dataSource.name=" + dataSource.getName());
966             return null;
967         }
968     }
969     
970     public JdbcDataSourceBean process(JdbcReportDataSource dataSource, boolean isTopLevel) {
971         
972         JdbcDataSourceBean bean = new JdbcDataSourceBean();
973         
974         fillBean(bean, dataSource);
975
976         if (isTopLevel) {
977             mExportImportBean.setResource(bean);
978             writeCatalogFile(mExportImportBean);
979         }
980         
981         return bean;
982     }
983     
984     public JndiJdbcDataSourceBean process(JndiJdbcReportDataSource dataSource, boolean isTopLevel) {
985         
986         JndiJdbcDataSourceBean bean = new JndiJdbcDataSourceBean();
987         
988         fillBean(bean, dataSource);
989         
990         if (isTopLevel) {
991             mExportImportBean.setResource(bean);
992             writeCatalogFile(mExportImportBean);
993         }
994         
995         return bean;
996     }
997     
998
999     public InputControlBean process(InputControl inputControl, boolean isTopLevel) {
1000        log.debug("top of process(InputControl)");
1001        
1002        InputControlBean bean = new InputControlBean();
1003        
1004        fillBean(bean, inputControl); // fill all data except bean objects handled below
1005

1006        /*
1007         * get dataType
1008         */

1009        
1010        if (inputControl.getDataType() != null) {
1011            
1012            DataType dataType = (DataType) dereference(null, inputControl.getDataType());
1013            
1014            DataTypeBean dataTypeBean = process(dataType, NOT_TOP_LEVEL_OBJECT);
1015            
1016            if (inputControl.getDataType().isLocal()) {
1017                dataTypeBean.setIsUriReference(false);
1018            } else {
1019                dataTypeBean.setIsUriReference(true);
1020            }
1021            
1022            bean.setDataType(dataTypeBean);
1023        }
1024        
1025        /*
1026         * get listOfValues
1027         */

1028        
1029        if (inputControl.getListOfValues() != null) {
1030            
1031            ListOfValues listOfValues = (ListOfValues) dereference(null, inputControl.getListOfValues());
1032            
1033            ListOfValuesBean listOfValuesBean = process(listOfValues, NOT_TOP_LEVEL_OBJECT);
1034            
1035            if (inputControl.getListOfValues().isLocal()) {
1036                listOfValuesBean.setIsUriReference(false);
1037            } else {
1038                listOfValuesBean.setIsUriReference(true);
1039            }
1040            
1041            bean.setListOfValues(listOfValuesBean);
1042        }
1043        
1044        /*
1045         * get query
1046         */

1047        
1048        if (inputControl.getQuery() != null) {
1049            
1050            Query query = (Query) dereference(null, inputControl.getQuery());
1051            
1052            QueryBean queryBean = process(query, NOT_TOP_LEVEL_OBJECT);
1053            
1054            if (inputControl.getQuery().isLocal()) {
1055                queryBean.setIsUriReference(false);
1056            } else {
1057                queryBean.setIsUriReference(true);
1058            }
1059            
1060            bean.setQuery(queryBean);
1061        }
1062        
1063        if (isTopLevel) {
1064            mExportImportBean.setResource(bean);
1065            writeCatalogFile(mExportImportBean);
1066        }
1067        
1068        return bean;
1069    }
1070    
1071    
1072    public QueryBean process(Query query, boolean isTopLevel) {
1073        
1074        QueryBean bean = new QueryBean();
1075        
1076        fillBean(bean, query);
1077
1078        /*
1079         * get data source
1080         */

1081        if(query.getDataSource() != null) {
1082            DataSource dataSource = (DataSource) dereference(null, query.getDataSource());
1083            DataSourceBean dsBean = process(dataSource, NOT_TOP_LEVEL_OBJECT);
1084            
1085            /*
1086             * check whether it's local to the query or not
1087             */

1088            if (query.getDataSource().isLocal()) {
1089                dsBean.setIsUriReference(false);
1090            } else {
1091                dsBean.setIsUriReference(true);
1092            }
1093                    
1094            bean.setDataSource(dsBean);
1095        }
1096        
1097        if (isTopLevel) {
1098            mExportImportBean.setResource(bean);
1099            writeCatalogFile(mExportImportBean);
1100        }
1101        
1102        return bean;
1103    }
1104    
1105    
1106    public DataTypeBean process(DataType dataType, boolean isTopLevel) {
1107        
1108        DataTypeBean bean = new DataTypeBean();
1109        
1110        fillBean(bean, dataType);
1111        
1112        if (isTopLevel) {
1113            mExportImportBean.setResource(bean);
1114            writeCatalogFile(mExportImportBean);
1115        }
1116        
1117        return bean;
1118    }
1119    
1120    
1121    public ListOfValuesBean process(ListOfValues listOfValues, boolean isTopLevel) {
1122        
1123        ListOfValuesBean bean = new ListOfValuesBean();
1124        
1125        fillBean(bean, listOfValues);
1126        
1127        if (isTopLevel) {
1128            mExportImportBean.setResource(bean);
1129            writeCatalogFile(mExportImportBean);
1130        }
1131        
1132        return bean;
1133    }
1134    
1135    
1136    public ReportJobBean process(ReportJob job, boolean isTopLevel) {
1137        
1138        ReportJobBean bean = new ReportJobBean();
1139        
1140        bean.setId(job.getId());
1141        bean.setVersion(job.getVersion());
1142        bean.setLabel(job.getLabel());
1143        bean.setDescription(job.getDescription());
1144        bean.setBaseOutputFilename(job.getBaseOutputFilename());
1145        
1146        if (job.getTrigger() != null) {
1147            ReportJobTriggerBean jtBean = new ReportJobTriggerBean();
1148            ReportJobTrigger trig = job.getTrigger();
1149            
1150            // build up the trigger object
1151
jtBean.setId(trig.getId());
1152            jtBean.setVersion(trig.getVersion());
1153            jtBean.setStartType(trig.getStartType());
1154            if (trig.getStartDate() != null) {
1155                jtBean.setStartDate(trig.getStartDate().toString());
1156            }
1157            //
1158
if (trig.getEndDate() != null) {
1159                jtBean.setEndDate(trig.getEndDate().toString());
1160            }
1161            bean.setTrigger(jtBean);
1162        }
1163        
1164        if (job.getSource() != null) {
1165            
1166            ReportJobSourceBean srcBean = new ReportJobSourceBean();
1167            ReportJobSource src = job.getSource();
1168            
1169            srcBean.setReportUnitURI(src.getReportUnitURI());
1170            
1171            if (src.getParametersMap() != null) {
1172                
1173                Map JavaDoc parms = src.getParametersMap();
1174                Set JavaDoc keys = parms.keySet();
1175                ParameterBean[] parmBeans = new ParameterBean[keys.size()];
1176                
1177                int i = 0;
1178                for(Iterator JavaDoc it = keys.iterator(); it.hasNext(); i++) {
1179                    
1180                    String JavaDoc key = (String JavaDoc) it.next();
1181                    String JavaDoc value = parms.get(key).toString();
1182                    
1183                    ParameterBean pb = new ParameterBean();
1184                    pb.setKey(key);
1185                    pb.setValue(value);
1186                    parmBeans[i] = pb;
1187                }
1188                srcBean.setParameters(parmBeans);
1189            }
1190            bean.setSource(srcBean);
1191        }
1192        
1193        if (job.getOutputFormats() != null) {
1194            
1195            Set JavaDoc outputFormats = job.getOutputFormats();
1196            byte[] outArray = new byte[outputFormats.size()];
1197            
1198            int i = 0;
1199            for (Iterator JavaDoc it = outputFormats.iterator(); it.hasNext(); i++) {
1200                
1201                outArray[i] = ((Byte JavaDoc) it.next()).byteValue();
1202            }
1203            bean.setOutputFormats(outArray);
1204        }
1205        
1206        if (job.getContentRepositoryDestination() != null) {
1207            
1208            ReportJobRepositoryDestinationBean destBean = new ReportJobRepositoryDestinationBean();
1209            ReportJobRepositoryDestination dest = job.getContentRepositoryDestination();
1210            
1211            destBean.setId(dest.getId());
1212            destBean.setVersion(dest.getVersion());
1213            destBean.setFolderURI(dest.getFolderURI());
1214            destBean.setSequentialFilenames(dest.isSequentialFilenames());
1215            destBean.setOverwriteFiles(dest.isOverwriteFiles());
1216            
1217            bean.setContentRepositoryDestination(destBean);
1218        }
1219        
1220        if (job.getMailNotification() != null) {
1221            
1222            ReportJobMailNotificationBean noteBean = new ReportJobMailNotificationBean();
1223            ReportJobMailNotification note = job.getMailNotification();
1224            
1225            noteBean.setId(note.getId());
1226            noteBean.setVersion(note.getVersion());
1227            
1228            if (note.getToAddresses() != null) {
1229                noteBean.setToAddresses(
1230                    (String JavaDoc[]) note.getToAddresses().toArray(new String JavaDoc[note.getToAddresses().size()]));
1231            }
1232            
1233            //noteBean.setCcAddresses(); // todo
1234
//noteBean.setBccAddresses();
1235
noteBean.setMessageText(note.getMessageText());
1236            noteBean.setResultSendType(note.getResultSendType());
1237            
1238            bean.setMailNotification(noteBean);
1239        }
1240        
1241        return bean;
1242    }
1243    
1244    
1245    public UserRoleHolderBean processAllUsersRoles(boolean isTopLevel) {
1246            
1247        UserRoleHolderBean bean = new UserRoleHolderBean();
1248        
1249        /*
1250         * get users
1251         */

1252        List JavaDoc userList = mAuth.getUsers(mContext, filterCriteria);
1253        
1254        
1255        String JavaDoc[] usernames = new String JavaDoc[userList.size()];
1256        
1257        int i = 0;
1258        for (Iterator JavaDoc it = userList.iterator(); it.hasNext(); i++) {
1259            
1260            usernames[i] = ( (User) it.next() ).getUsername();
1261        }
1262        
1263        bean.setUsers( handleUsers(usernames, NOT_TOP_LEVEL_OBJECT) );
1264
1265        /*
1266         * get roles
1267         */

1268        List JavaDoc roleList = mAuth.getRoles(mContext, filterCriteria);
1269        
1270        String JavaDoc[] rolenames = new String JavaDoc[roleList.size()];
1271        
1272        int j = 0;
1273        for (Iterator JavaDoc it = roleList.iterator(); it.hasNext(); j++) {
1274            
1275            rolenames[j] = ( (Role) it.next() ).getRoleName();
1276        }
1277        
1278        bean.setRoles( handleRoles(rolenames, NOT_TOP_LEVEL_OBJECT) );
1279        
1280        if (isTopLevel) {
1281            // need to check???
1282
}
1283        return bean;
1284    }
1285    
1286    /*
1287     * User has requested a set of users to be exported. Process this
1288     * operation.
1289     *
1290     * In this operation, we export just the users. We do not export
1291     * a full set of data describing the roles that the user has (but
1292     * we do save the names of the roles that the user has).
1293     *
1294     */

1295    public UserRoleHolderBean processNamedUsers(String JavaDoc[] usernames, boolean isTopLevel) {
1296        
1297        UserRoleHolderBean bean = new UserRoleHolderBean();
1298        
1299        bean.setUsers( handleUsers(usernames, NOT_TOP_LEVEL_OBJECT) );
1300        
1301        return bean;
1302    }
1303        
1304    /**
1305     * Processing of named roles is a bit different than similar processing for
1306     * users. By default, if the user has included a list of roles to export, then
1307     * we are also going to get the users that this role.
1308     *
1309     *
1310     * @param rolenames
1311     * @param isTopLevel
1312     * @return
1313     */

1314    public UserRoleHolderBean processNamedRoles(String JavaDoc[] rolenames, boolean isTopLevel) {
1315        
1316        UserRoleHolderBean bean = new UserRoleHolderBean();
1317        
1318        RoleBean[] roleBeans = handleRoles(rolenames, NOT_TOP_LEVEL_OBJECT);
1319        
1320        bean.setRoles(roleBeans);
1321        
1322        //if (mIsIncludeUsersWithRole) { // todo: make this a command line option
1323
UserBean[] userBeans = getUsersFromRole(roleBeans);
1324        //}
1325

1326        bean.setUsers(userBeans);
1327        
1328        return bean;
1329    }
1330    
1331    
1332    public UserRoleHolderBean processNamedUsersRoles(String JavaDoc[] usernames,
1333            String JavaDoc[] rolenames,
1334            boolean isTopLevel) {
1335        
1336        UserRoleHolderBean bean = new UserRoleHolderBean();
1337        
1338        bean.setUsers( handleUsers(usernames, NOT_TOP_LEVEL_OBJECT) );
1339        bean.setRoles( handleRoles(rolenames, NOT_TOP_LEVEL_OBJECT) );
1340        
1341        return bean;
1342    }
1343    
1344    /*
1345     * Given an array of usernames, return an array of populated UserBean
1346     * objects.
1347     */

1348    public UserBean[] handleUsers(String JavaDoc[] usernames, boolean isTopLevel) {
1349        
1350        UserBean[] userBeans = new UserBean[usernames.length];
1351        
1352        for (int i = 0; i < usernames.length; i++) {
1353            
1354            UserBean bean = new UserBean();
1355            User user = mAuth.getUser(mContext, usernames[i]);
1356                
1357            bean.setUsername(user.getUsername());
1358            bean.setFullName(user.getFullName());
1359            bean.setPassword(user.getPassword());
1360            bean.setEmailAddress(user.getEmailAddress());
1361            bean.setExternallyDefined(user.isExternallyDefined());
1362            bean.setEnabled(user.isEnabled());
1363            
1364            bean.setRoleSet( getRolesFromUser(user) );
1365            
1366            userBeans[i] = bean;
1367        }
1368        
1369        return userBeans;
1370    }
1371    
1372
1373    /*
1374     * Given an array of rolenames, return an array of populated RoleBean
1375     * objects.
1376     */

1377    public RoleBean[] handleRoles(String JavaDoc[] rolenames, boolean isTopLevel) {
1378        
1379        RoleBean[] roleBeans = new RoleBean[rolenames.length];
1380        
1381        for (int i = 0; i < rolenames.length; i++) {
1382            
1383            RoleBean bean = new RoleBean();
1384            Role role = mAuth.getRole(mContext, rolenames[i]);
1385            
1386            bean.setRoleName(role.getRoleName());
1387            bean.setExternallyDefined(role.isExternallyDefined());
1388            
1389            roleBeans[i] = bean;
1390        }
1391        
1392        return roleBeans;
1393    }
1394    
1395    
1396    
1397    /*
1398     * Given a User object, get the roles that this User has.
1399     *
1400     * In the returned RoleBean objects, we will only populate the
1401     * rolename.
1402     */

1403    protected RoleBean[] getRolesFromUser(User user) {
1404        
1405        Set JavaDoc roleSet = user.getRoles();
1406        RoleBean[] roleArray = new RoleBean[roleSet.size()];
1407        
1408        int i = 0;
1409        for (Iterator JavaDoc it = roleSet.iterator(); it.hasNext(); i++) {
1410            
1411            RoleBean bean = new RoleBean();
1412            Role role = (Role) it.next();
1413
1414            /*
1415             * only need the rolename
1416             */

1417            bean.setRoleName(role.getRoleName());
1418
1419            roleArray[i] = bean;
1420        }
1421        return roleArray;
1422    }
1423    
1424    
1425    /*
1426     * For roles in the exportRoleBeans parameter, get the set of users that have
1427     * these roles
1428     *
1429     * Do the following:
1430     * Get all users, get the roles they have, see if any of these roles
1431     * are roles found in exportRoleBeans.
1432     */

1433    protected UserBean[] getUsersFromRole(RoleBean[] exportRoleBeans) {
1434        
1435        List JavaDoc userList = mAuth.getUsers(mContext, filterCriteria); // get all users in system
1436

1437        List JavaDoc finalUserNameList = new ArrayList JavaDoc();
1438        
1439        for (Iterator JavaDoc it = userList.iterator(); it.hasNext(); ) { // loop thru all users
1440

1441            User user = (User) it.next();
1442            Set JavaDoc roleSet = user.getRoles();
1443            
1444            for (Iterator JavaDoc it2 = roleSet.iterator(); it2.hasNext(); ) { // loop thru this user's roles
1445

1446                Role role = (Role) it2.next();
1447                
1448                for (int i = 0; i < exportRoleBeans.length; i++) { // check if user's role is in export list
1449

1450                    if ( role.getRoleName().equals(exportRoleBeans[i].getRoleName()) ) {
1451                            
1452                        if (!finalUserNameList.contains(user.getUsername())) { // skip dups
1453
log.debug(" Adding this user, username=" + user.getUsername());
1454                            finalUserNameList.add(user.getUsername());
1455                        }
1456                    }
1457                }
1458            }
1459        }
1460
1461        return handleUsers( (String JavaDoc[]) finalUserNameList.toArray(new String JavaDoc[finalUserNameList.size()]),
1462                NOT_TOP_LEVEL_OBJECT);
1463    }
1464    
1465    
1466    protected InputControlBean[] handleInputControls(ReportUnit unit, boolean isTopLevel) {
1467        
1468        List JavaDoc inputControls = unit.getInputControls();
1469        
1470        InputControlBean[] inputControlBeans = new InputControlBean[inputControls.size()];
1471
1472        int i = 0;
1473        for (Iterator JavaDoc it = inputControls.iterator(); it.hasNext(); i++) {
1474            
1475            ResourceReference resRef = (ResourceReference) it.next();
1476            InputControl ic = (InputControl) dereference(null, resRef);
1477            InputControlBean bean = process(ic, isTopLevel);
1478            
1479            if (resRef.isLocal()) {
1480                bean.setIsUriReference(false);
1481            } else {
1482                bean.setIsUriReference(true);
1483            }
1484            
1485            inputControlBeans[i] = bean;
1486        }
1487        
1488        return inputControlBeans;
1489    }
1490    
1491    
1492    protected FolderBean[] handleSubFolders(Folder topFolder) {
1493        
1494        List JavaDoc subFolders = mRepo.getSubFolders(null, topFolder.getURIString());
1495        
1496        FolderBean[] subFolderBeans = new FolderBean[subFolders.size()];
1497        int i = 0;
1498        
1499        for (Iterator JavaDoc it = subFolders.iterator(); it.hasNext(); i++) {
1500            FolderBean bean = new FolderBean();
1501            Folder folder = (Folder) it.next();
1502            fillCommonBeanFields(bean, folder);
1503            subFolderBeans[i] = bean;
1504        }
1505        return subFolderBeans;
1506    }
1507    
1508    
1509    protected ResourceBean[] handleResourcesInFolder(Folder folder) {
1510        
1511        FilterCriteria filterCriteria = new FilterCriteria();
1512        filterCriteria.addFilterElement( FilterCriteria.createParentFolderFilter(folder.getURIString()) );
1513        
1514        ResourceLookup[] files = mRepo.findResource(null, filterCriteria);
1515        ResourceBean[] resourceBeans = new ResourceBean[files.length];
1516        
1517        for (int i = 0; i < files.length; i++) {
1518            log.debug("file name=" + files[i].getName());
1519            
1520            Resource res = mRepo.getResource(null, files[i].getURIString());
1521                        
1522            if (res instanceof ReportUnit) {
1523                log.debug("file inst of RU");
1524                
1525                ReportUnitBean bean = process( (ReportUnit) res, NOT_TOP_LEVEL_OBJECT);
1526                resourceBeans[i] = bean;
1527                
1528            } else if (res instanceof OlapUnit) {
1529                log.debug("file inst of OlapUnit");
1530                
1531                OlapUnitBean bean = process( (OlapUnit) res, NOT_TOP_LEVEL_OBJECT);
1532                resourceBeans[i] = bean;
1533                
1534            } else if (res instanceof FileResource) {
1535                log.debug("file inst of FR");
1536                
1537                FileResourceBean bean = process( (FileResource) res, NOT_TOP_LEVEL_OBJECT);
1538                resourceBeans[i] = bean;
1539                
1540            } else if (res instanceof ContentResource) {
1541                log.debug("file inst of CR");
1542                
1543                ContentResourceBean bean = process( (ContentResource) res, NOT_TOP_LEVEL_OBJECT);
1544                resourceBeans[i] = bean;
1545                
1546            } else if (res instanceof DataSource) {
1547                log.debug("file inst of DS");
1548                
1549                DataSourceBean bean = process( (DataSource) res, NOT_TOP_LEVEL_OBJECT);
1550                resourceBeans[i] = bean;
1551                
1552            } else if (res instanceof OlapClientConnection) {
1553                log.debug("file inst of OlapClientConnection");
1554                
1555                OlapClientConnectionBean bean = process((OlapClientConnection) res, NOT_TOP_LEVEL_OBJECT);
1556                resourceBeans[i] = bean;
1557
1558            } else if (res instanceof MondrianXMLADefinition) {
1559                log.debug("file inst of MondrianXMLADefinition");
1560                
1561                MondrianXmlaDefinitionBean bean = process((MondrianXMLADefinition) res, NOT_TOP_LEVEL_OBJECT);
1562                resourceBeans[i] = bean;
1563                
1564            } else if (res instanceof InputControl) {
1565                log.debug("file inst of InputControl");
1566                
1567                InputControlBean bean = process( (InputControl) res, NOT_TOP_LEVEL_OBJECT);
1568                resourceBeans[i] = bean;
1569                
1570            } else if (res instanceof DataType) {
1571                log.debug("file inst of DataType");
1572                
1573                DataTypeBean bean = process( (DataType) res, NOT_TOP_LEVEL_OBJECT);
1574                resourceBeans[i] = bean;
1575                
1576            } else if (res instanceof ListOfValues) {
1577                log.debug("file inst of ListOfValues");
1578                
1579                ListOfValuesBean bean = process( (ListOfValues) res, NOT_TOP_LEVEL_OBJECT);
1580                resourceBeans[i] = bean;
1581                
1582            } else if (res instanceof Query) {
1583                log.debug("file inst of Query");
1584                
1585                QueryBean bean = process( (Query) res, NOT_TOP_LEVEL_OBJECT);
1586                resourceBeans[i] = bean;
1587
1588            } else {
1589                log.error("NOT HANDLING THIS RESOURCE TYPE YET, resourceType=" + files[i].getResourceType());
1590            }
1591        }
1592        
1593        return resourceBeans;
1594    }
1595    
1596    
1597    /**
1598     * Determine the processing operations for Users and Roles.
1599     *
1600     * 1) if processAll, then export all users and all roles
1601     * 2) if namedUsers, then export the users listed in the input
1602     * parameter (usernames) (do not include any roles)
1603     * 3) if namesdRoles, then export the roles listed in the input
1604     * paramter (rolenames), *AND* include any users that are
1605     * referenced by these roles.
1606     * 4) if namedUserRoles, then export the users and roles listed
1607     * in the two input parameters (usernames and rolenames).
1608     *
1609     */

1610    protected void checkForUserRoleProcessing() {
1611        
1612        if ((mUserNames == null || mUserNames.length == 0) &&
1613                (mRoleNames == null || mRoleNames.length == 0)) {
1614            mIsAllUsersRoles = true;
1615            
1616        } else if ((mUserNames != null && mUserNames.length > 0) &&
1617                (mRoleNames == null || mRoleNames.length == 0)) {
1618            mIsNamedUsers = true;
1619            
1620        } else if ((mRoleNames != null && mRoleNames.length > 0) &&
1621                (mUserNames == null || mUserNames.length == 0)) {
1622            mIsNamedRoles = true;
1623            
1624        } else if ((mUserNames != null && mUserNames.length > 0) &&
1625                (mRoleNames != null && mRoleNames.length > 0)) {
1626            mIsNamedUsersRoles = true;
1627            
1628        } else {
1629            log.error("ERROR: User Role processing operation unknown");
1630        }
1631        
1632        log.warn(" ----- User-Role Processing Values:");
1633        log.warn(" mIsAllUsersRoles=" + mIsAllUsersRoles);
1634        log.warn(" mIsNamedUsers=" + mIsNamedUsers);
1635        log.warn(" mIsNamedRoles=" + mIsNamedRoles);
1636        log.warn(" mIsNamedUsersRoles=" + mIsNamedUsersRoles);
1637    }
1638    
1639    
1640    /**
1641     * Write out the ji-catalog xml file
1642     *
1643     * @param bean
1644     */

1645    protected void writeCatalogFile(ExportImportBean bean) {
1646        log.debug("top of writeCatalogFile()");
1647        
1648        try {
1649            File JavaDoc dir = new File JavaDoc(mCatalogDirName);
1650            dir.mkdir();
1651            File JavaDoc outCatalog = new File JavaDoc(dir, mCatalogFileName);
1652            FileWriter JavaDoc writer = new FileWriter JavaDoc(outCatalog);
1653
1654            Marshaller marshaller = new Marshaller(writer);
1655            marshaller.setMapping(MappingHelper.getExportImportBeanMapping());
1656            marshaller.marshal(bean);
1657            
1658            System.out.println("ExportResource: writeCatalogFile(): catDir=" + mCatalogDirName + ", catFile=" + mCatalogFileName);
1659            log.debug("ExportResource: writeCatalogFile(): outCatalog=" + outCatalog.toString());
1660            
1661        } catch (Exception JavaDoc e) {
1662            log.error("caught exception creating catalog file: " + e.getMessage());
1663            e.printStackTrace();
1664        }
1665    }
1666    
1667
1668    /*
1669     * recurse through the FolderBean and write data
1670     */

1671    protected void writeCatalogData(FolderBean bean) {
1672        
1673        ResourceBean[] resourceBeans = bean.getResources();
1674        
1675        for (int i = 0; i < resourceBeans.length; i++) {
1676            
1677            // write data for resources that hold data
1678
if (resourceBeans[i] instanceof FileResourceBean) {
1679                
1680                writeCatalogData( (FileResourceBean) resourceBeans[i]);
1681                
1682            } else if (resourceBeans[i] instanceof ContentResourceBean) {
1683                
1684                writeCatalogData( (ContentResourceBean) resourceBeans[i]);
1685                
1686            } else if (resourceBeans[i] instanceof ReportUnitBean) {
1687                
1688                writeCatalogData( (ReportUnitBean) resourceBeans[i]);
1689                
1690            } else {
1691                log.debug("DEBUG: skipped bean resource (for write data), name=" + resourceBeans[i].getName());
1692            }
1693        }
1694        
1695        FolderBean[] folderBeans = bean.getFolders();
1696        
1697        for (int j = 0; j < folderBeans.length; j++) {
1698            
1699            writeCatalogDataFolder(folderBeans[j]);
1700        }
1701    }
1702    
1703    // todo: see about removing this method
1704
protected void writeCatalogDataFolder(FolderBean bean) {
1705        
1706        ResourceBean[] resourceBeans = bean.getResources();
1707        
1708        for (int i = 0; i < resourceBeans.length; i++) {
1709            
1710            // write data for resources that hold data
1711
if (resourceBeans[i] instanceof FileResourceBean) {
1712                
1713                writeCatalogData( (FileResourceBean) resourceBeans[i]);
1714                
1715            } else if (resourceBeans[i] instanceof ContentResourceBean) {
1716                
1717                writeCatalogData( (ContentResourceBean) resourceBeans[i]);
1718                
1719            } else if (resourceBeans[i] instanceof ReportUnitBean) {
1720                
1721                writeCatalogData( (ReportUnitBean) resourceBeans[i]);
1722                
1723            } else {
1724                log.debug("DEBUG2: skipped bean resource (for write data), name=" + resourceBeans[i].getName());
1725            }
1726        }
1727        
1728        FolderBean[] folderBeans = bean.getFolders();
1729        
1730        for (int j = 0; j < folderBeans.length; j++) {
1731            
1732            writeCatalogDataFolder(folderBeans[j]);
1733        }
1734    }
1735    
1736    
1737    protected void writeCatalogData(ReportUnitBean bean) {
1738        log.debug("top of writeCatalogData(RU)");
1739        
1740        writeCatalogDataMainReport(bean.getMainReport());
1741        
1742        FileResourceBean[] resourceBeans = bean.getResources();
1743        
1744        for (int i = 0; i < resourceBeans.length; i++) {
1745            writeCatalogData(resourceBeans[i]);
1746        }
1747    }
1748
1749    protected void writeCatalogData(OlapUnitBean bean) {
1750        log.debug("top of writeCatalogData(OlapUnitBean)");
1751
1752        writeCatalogData(bean.getOlapClientConnection());
1753    }
1754    
1755    protected void writeCatalogData(OlapClientConnectionBean bean) {
1756        log.debug("top of writeCatalogData(OlapClientConnectionBean)");
1757
1758        if (bean.getConnectionType().equals(OlapClientConnectionBean.CONN_TYPE_MONDRIAN)) {
1759            
1760            writeCatalogData( ((MondrianConnectionBean) bean).getSchema()); // schema is a FileResource
1761
}
1762    }
1763    
1764    protected void writeCatalogData(MondrianXmlaDefinitionBean bean) {
1765        log.debug("top of writeCatalogData(MondrianXmlaDefinitionBean)");
1766        
1767        MondrianConnectionBean mondBean = bean.getMondrianConnection();
1768        
1769        writeCatalogData(mondBean.getSchema()); // schema is a FileResource
1770
}
1771    
1772
1773    protected void writeCatalogDataMainReport(FileResourceBean bean) {
1774
1775        File JavaDoc parentPath = null;
1776        String JavaDoc name = null;
1777        FileResourceData data = null;
1778
1779        try {
1780            parentPath = createParentPath(bean);
1781            data = mRepo.getResourceData(null, bean.getUriString());
1782            
1783            if (data != null) {
1784                FileOutputStream JavaDoc out = new FileOutputStream JavaDoc(new File JavaDoc(parentPath, bean.getName()));
1785                out.write(data.getData());
1786            }
1787        } catch (Exception JavaDoc e) {
1788            log.error("ERROR: caught exception processing data to disk, file="
1789                    + parentPath + PATH_SEP + bean.getName() + ", exception: " + e.getMessage());
1790            e.printStackTrace();
1791        }
1792    }
1793    
1794    
1795    protected void writeCatalogData(FileResourceBean bean) {
1796        log.debug("top of writeCatalogData(FileResourceBean)");
1797        
1798        File JavaDoc parentPath = null;
1799        String JavaDoc name = null;
1800        FileResourceData data = null;
1801        
1802        try {
1803            
1804            if (bean.getIsReference()) {
1805                
1806                /*
1807                 * it's a link so save data from linkedTarget
1808                 */

1809                parentPath = createParentPath(bean.getLinkTarget());
1810                data = mRepo.getResourceData(null, bean.getLinkTarget().getUriString());
1811                name = bean.getLinkTarget().getName();
1812                
1813            } else {
1814                
1815                parentPath = createParentPath(bean);
1816                data = mRepo.getResourceData(null, bean.getUriString());
1817                name = bean.getName();
1818            }
1819            
1820            if (data != null) {
1821                FileOutputStream JavaDoc out = new FileOutputStream JavaDoc(new File JavaDoc(parentPath, name));
1822                
1823                log.debug("number of bytes to write out=" + data.getData().length);
1824                
1825                out.write(data.getData());
1826            }
1827                        
1828        } catch (Exception JavaDoc e) {
1829            log.error("ERROR: caught exception processing data to disk, file="
1830                    + parentPath + PATH_SEP + name + ", exception: " + e.getMessage());
1831            e.printStackTrace();
1832        }
1833    }
1834    
1835    protected void writeCatalogData(ContentResourceBean bean) {
1836
1837        File JavaDoc parentPath = null;
1838        String JavaDoc name = null;
1839        FileResourceData data = null;
1840        
1841        try {
1842            
1843            if (bean.getIsReference()) {
1844                
1845                log.debug(" in writeCatalogData(CRB), bean is reference, bean.name=" + bean.getName());
1846                
1847                /*
1848                 * it's a link so save data from linkedTarget
1849                 */

1850                parentPath = createParentPath(bean.getLinkTarget());
1851                data = mRepo.getContentResourceData(null, bean.getLinkTarget().getUriString());
1852                name = bean.getLinkTarget().getName();
1853                
1854            } else {
1855            
1856                log.debug(" in writeCatalogData(CRB), bean is NOT reference, bean.name=" + bean.getName());
1857                
1858                parentPath = createParentPath(bean);
1859                data = mRepo.getContentResourceData(null, bean.getUriString());
1860                name = bean.getName();
1861            }
1862            
1863            if (data != null) {
1864                FileOutputStream JavaDoc out = new FileOutputStream JavaDoc(new File JavaDoc(parentPath, name));
1865                out.write(data.getData());
1866            }
1867            
1868            /*
1869             * write out child resources
1870             */

1871            
1872            if (bean.getResources() != null) {
1873                
1874                ContentResourceBean[] childResources = bean.getResources();
1875                
1876                for (int i = 0; i < childResources.length; i++) {
1877                    writeCatalogData(childResources[i]);
1878                }
1879            }
1880            
1881        } catch (Exception JavaDoc e) {
1882            log.error("ERROR: caught exception processing data to disk, file="
1883                    + parentPath + PATH_SEP + name + ", exception: " + e.getMessage());
1884            e.printStackTrace();
1885        }
1886    }
1887    
1888    
1889    
1890    /**
1891     * Create a path on disk. This will be the path to the resource data to be
1892     * written out. The on-disk path matches the path for the resource in the
1893     * repository.
1894     *
1895     * @param ResourceBean
1896     * @return File
1897     */

1898    protected File JavaDoc createParentPath(ResourceBean bean) {
1899        File JavaDoc parentPath = new File JavaDoc(mCatalogDirName, bean.getParentFolder());
1900        
1901        if (!parentPath.exists()) {
1902            if(!parentPath.mkdirs()) { // create path on disk
1903
log.error("ERROR: Error creating parent path, path=" + bean.getParentFolder());
1904            }
1905        }
1906        return parentPath;
1907    }
1908    
1909    
1910    public Resource dereference( ExecutionContext mContext, ResourceReference ref ) {
1911        if (ref.isLocal()) {
1912            return ref.getLocalResource();
1913        } else {
1914            return mRepo.getResource( null, ref.getReferenceLookup().getURIString() );
1915        }
1916    }
1917    
1918    
1919    /**
1920     * Set the member vars found in the ResourceBean
1921     *
1922     * @param uri
1923     * @throws Exception
1924     */

1925    protected void fillCommonBeanFields(ResourceBean bean, Resource res) {
1926        bean.setName(res.getName());
1927        bean.setLabel(res.getLabel());
1928        bean.setDescription(res.getDescription());
1929        bean.setUriString(res.getURIString());
1930        bean.setParentFolder(res.getParentFolder());
1931        bean.setResourceType(res.getResourceType());
1932        bean.setIsNew(res.isNew());
1933        bean.setCreationDate(res.getCreationDate());
1934        bean.setVersion(res.getVersion());
1935        bean.setProductReleaseVersion(PRODUCT_VERSION_1_0);
1936    }
1937    
1938    protected void fillBean(FileResourceBean bean, FileResource fileResource) {
1939        
1940        fillCommonBeanFields(bean, fileResource);
1941        
1942        bean.setHasData(fileResource.hasData());
1943        
1944        bean.setResourceBeanType( bean.getClass().toString() );
1945    }
1946    
1947    protected void fillBean(ContentResourceBean bean, ContentResource contentResource) {
1948        
1949        fillCommonBeanFields(bean, contentResource);
1950        
1951        bean.setHasData(contentResource.hasData());
1952        
1953        bean.setResourceBeanType( bean.getClass().toString() );
1954        
1955    }
1956    
1957    protected void fillBean(JdbcDataSourceBean bean, JdbcReportDataSource dataSource) {
1958
1959        fillCommonBeanFields(bean, dataSource);
1960
1961        bean.setDataSourceType(DataSourceBean.DS_TYPE_JDBC);
1962        bean.setDriverClass(dataSource.getDriverClass());
1963        bean.setConnectionUrl(dataSource.getConnectionUrl());
1964        bean.setUsername(dataSource.getUsername());
1965        bean.setPassword(dataSource.getPassword());
1966    }
1967    
1968    protected void fillBean(JndiJdbcDataSourceBean bean, JndiJdbcReportDataSource dataSource) {
1969    
1970        fillCommonBeanFields(bean, dataSource);
1971        
1972        bean.setDataSourceType(DataSourceBean.DS_TYPE_JNDI_JDBC);
1973        bean.setJndiName(dataSource.getJndiName());
1974    }
1975    
1976    protected void fillBean(OlapUnitBean bean, OlapUnit unit) {
1977        
1978        fillCommonBeanFields(bean, unit);
1979
1980        bean.setMdxQuery(unit.getMdxQuery());
1981    }
1982    
1983    protected void fillBean(XmlaConnectionBean bean, XMLAConnection conn) {
1984        
1985        fillCommonBeanFields(bean, conn);
1986        
1987        bean.setConnectionType(OlapClientConnectionBean.CONN_TYPE_XMLA);
1988        bean.setUri(conn.getURI());
1989        bean.setDataSource(conn.getDataSource());
1990        bean.setCatalog(conn.getCatalog());
1991        bean.setUsername(conn.getUsername());
1992        bean.setPassword(conn.getPassword());
1993    }
1994    
1995    protected void fillBean(MondrianConnectionBean bean, MondrianConnection conn) {
1996        
1997        fillCommonBeanFields(bean, conn);
1998        
1999        bean.setConnectionType(OlapClientConnectionBean.CONN_TYPE_MONDRIAN);
2000        
2001    }
2002    
2003    protected void fillBean(MondrianXmlaDefinitionBean bean, MondrianXMLADefinition xDef) {
2004        
2005        fillCommonBeanFields(bean, xDef);
2006        
2007        bean.setCatalog(xDef.getCatalog());
2008    }
2009    
2010    protected void fillBean(InputControlBean bean, InputControl ic) {
2011        
2012        fillCommonBeanFields(bean, ic);
2013        
2014        bean.setType(ic.getType());
2015        bean.setIsMandatory(ic.isMandatory());
2016        bean.setIsReadOnly(ic.isReadOnly());
2017        bean.setQueryVisibleColumns(ic.getQueryVisibleColumns());
2018        bean.setQueryValueColumn(ic.getQueryValueColumn());
2019        if (ic.getDefaultValue() != null) {
2020            bean.setDefaultValue(ic.getDefaultValue().toString());
2021        }
2022        
2023        // convert List to String array
2024
if (ic.getDefaultValues() != null) {
2025            List JavaDoc values = ic.getDefaultValues();
2026            bean.setDefaultValues((String JavaDoc[]) values.toArray(new String JavaDoc[values.size()]));
2027        }
2028    }
2029    
2030    protected void fillBean(DataTypeBean bean, DataType dt) {
2031        
2032        fillCommonBeanFields(bean, dt);
2033        
2034        bean.setType(dt.getType());
2035        bean.setMaxLength(dt.getMaxLength());
2036        bean.setDecimals(dt.getDecimals());
2037        bean.setRegularExpr(dt.getRegularExpr());
2038        
2039        if (dt.getMinValue() != null) {
2040            bean.setMinValue(dt.getMinValue().toString());
2041        }
2042        if (dt.getMaxValue() != null) {
2043            bean.setMaxValue(dt.getMaxValue().toString());
2044        }
2045        bean.setIsStrictMax(dt.isStrictMax());
2046        bean.setIsStrictMin(dt.isStrictMin());
2047    }
2048    
2049    protected void fillBean(ListOfValuesBean bean, ListOfValues listOfValues) {
2050
2051        fillCommonBeanFields(bean, listOfValues);
2052        
2053        ListOfValuesItem[] items = listOfValues.getValues();
2054        ListOfValuesItemBean[] beanItems = new ListOfValuesItemBean[items.length];
2055        
2056        for (int i = 0; i < items.length; i++) {
2057            ListOfValuesItemBean itemBean = new ListOfValuesItemBean();
2058            itemBean.setLabel(items[i].getLabel());
2059            itemBean.setValue(items[i].getValue().toString());
2060            beanItems[i] = itemBean;
2061        }
2062        
2063        bean.setValues(beanItems);
2064    }
2065    
2066    protected void fillBean(QueryBean bean, Query query) {
2067        
2068        fillCommonBeanFields(bean, query);
2069        
2070        bean.setLanguage(query.getLanguage());
2071        bean.setSql(query.getSql());
2072    }
2073    
2074}
2075
Popular Tags