KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > exceptions > entity > Stacktrace


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.exceptions.entity;
20
21 import java.io.Serializable JavaDoc;
22 import java.util.Collection JavaDoc;
23 import javax.persistence.CascadeType;
24 import javax.persistence.Column;
25 import javax.persistence.Entity;
26 import javax.persistence.Id;
27 import javax.persistence.JoinColumn;
28 import javax.persistence.ManyToOne;
29 import javax.persistence.NamedQueries;
30 import javax.persistence.NamedQuery;
31 import javax.persistence.OneToMany;
32 import javax.persistence.OneToOne;
33 import javax.persistence.Table;
34
35 /**
36  *
37  * @author Jan Horvath
38  */

39 @Entity
40 @Table(name = "STACKTRACE")
41 @NamedQueries({@NamedQuery(name = "Stacktrace.findById", query = "SELECT s FROM Stacktrace s WHERE s.id = :id"),
42         @NamedQuery(name = "Stacktrace.findByMessage", query = "SELECT s FROM Stacktrace s WHERE s.message = :message"),
43         @NamedQuery(name = "Stacktrace.findByClass1", query = "SELECT s FROM Stacktrace s WHERE s.class1 = :class1")})
44 public class Stacktrace implements Serializable JavaDoc {
45     
46     /** Creates a new instance of Stacktrace */
47         @Id
48     @Column(name = "ID", nullable = false)
49     private Integer JavaDoc id;
50     @Column(name = "MESSAGE")
51     private String JavaDoc message;
52     @Column(name = "CLASS")
53     private String JavaDoc class1;
54     @JoinColumn(name = "ID", referencedColumnName = "ID", insertable = false, updatable = false)
55     @OneToOne
56     private Issue issue;
57     @OneToMany(mappedBy = "annotation")
58     private Collection JavaDoc<Stacktrace> stacktraceCollection;
59     @JoinColumn(name = "ANNOTATION", referencedColumnName = "ID")
60     @ManyToOne
61     private Stacktrace annotation;
62     @OneToMany(cascade = CascadeType.ALL, mappedBy = "stacktrace")
63     private Collection JavaDoc<Line> lineCollection;
64
65     /** Creates a new instance of Stacktrace */
66     public Stacktrace() {
67     }
68     
69     public Stacktrace(Integer JavaDoc id) {
70         this.id = id;
71     }
72
73     public Integer JavaDoc getId() {
74         return id;
75     }
76
77     public void setId(Integer JavaDoc id) {
78         this.id = id;
79     }
80
81     public String JavaDoc getMessage() {
82         return message;
83     }
84
85     public void setMessage(String JavaDoc message) {
86         this.message = message;
87     }
88
89     public String JavaDoc getClass1() {
90         return class1;
91     }
92
93     public void setClass1(String JavaDoc class1) {
94         this.class1 = class1;
95     }
96
97     public Issue getIssue() {
98         return issue;
99     }
100
101     public void setIssue(Issue issue) {
102         this.issue = issue;
103     }
104
105     public Collection JavaDoc<Stacktrace> getStacktraceCollection() {
106         return stacktraceCollection;
107     }
108
109     public void setStacktraceCollection(Collection JavaDoc<Stacktrace> stacktraceCollection) {
110         this.stacktraceCollection = stacktraceCollection;
111     }
112
113     public Stacktrace getAnnotation() {
114         return annotation;
115     }
116
117     public void setAnnotation(Stacktrace annotation) {
118         this.annotation = annotation;
119     }
120
121     public Collection JavaDoc<Line> getLineCollection() {
122         return lineCollection;
123     }
124
125     public void setLineCollection(Collection JavaDoc<Line> lineCollection) {
126         this.lineCollection = lineCollection;
127     }
128
129     @Override JavaDoc
130     public int hashCode() {
131         int hash = 0;
132
133         hash += (id != null ? id.hashCode()
134                             : 0);
135         return hash;
136     }
137
138     @Override JavaDoc
139     public boolean equals(Object JavaDoc object) {
140         if (!(object instanceof Stacktrace)) {
141             return false;
142         }
143         Stacktrace other = (Stacktrace) object;
144
145         if (this.id != other.id &&
146             (this.id == null || !this.id.equals(other.id)))
147             return false;
148         return true;
149     }
150
151     @Override JavaDoc
152     public String JavaDoc toString() {
153         return "test.Stacktrace[id=" + id + "]";
154     }
155
156 }
157
Popular Tags