View Javadoc
1   /*
2    * Copyright 2001-2008 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   */
17  package org.apache.juddi.model;
18  
19  import java.io.Serializable;
20  import java.math.BigInteger;
21  import java.util.ArrayList;
22  import java.util.List;
23  import javax.persistence.CascadeType;
24  import javax.persistence.Column;
25  import javax.persistence.Entity;
26  import javax.persistence.FetchType;
27  import javax.persistence.Id;
28  import javax.persistence.OneToMany;
29  import javax.persistence.OneToOne;
30  import javax.persistence.OrderBy;
31  import javax.persistence.Table;
32  
33  @Entity
34  @Table(name = "j3_chg_replconf")
35  public class ReplicationConfiguration implements Serializable {
36  
37          private static final long serialVersionUID = 1L;
38  
39          private Long serialNumber;
40          private String timeOfConfigurationUpdate;
41          private List<Operator> operator = new ArrayList<Operator>(0);
42          private BigInteger maximumTimeToSyncRegistry;
43          private BigInteger maximumTimeToGetChanges;
44          private List<Signature> signatures = new ArrayList<Signature>(0);
45          private Contact contact;
46          private List<ReplicationConfigurationNode> node;
47          private List<ControlMessage> controlledMessage;
48          private List<Edge> edge;
49  
50          /**
51           * Gets the value of the contact property.
52           *
53           * @return possible object is {@link Contact }
54           *
55           */
56          @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "replicationConfigId")
57          //@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Contact.class, mappedBy = "serialNumber")
58          public Contact getContact() {
59                  return contact;
60          }
61  
62          /**
63           * Sets the value of the contact property.
64           *
65           * @param value allowed object is {@link Contact }
66           *
67           */
68          public void setContact(Contact value) {
69                  this.contact = value;
70          }
71  
72          /**
73           * Gets the value of the serialNumber property.
74           *
75           */
76          @Column(name = "serno")
77          @OrderBy(value = "SerialNumber DESC")
78          @Id
79          public Long getSerialNumber() {
80                  return serialNumber;
81          }
82  
83          /**
84           * Sets the value of the serialNumber property.
85           *
86           */
87          public void setSerialNumber(Long value) {
88                  this.serialNumber = value;
89          }
90  
91          /**
92           * Gets the value of the timeOfConfigurationUpdate property.
93           *
94           * @return possible object is {@link String }
95           *
96           */
97          @Column(name = "configupdate")
98          public String getTimeOfConfigurationUpdate() {
99                  return timeOfConfigurationUpdate;
100         }
101 
102         /**
103          * Sets the value of the timeOfConfigurationUpdate property.
104          *
105          * @param value allowed object is {@link String }
106          *
107          */
108         public void setTimeOfConfigurationUpdate(String value) {
109                 this.timeOfConfigurationUpdate = value;
110         }
111 
112         @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Operator.class)
113         public List<Operator> getOperator() {
114                 if (operator == null) {
115                         operator = new ArrayList<Operator>();
116                 }
117                 return this.operator;
118         }
119 
120         public void setOperator(List<Operator> v) {
121 
122                 this.operator = v;
123         }
124 
125         /**
126          * Gets the value of the maximumTimeToSyncRegistry property.
127          *
128          * @return possible object is {@link BigInteger }
129          *
130          */
131         @Column(name = "maxsynctime")
132         public BigInteger getMaximumTimeToSyncRegistry() {
133                 return maximumTimeToSyncRegistry;
134         }
135 
136         /**
137          * Sets the value of the maximumTimeToSyncRegistry property.
138          *
139          * @param value allowed object is {@link BigInteger }
140          *
141          */
142         public void setMaximumTimeToSyncRegistry(BigInteger value) {
143                 this.maximumTimeToSyncRegistry = value;
144         }
145 
146         /**
147          * Gets the value of the maximumTimeToGetChanges property.
148          *
149          * @return possible object is {@link BigInteger }
150          *
151          */
152         @Column(name = "maxgettime")
153         public BigInteger getMaximumTimeToGetChanges() {
154                 return maximumTimeToGetChanges;
155         }
156 
157         /**
158          * Sets the value of the maximumTimeToGetChanges property.
159          *
160          * @param value allowed object is {@link BigInteger }
161          *
162          */
163         public void setMaximumTimeToGetChanges(BigInteger value) {
164                 this.maximumTimeToGetChanges = value;
165         }
166 
167         @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "replicationConfiguration")
168         @OrderBy
169         public List<Signature> getSignatures() {
170                 return signatures;
171         }
172 
173         public void setSignatures(List<Signature> signatures) {
174                 this.signatures = signatures;
175         }
176 
177         //To use a Node or a String reference...
178         //Node will give us strict ref integ but makes a change history of the replication config impossible
179         //Strig increases code logic for ref integ,but makes chage history possible
180         @OneToMany(targetEntity = ReplicationConfigurationNode.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL)
181        // @OneToMany(cascade = {CascadeType.ALL})
182         public List<ReplicationConfigurationNode> getNode() {
183                 if (node == null) {
184                         node = new ArrayList<ReplicationConfigurationNode>();
185                 }
186                 return this.node;
187         }
188 
189         public void setNode(List<ReplicationConfigurationNode> nodes) {
190 
191                 this.node = nodes;
192         }
193 
194         //@javax.persistence.Transient
195         @OneToMany(targetEntity = ControlMessage.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL)
196         public List<ControlMessage> getControlMessage() {
197                 if (controlledMessage == null) {
198                         controlledMessage = new ArrayList<ControlMessage>();
199                 }
200                 return this.controlledMessage;
201         }
202 
203         public void setControlMessage(List<ControlMessage> controlledMessages) {
204 
205                 this.controlledMessage = controlledMessages;
206         }
207 
208         // @OneToMany( fetch = FetchType.LAZY,targetEntity = Edge.class, mappedBy = "Edge")
209         @OneToMany(targetEntity = Edge.class, 
210                 fetch = FetchType.LAZY, cascade = CascadeType.ALL
211                 //mappedBy = "j3_edge"
212                 )
213         public List<Edge> getEdge() {
214                 return this.edge;
215         }
216 
217         public void setEdge(List<Edge> edges) {
218                 this.edge = edges;
219         }
220 }