This project has retired. For details please refer to its Attic page.
PublisherAssertion xref
View Javadoc
1   package org.apache.juddi.model;
2   
3   /*
4    * Copyright 2001-2008 The Apache Software Foundation.
5    * 
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    * 
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   * 
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import java.util.ArrayList;
20  import java.util.Date;
21  import java.util.List;
22  import javax.persistence.AttributeOverride;
23  import javax.persistence.AttributeOverrides;
24  import javax.persistence.CascadeType;
25  import javax.persistence.Column;
26  import javax.persistence.EmbeddedId;
27  import javax.persistence.Entity;
28  import javax.persistence.FetchType;
29  import javax.persistence.JoinColumn;
30  import javax.persistence.ManyToOne;
31  import javax.persistence.OneToMany;
32  import javax.persistence.Table;
33  import javax.persistence.Temporal;
34  import javax.persistence.TemporalType;
35  
36  /**
37   * @author <a href="mailto:kurt@apache.org">Kurt T Stam</a>
38   */
39  @Entity
40  @Table(name = "j3_pubassrt")
41  public class PublisherAssertion implements java.io.Serializable {
42  
43          private static final long serialVersionUID = -5285434317957104272L;
44          private PublisherAssertionId id;
45          private BusinessEntity businessEntityByToKey;
46          private BusinessEntity businessEntityByFromKey;
47          private String tmodelKey;
48          private String keyName;
49          private String keyValue;
50          private String fromCheck;
51          private String toCheck;
52          private Date modified;
53          private List<Signature> signatures = new ArrayList<Signature>(0);
54  
55          public PublisherAssertion() {
56          }
57  
58          public PublisherAssertion(PublisherAssertionId id,
59                  BusinessEntity businessEntityByToKey,
60                  BusinessEntity businessEntityByFromKey, String tmodelKey,
61                  String keyName, String keyValue, String fromCheck, String toCheck) {
62                  this.id = id;
63                  this.businessEntityByToKey = businessEntityByToKey;
64                  this.businessEntityByFromKey = businessEntityByFromKey;
65                  this.tmodelKey = tmodelKey;
66                  this.keyName = keyName;
67                  this.keyValue = keyValue;
68                  this.fromCheck = fromCheck;
69                  this.toCheck = toCheck;
70          }
71  
72          public void setModified(Date created) {
73                  this.modified = created;
74          }
75  
76          @Temporal(TemporalType.TIMESTAMP)
77          @Column(name = "modified", nullable = false, length = 29)
78          public Date getModified() {
79                  if (modified != null) {
80                          return new Date(modified.getTime());
81                  } else {
82                          return null;
83                  }
84          }
85  
86          @EmbeddedId
87          @AttributeOverrides({
88                  @AttributeOverride(name = "fromKey", column = @Column(name = "from_key", nullable = false, length = 255)),
89          	@AttributeOverride(name = "toKey", column = @Column(name = "to_key", nullable = false, length = 255))})
90          public PublisherAssertionId getId() {
91                  return this.id;
92          }
93  
94          public void setId(PublisherAssertionId id) {
95                  this.id = id;
96          }
97  
98          @ManyToOne(fetch = FetchType.LAZY)
99          @JoinColumn(name = "to_key", nullable = false, insertable = false, updatable = false)
100 
101         public BusinessEntity getBusinessEntityByToKey() {
102                 return this.businessEntityByToKey;
103         }
104 
105         public void setBusinessEntityByToKey(BusinessEntity businessEntityByToKey) {
106                 this.businessEntityByToKey = businessEntityByToKey;
107         }
108 
109         @ManyToOne(fetch = FetchType.LAZY)
110         @JoinColumn(name = "from_key", nullable = false, insertable = false, updatable = false)
111 
112         public BusinessEntity getBusinessEntityByFromKey() {
113                 return this.businessEntityByFromKey;
114         }
115 
116         public void setBusinessEntityByFromKey(
117                 BusinessEntity businessEntityByFromKey) {
118                 this.businessEntityByFromKey = businessEntityByFromKey;
119         }
120 
121         @Column(name = "tmodel_key", nullable = false, length = 255)
122         public String getTmodelKey() {
123                 return this.tmodelKey;
124         }
125 
126         public void setTmodelKey(String tmodelKey) {
127                 this.tmodelKey = tmodelKey;
128         }
129 
130         @Column(name = "key_name", nullable = false)
131 
132         public String getKeyName() {
133                 return this.keyName;
134         }
135 
136         public void setKeyName(String keyName) {
137                 this.keyName = keyName;
138         }
139 
140         @Column(name = "key_value", nullable = false)
141 
142         public String getKeyValue() {
143                 return this.keyValue;
144         }
145 
146         public void setKeyValue(String keyValue) {
147                 this.keyValue = keyValue;
148         }
149 
150         @Column(name = "from_check", nullable = false, length = 5)
151         public String getFromCheck() {
152                 return this.fromCheck;
153         }
154 
155         public void setFromCheck(String fromCheck) {
156                 this.fromCheck = fromCheck;
157         }
158 
159         @Column(name = "to_check", nullable = false, length = 5)
160         public String getToCheck() {
161                 return this.toCheck;
162         }
163 
164         public void setToCheck(String toCheck) {
165                 this.toCheck = toCheck;
166         }
167 
168         @Override
169         public boolean equals(Object compareto) {
170                 if (compareto instanceof PublisherAssertion) {
171                         PublisherAssertion rhs = (PublisherAssertion) compareto;
172                         return (this.id.equals(rhs.id));
173                 }
174                 return false;
175         }
176 
177         @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
178         public List<Signature> getSignatures() {
179                 if (signatures == null) {
180                         signatures = new ArrayList<Signature>();
181                 }
182                 return signatures;
183         }
184 
185         public void setSignatures(List<Signature> signatures) {
186                 this.signatures = signatures;
187         }
188 }