KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > calipso > reportgenerator > reportmanager > MicroReportRepository


1 package com.calipso.reportgenerator.reportmanager;
2
3 import com.calipso.reportgenerator.common.ReportGeneratorConfiguration;
4 import com.calipso.reportgenerator.common.MicroReport;
5 import com.calipso.reportgenerator.common.LanguageTraslator;
6 import com.calipso.reportgenerator.common.InfoException;
7
8 import java.util.Map JavaDoc;
9
10 import org.apache.commons.vfs.FileObject;
11 import org.apache.commons.vfs.FileSystemException;
12
13 /**
14  *
15  * User: Breto
16  * Date: 30/09/2005
17  * Time: 11:12:52
18  *
19  */

20 public class MicroReportRepository extends Repository{
21   /**
22    * Crea el repositorio asignándole un directorio destino.
23    *
24    * @param directoryName Nombre del directorio destino
25    * @param reportGeneratorConfiguration
26    */

27   public MicroReportRepository(String JavaDoc directoryName, ReportGeneratorConfiguration reportGeneratorConfiguration) {
28     super(directoryName, reportGeneratorConfiguration);
29   }
30
31   public Class JavaDoc getObjectClass() {
32     return MicroReport.class;
33   }
34
35   protected Object JavaDoc saveFromSourceFiles(ReportGeneratorConfiguration reportGeneratorConfiguration, String JavaDoc id) throws InfoException {
36     return null;
37   }
38
39   public CacheRepository getCache() {
40     return null;
41   }
42
43   public MicroReport findMicroReport(String JavaDoc targetReportDefinitionID, Map JavaDoc params) throws InfoException {
44     try {
45       FileObject fileObject = getFileSystemManager().resolveFile(getDirectoryName());
46       String JavaDoc fileName;
47       MicroReport microReport;
48       for (int i = 0; i < fileObject.getChildren().length; i++) {
49         fileName = fileObject.getChildren()[i].getName().getBaseName();
50         if (MicroReport.sameReport(super.getDirectoryName()+"/"+fileName,reportGeneratorConfiguration,targetReportDefinitionID,params));
51           return new MicroReport(super.getDirectoryName()+"/"+fileName,reportGeneratorConfiguration){
52         };
53       }
54     }catch (Exception JavaDoc e) {
55       throw new InfoException(LanguageTraslator.traslate("212")+":"+getDirectoryName(),e);
56     }
57     return null;
58   }
59 }
60
Popular Tags