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 ; 9 10 import org.apache.commons.vfs.FileObject; 11 import org.apache.commons.vfs.FileSystemException; 12 13 20 public class MicroReportRepository extends Repository{ 21 27 public MicroReportRepository(String directoryName, ReportGeneratorConfiguration reportGeneratorConfiguration) { 28 super(directoryName, reportGeneratorConfiguration); 29 } 30 31 public Class getObjectClass() { 32 return MicroReport.class; 33 } 34 35 protected Object saveFromSourceFiles(ReportGeneratorConfiguration reportGeneratorConfiguration, String id) throws InfoException { 36 return null; 37 } 38 39 public CacheRepository getCache() { 40 return null; 41 } 42 43 public MicroReport findMicroReport(String targetReportDefinitionID, Map params) throws InfoException { 44 try { 45 FileObject fileObject = getFileSystemManager().resolveFile(getDirectoryName()); 46 String 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 e) { 55 throw new InfoException(LanguageTraslator.traslate("212")+":"+getDirectoryName(),e); 56 } 57 return null; 58 } 59 } 60 | Popular Tags |