1 19 20 package org.efs.openreports.objects; 21 22 import java.io.Serializable ; 23 import java.util.ArrayList ; 24 import java.util.Iterator ; 25 import java.util.List ; 26 27 public class ReportGroup implements Comparable , Serializable 28 { 29 private static final long serialVersionUID = 3591220643715469145L; 30 31 private Integer id; 32 private String name; 33 private String description; 34 35 private List reports; 36 37 public ReportGroup() 38 { 39 } 40 41 public List getReports() 42 { 43 return reports; 44 } 45 46 public List getReportsForDisplay() 48 { 49 ArrayList list = new ArrayList (); 50 51 Iterator iterator = reports.iterator(); 52 while(iterator.hasNext()) 53 { 54 Report report = (Report) iterator.next(); 55 if (!report.isHidden()) list.add(report); 56 } 57 58 return list; 59 } 60 61 public void setReports(List reports) 62 { 63 this.reports = reports; 64 } 65 66 public String toString() 67 { 68 return name; 69 } 70 71 public String getName() 72 { 73 return name; 74 } 75 76 public void setName(String name) 77 { 78 this.name = name; 79 } 80 81 public String getDescription() 82 { 83 return description; 84 } 85 86 public void setDescription(String description) 87 { 88 this.description = description; 89 } 90 91 public Integer getId() 92 { 93 return id; 94 } 95 96 public void setId(Integer id) 97 { 98 this.id = id; 99 } 100 101 public int compareTo(Object object) 102 { 103 ReportGroup reportGroup = (ReportGroup) object; 104 return name.compareTo(reportGroup.getName()); 105 } 106 107 public boolean isValidReport(Report report) 108 { 109 if (reports != null && reports.size() > 0) 110 { 111 Iterator iterator = reports.iterator(); 112 while (iterator.hasNext()) 113 { 114 Report r = (Report) iterator.next(); 115 if (r.getId().equals(report.getId())) 116 return true; 117 } 118 } 119 120 return false; 121 } 122 123 } | Popular Tags |