001: package com.calipso.reportgenerator.enterprise.server;
002:
003: import com.calipso.reportgenerator.common.*;
004: import com.calipso.reportgenerator.reportdefinitions.ReportView;
005: import com.calipso.reportgenerator.reportdefinitions.ReportDefinition;
006: import com.calipso.reportgenerator.reportdefinitions.ReportSourceDefinition;
007: import com.calipso.reportgenerator.reportcalculator.Matrix;
008: import com.calipso.reportgenerator.reportmanager.ReportManager;
009: import com.calipso.reportgenerator.common.InfoException;
010: import javax.ejb.SessionContext;
011: import java.util.Map;
012: import java.util.Set;
013: import java.util.Vector;
014: import java.util.Collection;
015:
016: /**
017: * Enterprise Java Bean que crea y guarda una instancia de ReportManager.
018: * Implementa SessionBean, es decir, debe definir todos los métodos
019: * de la interface que serán los que harán posible la comunicaciones entre
020: * el Bean y el Container debido a la ocurrencia de eventos determinados.
021: * Publica los métodos del ReportManager a los cuales le reenvía la ejecución agregando throws InfoException por el contexto que se ejecuta.
022: * @see com.calipso.reportgenerator.reportmanager.ReportManager
023: */
024:
025: public class ReportManagerSLBean implements javax.ejb.SessionBean {
026:
027: private SessionContext ctx;
028:
029: /**
030: * Metodo responsable de asociar al bean con un ambiente.
031: */
032: public void setSessionContext(SessionContext ctx) {
033: this .ctx = ctx;
034: }
035:
036: /**
037: * Obtiene un ReportManagera partir de la configuración especificada en ReportManagerConfiguration
038: * @param reportGeneratorConfiguration la configuracion que especifica path de los repositorios
039: * , si es distribuida, host, port.
040: * @return interface que publica los métodos a invocar por parte del usuario
041: */
042: private IReportManager getReportManager(
043: ReportGeneratorConfiguration reportGeneratorConfiguration)
044: throws InfoException {
045: LanguageTraslator.newLocaleFrom(reportGeneratorConfiguration
046: .getLocaleLanguage(), reportGeneratorConfiguration
047: .getCountry(), reportGeneratorConfiguration
048: .getLanguagesPath());
049: try {
050: IReportManager reportManager = new ReportManager();
051: reportManager.init(reportGeneratorConfiguration);
052: return reportManager;
053: } catch (Exception e) {
054: throw new InfoException(e);
055: }
056: }
057:
058: /**
059: * Método requerido por el EJB Container
060: */
061: public void ejbCreate() {
062: }
063:
064: /**
065: * Método requerido por el EJB Container
066: */
067: public void ejbRemove() {
068: }
069:
070: /**
071: * Método requerido por el EJB Container
072: */
073: public void ejbActivate() {
074: }
075:
076: /**
077: * Método requerido por el EJB Container
078: */
079: public void ejbPassivate() {
080: }
081:
082: public int PrepareReport(
083: ReportGeneratorConfiguration configuration,
084: String reportDefID) throws InfoException {
085: return getReportManager(configuration).PrepareReport(
086: reportDefID);
087: }
088:
089: public int PrepareReport(
090: ReportGeneratorConfiguration configuration,
091: String reportDefId, Map paramValues) throws InfoException {
092: return getReportManager(configuration).PrepareReport(
093: reportDefId, paramValues);
094: }
095:
096: public void ReleaseReport(
097: ReportGeneratorConfiguration configuration, int handle)
098: throws InfoException {
099: getReportManager(configuration).ReleaseReport(handle);
100: }
101:
102: public void prepareReportSource(
103: ReportGeneratorConfiguration configuration,
104: String reportSourceDefinitionId) throws InfoException {
105: getReportManager(configuration).prepareReportSource(
106: reportSourceDefinitionId);
107: }
108:
109: public Map getReportDefinitions(
110: ReportGeneratorConfiguration configuration)
111: throws InfoException {
112: return getReportManager(configuration).getReportDefinitions();
113: }
114:
115: public Map getReportSourceDefinitions(
116: ReportGeneratorConfiguration configuration)
117: throws InfoException {
118: return getReportManager(configuration)
119: .getReportSourceDefinitions();
120: }
121:
122: public Map getReportsForEntity(
123: ReportGeneratorConfiguration configuration, String entityID)
124: throws InfoException {
125: return getReportManager(configuration).getReportsForEntity(
126: entityID);
127: }
128:
129: public void ExecuteAction(
130: ReportGeneratorConfiguration configuration, int handle,
131: String actionName, Object params) throws InfoException {
132: getReportManager(configuration).ExecuteAction(handle,
133: actionName, params);
134: }
135:
136: public void invalidateReportSource(
137: ReportGeneratorConfiguration configuration,
138: String reportSourceDefinitionId) throws InfoException {
139: getReportManager(configuration).invalidateReportSource(
140: reportSourceDefinitionId);
141: }
142:
143: public ReportQuery getReportQuery(
144: ReportGeneratorConfiguration configuration, int handle)
145: throws InfoException {
146: return getReportManager(configuration).getReportQuery(handle);
147: }
148:
149: public ReportQuery getDefaultReportQuery(
150: ReportGeneratorConfiguration configuration, int handle)
151: throws InfoException {
152: return getReportManager(configuration).getDefaultReportQuery(
153: handle);
154: }
155:
156: public ReportQuery getReportQuery(
157: ReportGeneratorConfiguration configuration,
158: String reportDefinitionId) throws InfoException {
159: return getReportManager(configuration).getReportQuery(
160: reportDefinitionId);
161: }
162:
163: public ReportQuery getDefaultReportQuery(
164: ReportGeneratorConfiguration configuration,
165: String reportDefinitionId) throws InfoException {
166: return getReportManager(configuration).getDefaultReportQuery(
167: reportDefinitionId);
168: }
169:
170: public ReportResult ExecReportQuery(
171: ReportGeneratorConfiguration configuration, int handle,
172: Map paramValues) throws InfoException {
173: return getReportManager(configuration).ExecReportQuery(handle,
174: paramValues);
175: }
176:
177: public ReportResult ExecReportQuery(
178: ReportGeneratorConfiguration configuration, int handle,
179: ReportQuery query) throws InfoException {
180: return getReportManager(configuration).ExecReportQuery(handle,
181: query);
182: }
183:
184: public ReportResult ExecReportQuery(
185: ReportGeneratorConfiguration configuration,
186: String reportDefinitionID, Map paramValues)
187: throws InfoException {
188: return getReportManager(configuration).ExecReportQuery(
189: reportDefinitionID, paramValues);
190: }
191:
192: public ReportResult ExecReportQuery(
193: ReportGeneratorConfiguration configuration,
194: String reportDefinitionID, ReportQuery query)
195: throws InfoException {
196: return getReportManager(configuration).ExecReportQuery(
197: reportDefinitionID, query);
198: }
199:
200: public ReportQuery getDefaultReportQuery(
201: ReportGeneratorConfiguration configuration, int handle,
202: String userID) throws InfoException {
203: return getReportManager(configuration).getDefaultReportQuery(
204: handle, userID);
205: }
206:
207: public Map getReportViews(
208: ReportGeneratorConfiguration configuration,
209: String reportDefinitionID, String userID)
210: throws InfoException {
211: return getReportManager(configuration).getReportViews(
212: reportDefinitionID);
213: }
214:
215: public Map getReportViews(
216: ReportGeneratorConfiguration configuration,
217: String reportDefinitionID) throws InfoException {
218: return getReportManager(configuration).getReportViews(
219: reportDefinitionID);
220: }
221:
222: public ReportResult ExecReportQuery(
223: ReportGeneratorConfiguration configuration, int handle,
224: String reportViewId) throws InfoException {
225: return getReportManager(configuration).ExecReportQuery(handle,
226: reportViewId);
227: }
228:
229: public ReportSpec getReportSpec(
230: ReportGeneratorConfiguration configuration,
231: String reportDefinitionId, String reportSourceDef)
232: throws InfoException {
233: return getReportManager(configuration).getReportSpec(
234: reportDefinitionId, reportSourceDef);
235: }
236:
237: public ReportSpec getReportSpec(
238: ReportGeneratorConfiguration configuration,
239: ReportDefinition reportDefinition,
240: ReportSourceDefinition reportSourceDef)
241: throws InfoException {
242: return getReportManager(configuration).getReportSpec(
243: reportDefinition, reportSourceDef);
244: }
245:
246: public ReportSpec getReportSpec(
247: ReportGeneratorConfiguration configuration,
248: String reportDefinitionId) throws InfoException {
249: return getReportManager(configuration).getReportSpec(
250: reportDefinitionId);
251: }
252:
253: public void registerDefinitions(
254: ReportGeneratorConfiguration configuration)
255: throws InfoException {
256: getReportManager(configuration).registerDefinitions();
257: }
258:
259: public void deleteAllRepositories(
260: ReportGeneratorConfiguration configuration)
261: throws InfoException {
262: getReportManager(configuration).deleteAllRepositories();
263: }
264:
265: public void deleteAllDefinitions(
266: ReportGeneratorConfiguration configuration)
267: throws InfoException {
268: getReportManager(configuration).deleteAllDefinitions();
269: }
270:
271: public void deleteReportSourceRepository(
272: ReportGeneratorConfiguration configuration)
273: throws InfoException {
274: getReportManager(configuration).deleteReportSourceRepository();
275: }
276:
277: public void deleteReportSourceDefinitionRepository(
278: ReportGeneratorConfiguration configuration)
279: throws InfoException {
280: getReportManager(configuration)
281: .deleteReportSourceDefinitionRepository();
282: }
283:
284: public void deleteReportDefinitionRepository(
285: ReportGeneratorConfiguration configuration)
286: throws InfoException {
287: getReportManager(configuration)
288: .deleteReportDefinitionRepository();
289: }
290:
291: public void deleteReportViewRepository(
292: ReportGeneratorConfiguration configuration)
293: throws InfoException {
294: getReportManager(configuration).deleteReportViewRepository();
295: }
296:
297: public void deleteReportView(
298: ReportGeneratorConfiguration configuration, String id,
299: String reportDefinitionId, String userId)
300: throws InfoException {
301: getReportManager(configuration).deleteReportView(id,
302: reportDefinitionId, userId);
303: }
304:
305: public void deleteReportSource(
306: ReportGeneratorConfiguration configuration,
307: String reportSourceDefinitionId) throws InfoException {
308: getReportManager(configuration).deleteReportSource(
309: reportSourceDefinitionId);
310: }
311:
312: public void deleteReportSourceDefinition(
313: ReportGeneratorConfiguration configuration,
314: String reportSourceDefinitionID) throws InfoException {
315: getReportManager(configuration).deleteReportSourceDefinition(
316: reportSourceDefinitionID);
317: }
318:
319: public void deleteReportDefinition(
320: ReportGeneratorConfiguration configuration,
321: String reportDefinitionID) throws InfoException {
322: getReportManager(configuration).deleteReportDefinition(
323: reportDefinitionID);
324: }
325:
326: public void assingDefaultView(
327: ReportGeneratorConfiguration configuration, String id,
328: String reportDefinitionId, String userId)
329: throws InfoException {
330: getReportManager(configuration).assingDefaultView(id,
331: reportDefinitionId, userId);
332: }
333:
334: public Vector registerReportSourceDefinitions(
335: ReportGeneratorConfiguration configuration, Vector vector)
336: throws InfoException {
337: return getReportManager(configuration)
338: .registerReportSourceDefinitions(vector);
339: }
340:
341: public Vector registerReportDefinitions(
342: ReportGeneratorConfiguration configuration, Vector vector)
343: throws InfoException {
344: return getReportManager(configuration)
345: .registerReportDefinitions(vector);
346: }
347:
348: public Vector registerReportViews(
349: ReportGeneratorConfiguration configuration, Vector vector)
350: throws InfoException {
351: return getReportManager(configuration).registerReportViews(
352: vector);
353: }
354:
355: public String getDefaultReportViewId(
356: ReportGeneratorConfiguration configuration,
357: String reportDefinitionId, String userId)
358: throws InfoException {
359: return getReportManager(configuration).getDefaultReportViewId(
360: reportDefinitionId, userId);
361: }
362:
363: public ReportResult ExecReportQuery(
364: ReportGeneratorConfiguration configuration,
365: MicroReport microReport) throws InfoException {
366: return getReportManager(configuration).ExecReportQuery(
367: microReport);
368: };
369:
370: public int PrepareReport(
371: ReportGeneratorConfiguration configuration,
372: MicroReport microReport) throws InfoException {
373: return getReportManager(configuration).PrepareReport(
374: microReport);
375: };
376:
377: public String getXML(ReportGeneratorConfiguration configuration,
378: int handle) throws InfoException {
379: return getReportManager(configuration).getXML(handle);
380: };
381:
382: public String getXML(ReportGeneratorConfiguration configuration,
383: String reportDefinitionID, Map paramValues)
384: throws InfoException {
385: return getReportManager(configuration).getXML(
386: reportDefinitionID, paramValues);
387: };
388:
389: public Set getDimensionValues(
390: ReportGeneratorConfiguration configuration, int handle,
391: String name) throws InfoException {
392: return getReportManager(configuration).getDimensionValues(
393: handle, name);
394: };
395:
396: public Set getDimensionValues(
397: ReportGeneratorConfiguration configuration,
398: String reportDefinitionID, Map paramValues, String name)
399: throws InfoException {
400: return getReportManager(configuration).getDimensionValues(
401: reportDefinitionID, paramValues, name);
402: };
403:
404: public Vector getUpdatedDataModel(
405: ReportGeneratorConfiguration configuration, int handle,
406: int mode, int row, int col, boolean isDistributed)
407: throws InfoException {
408: return getReportManager(configuration).getUpdatedDataModel(
409: handle, mode, row, col, isDistributed);
410: };
411:
412: public ReportResult ExecReportQuery(
413: ReportGeneratorConfiguration configuration, int handle,
414: ReportView reportView) throws InfoException {
415: return getReportManager(configuration).ExecReportQuery(handle,
416: reportView);
417: };
418:
419: public ReportView getReportView(
420: ReportGeneratorConfiguration configuration,
421: String reportViewId) throws InfoException {
422: return getReportManager(configuration).getReportView(
423: reportViewId);
424: };
425:
426: public void saveReportView(
427: ReportGeneratorConfiguration configuration,
428: ReportView reportView) throws InfoException {
429: getReportManager(configuration).saveReportView(reportView);
430: };
431:
432: public ReportView getReportViewFromID(
433: ReportGeneratorConfiguration configuration, String id,
434: String reportDefinitionId, String userId)
435: throws InfoException {
436: return getReportManager(configuration).getReportViewFromID(id,
437: reportDefinitionId, userId);
438: };
439:
440: public void saveReportDefinition(
441: ReportGeneratorConfiguration configuration,
442: ReportDefinition reportDefinition) throws InfoException {
443: getReportManager(configuration).saveReportDefinition(
444: reportDefinition);
445: };
446:
447: public void saveReportSourceDefinition(
448: ReportGeneratorConfiguration configuration,
449: ReportSourceDefinition reportSourceDefinition)
450: throws InfoException {
451: getReportManager(configuration).saveReportSourceDefinition(
452: reportSourceDefinition);
453: };
454:
455: public Matrix getMatrix(ReportGeneratorConfiguration configuration,
456: int handle) throws InfoException {
457: return getReportManager(configuration).getMatrix(handle);
458: }
459:
460: public ReportDefinition getReportDefinitionFromID(
461: ReportGeneratorConfiguration configuration,
462: String reportDefinitionId) throws InfoException {
463: return getReportManager(configuration)
464: .getReportDefinitionFromID(reportDefinitionId);
465: };
466:
467: public ReportSourceDefinition getReportSourceDefinitionFromID(
468: ReportGeneratorConfiguration configuration,
469: String reportSourceDefinitionId) throws InfoException {
470: return getReportManager(configuration)
471: .getReportSourceDefinitionFromID(
472: reportSourceDefinitionId);
473: };
474:
475: public boolean validateUser(
476: ReportGeneratorConfiguration configuration,
477: String userName, String password, String userRepositoryPath)
478: throws InfoException {
479: return getReportManager(configuration).validateUser(userName,
480: password, userRepositoryPath);
481: };
482:
483: public void exportReport(
484: ReportGeneratorConfiguration configuration,
485: String userName, String password,
486: String userRepositoryPath, String reportDefinitionId,
487: Map paramValues, boolean isLandscape, int type,
488: String destinationPath, String name) throws InfoException {
489: getReportManager(configuration).exportReport(userName,
490: password, userRepositoryPath, reportDefinitionId,
491: paramValues, isLandscape, type, destinationPath, name);
492: };
493:
494: public byte[] exportReport(
495: ReportGeneratorConfiguration configuration, Map params)
496: throws InfoException {
497: return getReportManager(configuration).exportReport(params);
498: };
499:
500: public boolean addNewUser(
501: ReportGeneratorConfiguration configuration,
502: String rootPasswd, String userName, String password,
503: String userRepositoryPath) throws InfoException {
504: return getReportManager(configuration).addNewUser(rootPasswd,
505: userName, password, userRepositoryPath);
506: }
507:
508: public boolean validateRol(
509: ReportGeneratorConfiguration configuration, String[] roles,
510: String userName, String rolRepositoryPath)
511: throws InfoException {
512: return getReportManager(configuration).validateRol(roles,
513: userName, rolRepositoryPath);
514: }
515:
516: public void addUserData(ReportGeneratorConfiguration configuration,
517: String userName, String name, String company,
518: String userDataRepositoryPath) throws InfoException {
519: getReportManager(configuration).addUserData(userName, name,
520: company, userDataRepositoryPath);
521: }
522:
523: public void addUserRol(ReportGeneratorConfiguration configuration,
524: String userName, String rol, String rolsRepositoryPath)
525: throws InfoException {
526: getReportManager(configuration).addUserRol(userName, rol,
527: rolsRepositoryPath);
528: }
529:
530: public MicroReport getMicroReport(
531: ReportGeneratorConfiguration configuration, String fileName)
532: throws InfoException {
533: return getReportManager(configuration).getMicroReport(fileName);
534: }
535:
536: public MicroReport getMicroReport(
537: ReportGeneratorConfiguration configuration, String id,
538: Map params) throws InfoException {
539: return getReportManager(configuration).getMicroReport(id,
540: params);
541: }
542:
543: public Collection getUserData(
544: ReportGeneratorConfiguration configuration, String userId,
545: String userDataRepositoryPath) throws InfoException {
546: return getReportManager(configuration).getUserData(userId,
547: userDataRepositoryPath);
548: }
549:
550: public void logClientData(
551: ReportGeneratorConfiguration configuration,
552: String clientData) throws InfoException {
553: getReportManager(configuration).logClientData(clientData);
554: }
555:
556: public boolean isAcceptedLicence(
557: ReportGeneratorConfiguration reportGeneratorConfiguration)
558: throws InfoException {
559: return getReportManager(reportGeneratorConfiguration)
560: .isAcceptedLicence();
561: }
562:
563: public void acceptedLicence(
564: ReportGeneratorConfiguration configuration, boolean value)
565: throws InfoException {
566: getReportManager(configuration).acceptedLicence(value);
567: }
568:
569: }
|