001: package com.calipso.reportgenerator.enterprise.server;
002:
003: import com.calipso.reportgenerator.reportdefinitions.*;
004: import com.calipso.reportgenerator.common.*;
005: import com.calipso.reportgenerator.reportcalculator.Matrix;
006: import com.calipso.reportgenerator.reportmanager.ReportManager;
007: import com.calipso.reportgenerator.common.InfoException;
008: import javax.ejb.SessionContext;
009: import java.util.Map;
010: import java.util.Set;
011: import java.util.Vector;
012: import java.util.Collection;
013:
014: /**
015: * Enterprise Java Bean que crea y guarda una instancia de ReportManager.
016: * Implementa SessionBean, es decir, debe definir todos los métodos
017: * de la interface que serán los que harán posible la comunicaciones entre
018: * el Bean y el Container debido a la ocurrencia de eventos determinados.
019: */
020:
021: /**
022: * Esta clase corresponde a las ejecución de un ReportManager como un StateFul.
023: * Publica los métodos del ReportManager a los cuales le reenvía la ejecución agregando throws InfoException por el contexto que se ejecuta.
024: * @see com.calipso.reportgenerator.reportmanager.ReportManager
025: */
026: public class ReportManagerSFBean implements javax.ejb.SessionBean {
027:
028: private SessionContext ctx;
029: private IReportManager reportManager;
030:
031: /**
032: * Metodo responsable de asociar al bean con un ambiente.
033: */
034: public void setSessionContext(SessionContext ctx) {
035: this .ctx = ctx;
036: }
037:
038: /**
039: * Metodo requerido por el EJB Container
040: * @param reportGeneratorConfiguration características de configuración como path del repositorio, host, port.
041: * @throws com.calipso.reportgenerator.common.InfoException
042: */
043: public void ejbCreate(
044: ReportGeneratorConfiguration reportGeneratorConfiguration)
045: throws InfoException {
046: LanguageTraslator.newLocaleFrom(reportGeneratorConfiguration
047: .getLocaleLanguage(), reportGeneratorConfiguration
048: .getCountry(), reportGeneratorConfiguration
049: .getLanguagesPath());
050: try {
051: IReportManager reportManager = new ReportManager();
052: reportManager.init(reportGeneratorConfiguration);
053: this .reportManager = reportManager;
054: } catch (Exception e) {
055: throw new InfoException(e);
056: }
057: }
058:
059: /**
060: * Método requerido por el EJB Container
061: */
062: public void ejbRemove() {
063: }
064:
065: /**
066: * Método requerido por el EJB Container
067: */
068: public void ejbActivate() {
069: }
070:
071: /**
072: * Método requerido por el EJB Container
073: */
074: public void ejbPassivate() {
075: }
076:
077: public int PrepareReport(String reportDefID) throws InfoException {
078: return reportManager.PrepareReport(reportDefID);
079: }
080:
081: public int PrepareReport(String reportDefId, Map paramValues)
082: throws InfoException {
083: return reportManager.PrepareReport(reportDefId, paramValues);
084: }
085:
086: public void ReleaseReport(int handle) throws InfoException {
087: reportManager.ReleaseReport(handle);
088: }
089:
090: public void prepareReportSource(String reportSourceDefinitionId)
091: throws InfoException {
092: reportManager.prepareReportSource(reportSourceDefinitionId);
093: }
094:
095: public Map getReportDefinitions() throws InfoException {
096: return reportManager.getReportDefinitions();
097: }
098:
099: public Map getReportSourceDefinitions() throws InfoException {
100: return reportManager.getReportSourceDefinitions();
101: }
102:
103: public Map getReportsForEntity(String entityID)
104: throws InfoException {
105: return reportManager.getReportsForEntity(entityID);
106: }
107:
108: public void ExecuteAction(int handle, String actionName,
109: Object params) throws InfoException {
110: reportManager.ExecuteAction(handle, actionName, params);
111: }
112:
113: public void invalidateReportSource(String reportSourceDefinitionId)
114: throws InfoException {
115: reportManager.invalidateReportSource(reportSourceDefinitionId);
116: }
117:
118: public ReportQuery getReportQuery(int handle) throws InfoException {
119: return reportManager.getReportQuery(handle);
120: }
121:
122: public ReportQuery getDefaultReportQuery(int handle)
123: throws InfoException {
124: return reportManager.getDefaultReportQuery(handle);
125: }
126:
127: public ReportQuery getReportQuery(String reportDefinitionId)
128: throws InfoException {
129: return reportManager.getReportQuery(reportDefinitionId);
130: }
131:
132: public ReportQuery getDefaultReportQuery(String reportDefinitionId)
133: throws InfoException {
134: return reportManager.getDefaultReportQuery(reportDefinitionId);
135: }
136:
137: public ReportResult ExecReportQuery(int handle, Map paramValues)
138: throws InfoException {
139: return reportManager.ExecReportQuery(handle, paramValues);
140: }
141:
142: public ReportResult ExecReportQuery(int handle, ReportQuery query)
143: throws InfoException {
144: return reportManager.ExecReportQuery(handle, query);
145: }
146:
147: public ReportResult ExecReportQuery(String reportDefinitionID,
148: Map paramValues) throws InfoException {
149: return ExecReportQuery(reportDefinitionID, paramValues);
150: }
151:
152: public ReportResult ExecReportQuery(String reportDefinitionID,
153: ReportQuery query) throws InfoException {
154: return reportManager.ExecReportQuery(reportDefinitionID, query);
155: }
156:
157: public ReportQuery getDefaultReportQuery(int handle, String userID)
158: throws InfoException {
159: return reportManager.getDefaultReportQuery(handle, userID);
160: }
161:
162: public ReportResult ExecReportQuery(int handle,
163: ReportView reportView) throws InfoException {
164: return reportManager.ExecReportQuery(handle, reportView);
165: }
166:
167: public ReportView getReportViewFromID(String id,
168: String reportDefinitionId, String userId)
169: throws InfoException {
170: return reportManager.getReportViewFromID(id,
171: reportDefinitionId, userId);
172: }
173:
174: public void saveReportView(ReportView reportView)
175: throws InfoException {
176: reportManager.saveReportView(reportView);
177: }
178:
179: public ReportSpec getReportSpec(String reportDefinitionId,
180: String reportSourceDefId) throws InfoException {
181: return reportManager.getReportSpec(reportDefinitionId,
182: reportSourceDefId);
183: }
184:
185: public ReportSpec getReportSpec(ReportDefinition reportDefinition,
186: ReportSourceDefinition reportSourceDef)
187: throws InfoException {
188: return reportManager.getReportSpec(reportDefinition,
189: reportSourceDef);
190: }
191:
192: public ReportSpec getReportSpec(String reportDefinitionId)
193: throws InfoException {
194: return reportManager.getReportSpec(reportDefinitionId);
195: }
196:
197: public Map getReportViews(String reportDefinitionID, String userID)
198: throws InfoException {
199: return reportManager.getReportViews(reportDefinitionID, userID);
200: }
201:
202: public Map getReportViews(String reportDefinitionID)
203: throws InfoException {
204: return reportManager.getReportViews(reportDefinitionID);
205: }
206:
207: public void registerDefinitions() throws InfoException {
208: reportManager.registerDefinitions();
209: }
210:
211: public void deleteAllRepositories() throws InfoException {
212: reportManager.deleteAllRepositories();
213: }
214:
215: public void deleteAllDefinitions() throws InfoException {
216: reportManager.deleteAllDefinitions();
217: }
218:
219: public void deleteReportSourceRepository() throws InfoException {
220: reportManager.deleteReportSourceRepository();
221: }
222:
223: public void deleteReportSourceDefinitionRepository()
224: throws InfoException {
225: reportManager.deleteReportSourceDefinitionRepository();
226: }
227:
228: public void deleteReportDefinitionRepository() throws InfoException {
229: reportManager.deleteReportDefinitionRepository();
230: }
231:
232: public void deleteReportViewRepository() throws InfoException {
233: reportManager.deleteReportViewRepository();
234: }
235:
236: public void deleteReportView(String id, String reportDefinitionId,
237: String userId) throws InfoException {
238: reportManager.deleteReportView(id, reportDefinitionId, userId);
239: }
240:
241: public void deleteReportSource(String reportSourceDefinitionId)
242: throws InfoException {
243: reportManager.deleteReportSource(reportSourceDefinitionId);
244: }
245:
246: public void deleteReportSourceDefinition(
247: String reportSourceDefinitionID) throws InfoException {
248: reportManager
249: .deleteReportSourceDefinition(reportSourceDefinitionID);
250: }
251:
252: public void deleteReportDefinition(String reportDefinitionID)
253: throws InfoException {
254: reportManager.deleteReportDefinition(reportDefinitionID);
255: }
256:
257: public void assingDefaultView(String id, String reportDefinitionId,
258: String userId) throws InfoException {
259: reportManager.assingDefaultView(id, reportDefinitionId, userId);
260: }
261:
262: public Vector registerReportSourceDefinitions(Vector vector)
263: throws InfoException {
264: return reportManager.registerReportSourceDefinitions(vector);
265: }
266:
267: public Vector registerReportDefinitions(Vector vector)
268: throws InfoException {
269: return reportManager.registerReportDefinitions(vector);
270: }
271:
272: public Vector registerReportViews(Vector vector)
273: throws InfoException {
274: return reportManager.registerReportViews(vector);
275: }
276:
277: public String getDefaultReportViewId(String reportDefinitionId,
278: String userId) throws InfoException {
279: return reportManager.getDefaultReportViewId(reportDefinitionId,
280: userId);
281: }
282:
283: public ReportResult ExecReportQuery(MicroReport microReport)
284: throws InfoException {
285: return reportManager.ExecReportQuery(microReport);
286: };
287:
288: public int PrepareReport(MicroReport microReport)
289: throws InfoException {
290: return reportManager.PrepareReport(microReport);
291: };
292:
293: public Matrix getMatrix(int handle) throws InfoException {
294: return reportManager.getMatrix(handle);
295: }
296:
297: public String getXML(int handle) throws InfoException {
298: return reportManager.getXML(handle);
299: };
300:
301: public String getXML(String reportDefinitionID, Map paramValues)
302: throws InfoException {
303: return reportManager.getXML(reportDefinitionID, paramValues);
304: };
305:
306: public Set getDimensionValues(int handle, String name)
307: throws InfoException {
308: return reportManager.getDimensionValues(handle, name);
309: };
310:
311: public Set getDimensionValues(String reportDefinitionID,
312: Map paramValues, String name) throws InfoException {
313: return reportManager.getDimensionValues(reportDefinitionID,
314: paramValues, name);
315: };
316:
317: public Vector getUpdatedDataModel(int handle, int mode, int row,
318: int col, boolean isDistributed) throws InfoException {
319: return reportManager.getUpdatedDataModel(handle, mode, row,
320: col, isDistributed);
321: };
322:
323: public ReportView getReportView(String reportViewId)
324: throws InfoException {
325: return reportManager.getReportView(reportViewId);
326: };
327:
328: public ReportResult ExecReportQuery(int handle, String reportViewId)
329: throws InfoException {
330: return reportManager.ExecReportQuery(handle, reportViewId);
331: }
332:
333: public void saveReportDefinition(ReportDefinition reportDefinition)
334: throws InfoException {
335: reportManager.saveReportDefinition(reportDefinition);
336: };
337:
338: public void saveReportSourceDefinition(
339: ReportSourceDefinition reportSourceDefinition)
340: throws InfoException {
341: reportManager
342: .saveReportSourceDefinition(reportSourceDefinition);
343: };
344:
345: public ReportDefinition getReportDefinitionFromID(
346: String reportDefinitionId) throws InfoException {
347: return reportManager
348: .getReportDefinitionFromID(reportDefinitionId);
349: };
350:
351: public ReportSourceDefinition getReportSourceDefinitionFromID(
352: String reportSourceDefinitionId) throws InfoException {
353: return reportManager
354: .getReportSourceDefinitionFromID(reportSourceDefinitionId);
355: };
356:
357: public boolean validateUser(String userName, String password,
358: String userRepositoryPath) throws InfoException {
359: return reportManager.validateUser(userName, password,
360: userRepositoryPath);
361: }
362:
363: public void exportReport(String userName, String password,
364: String userRepositoryPath, String reportDefinitionId,
365: Map paramValues, boolean isLandscape, int type,
366: String destinationPath, String name) throws InfoException {
367: reportManager.exportReport(userName, password,
368: userRepositoryPath, reportDefinitionId, paramValues,
369: isLandscape, type, destinationPath, name);
370: };
371:
372: public byte[] exportReport(Map params) throws InfoException {
373: return reportManager.exportReport(params);
374: }
375:
376: public boolean addNewUser(String rootPasswd, String userName,
377: String password, String userRepositoryPath)
378: throws InfoException {
379: return reportManager.addNewUser(rootPasswd, userName, password,
380: userRepositoryPath);
381: }
382:
383: public boolean validateRol(String[] roles, String userName,
384: String rolRepositoryPath) throws InfoException {
385: return reportManager.validateRol(roles, userName,
386: rolRepositoryPath);
387: }
388:
389: public void addUserData(String userName, String name,
390: String company, String userDataRepositoryPath)
391: throws InfoException {
392: reportManager.addUserData(userName, name, company,
393: userDataRepositoryPath);
394: }
395:
396: public void addUserRol(String userName, String rol,
397: String rolsRepositoryPath) throws InfoException {
398: reportManager.addUserRol(userName, rol, rolsRepositoryPath);
399: }
400:
401: public MicroReport getMicroReport(String fileName)
402: throws InfoException {
403: return reportManager.getMicroReport(fileName);
404: }
405:
406: public MicroReport getMicroReport(String id, Map params)
407: throws InfoException {
408: return reportManager.getMicroReport(id, params);
409: }
410:
411: public Collection getUserData(String userId,
412: String userDataRepositoryPath) throws InfoException {
413: return reportManager
414: .getUserData(userId, userDataRepositoryPath);
415: }
416:
417: public void logClientData(String clientData) throws InfoException {
418: reportManager.logClientData(clientData);
419: }
420:
421: public boolean isAcceptedLicence() throws InfoException {
422: return reportManager.isAcceptedLicence();
423: }
424:
425: public void acceptedLicence(boolean value) throws InfoException {
426: reportManager.acceptedLicence(value);
427: }
428:
429: }
|