1 19 package org.openharmonise.him.editors.report.swing; 20 21 import java.util.*; 22 23 import org.openharmonise.him.*; 24 import org.openharmonise.him.editors.report.rqom.*; 25 import org.openharmonise.him.swing.resourcetree.*; 26 import org.openharmonise.vfs.*; 27 import org.openharmonise.vfs.metadata.*; 28 import org.openharmonise.vfs.metadata.range.*; 29 import org.openharmonise.vfs.metadata.value.*; 30 import org.openharmonise.vfs.servers.ServerList; 31 32 33 39 public class ReportResourceFilter extends AbstractResourceFilter { 40 private ReportQuery m_query; 41 44 public ReportResourceFilter() { 45 super(); 46 } 47 public ReportResourceFilter(ReportQuery query) { 48 super(); 49 m_query = query; 50 } 51 52 56 protected boolean checkResource(VirtualFile vfFile) { 57 boolean bApplicableDomain = false; 58 VirtualFile vfReportFile = ServerList.getInstance().getHarmoniseServer().getVFS().getVirtualFile(m_query.getPath()).getResource(); 59 if(vfFile.isDirectory()){ 60 Iterator iter = vfFile.getChildren().iterator(); 61 while(iter.hasNext()){ 62 String sChild = (String )iter.next(); 63 VirtualFile vfChild = ServerList.getInstance().getHarmoniseServer().getVFS().getVirtualFile(sChild).getResource(); 64 if(checkResource(vfChild)){ 65 bApplicableDomain = true; 66 } 67 } 68 } else { 69 String sFilePath = vfReportFile.getFullPath(); 70 String sPropPath = vfFile.getFullPath(); 71 if(sPropPath.indexOf("SYSTEM_PROPS")>0){ 72 if(sPropPath.indexOf("title")<0 && sPropPath.indexOf("description")<0){ 73 return false; 74 } 75 } 76 Property prop = PropertyCache.getInstance().getPropertyByPath(sPropPath); 77 if(prop.getRange() instanceof PropertyRange){ 78 return false; 79 } 80 List domains = prop.getDomains(); 81 Iterator iter = prop.getDomains().iterator(); 82 if(domains.size()<=0){ 83 bApplicableDomain = false; 84 } 85 while(iter.hasNext()){ 86 Domain domain = (Domain)iter.next(); 87 if(domain.getResourceType().equals(DomainValue.RESOURCE)){ 88 Iterator iter2 = domain.getPaths().iterator(); 89 while (iter2.hasNext()) { 90 String sDomainPath = (String ) iter2.next(); 91 if(sFilePath.startsWith(sDomainPath) || sDomainPath.startsWith(sFilePath)) { 92 bApplicableDomain=true; 93 break; 94 } 95 } 96 } 97 if(bApplicableDomain){ 98 break; 99 } 100 } 101 } 102 return bApplicableDomain; 103 } 104 105 } 106 | Popular Tags |