View Javadoc
1   /*
2    * This software was designed and created by Jason Carroll.
3    * Copyright (c) 2002, 2003, 2004 Jason Carroll.
4    * The author can be reached at jcarroll@cowsultants.com
5    * ITracker website: http://www.cowsultants.com
6    * ITracker forums: http://www.cowsultants.com/phpBB/index.php
7    *
8    * This program is free software; you can redistribute it and/or modify
9    * it only under the terms of the GNU General Public License as published by
10   * the Free Software Foundation; either version 2 of the License, or
11   * (at your option) any later version.
12   *
13   * This program is distributed in the hope that it will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   * GNU General Public License for more details.
17   */
18  
19  package org.itracker.model;
20  
21  import org.apache.commons.lang.builder.CompareToBuilder;
22  import org.apache.commons.lang.builder.ToStringBuilder;
23  
24  import java.util.Comparator;
25  
26  /**
27   * This is a POJO Business Domain Object.
28   * <p/>
29   * <p>
30   * Hibernate Bean.
31   * </p>
32   *
33   * @author ready
34   */
35  public class Report extends AbstractEntity {
36  
37      public static final Comparator<Report> NAME_COMPARATOR = new NameComparator();
38      /**
39       *
40       */
41      private static final long serialVersionUID = 1L;
42  
43      private String name;
44  
45      private String nameKey;
46  
47      private String description;
48  
49      private byte[] fileData;
50  
51      private String className;
52  
53      /**
54       * Default constructor (required by Hibernate).
55       * <p/>
56       * <p>
57       * PENDING: should be <code>private</code> so that it can only be used by
58       * Hibernate, to ensure that the fields which form an instance's identity
59       * are always initialized/never <tt>null</tt>.
60       * </p>
61       */
62      public Report() {
63      }
64  
65      public String getName() {
66          return name;
67      }
68  
69      public void setName(String name) {
70          this.name = name;
71      }
72  
73      public String getNameKey() {
74          return nameKey;
75      }
76  
77      public void setNameKey(String nameKey) {
78          this.nameKey = nameKey;
79      }
80  
81      public String getClassName() {
82          return className;
83      }
84  
85      public void setClassName(String className) {
86          this.className = className;
87      }
88  
89  
90      public String getDescription() {
91          return description;
92      }
93  
94      public void setDescription(String description) {
95          this.description = description;
96      }
97  
98      public byte[] getFileData() {
99          return fileData;
100     }
101 
102     public void setFileData(byte[] fileData) {
103         this.fileData = fileData;
104     }
105 
106     @Override
107     public String toString() {
108         return new ToStringBuilder(this).append("id", getId()).append("name",
109                 getName()).append("description", getDescription()).append(
110                 "nameKey", getNameKey())
111                 .toString();
112     }
113 
114     private static final class NameComparator implements Comparator<Report> {
115         public int compare(Reporthref="../../../org/itracker/model/Report.html#Report">Report o1, Report o2) {
116             return new CompareToBuilder().append(o1.getName(), o2.getName())
117                     .append(o1.getNameKey(), o2.getNameKey()).append(
118                             o1.getId(), o2.getId()).toComparison();
119         }
120     }
121 
122 }