View Javadoc
1   /*
2    * Copyright 2013 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  package org.apache.juddi.model;
17  
18  import java.io.Serializable;
19  import java.util.ArrayList;
20  import java.util.List;
21  import javax.persistence.CascadeType;
22  import javax.persistence.Column;
23  import javax.persistence.Entity;
24  import javax.persistence.FetchType;
25  import javax.persistence.GeneratedValue;
26  import javax.persistence.GenerationType;
27  import javax.persistence.Id;
28  import javax.persistence.JoinColumn;
29  import javax.persistence.ManyToOne;
30  import javax.persistence.OneToMany;
31  import javax.persistence.Table;
32  
33  @Entity
34  @Table(name = "j3_edge")
35  public class Edge implements Serializable{
36  
37          private Long id;
38          private List<ControlMessage>  message;
39          private String messageSender;
40          private String messageReceiver;
41          private List<EdgeReceiverAlternate> messageReceiverAlternate;
42          private ReplicationConfiguration parent;
43  
44           @ManyToOne(fetch = FetchType.LAZY)
45  	@JoinColumn(name = "ReplicationConfiguration", nullable = false)
46          public ReplicationConfiguration getReplicationConfiguration() {
47                  return parent;
48          }
49          
50          public void setReplicationConfiguration(ReplicationConfiguration p){
51                  parent = p;
52          }
53          
54          /**
55           * The message elements contain the local name of the Replication API message elements
56           * @return 
57           */
58          @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = ControlMessage.class)
59          public List<ControlMessage> getMessages() {
60                  if (message == null) {
61                          message = new ArrayList<ControlMessage>();
62                  }
63                  return this.message;
64          }
65          public void setMessages(List<ControlMessage>  values) {
66                  this.message = values;
67          }
68  
69          
70          @Column
71          public String getMessageSender() {
72                  return messageSender;
73          }
74  
75          public void setMessageSender(String value) {
76                  this.messageSender = value;
77          }
78  
79          /**
80           * For each directed edge, the primary edge Node id
81                   *
82           * @return
83           */
84          @Column
85          public String getMessageReceiver() {
86                  return messageReceiver;
87          }
88  
89          public void setMessageReceiver(String value) {
90                  this.messageReceiver = value;
91          }
92  
93          /**
94           * For each directed edge, an ordered sequence of zero or more
95           * alternate, backup edges MAY be listed using the
96           * messageReceiverAlternate element
97           *
98           * @return
99           */
100         @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = EdgeReceiverAlternate.class
101                 //, mappedBy = "messageReceiverAlternate"
102         )
103         public List<EdgeReceiverAlternate> getMessageReceiverAlternate() {
104                 if (messageReceiverAlternate == null) {
105                         messageReceiverAlternate = new ArrayList<EdgeReceiverAlternate>();
106                 }
107                 return this.messageReceiverAlternate;
108         }
109 
110         @Id
111         @GeneratedValue(strategy = GenerationType.AUTO)
112         public Long getId() {
113                 return id;
114         }
115 
116         public void setMessage(List<ControlMessage> message) {
117                 this.message = message;
118         }
119 
120         public void setMessageReceiverAlternate(List<EdgeReceiverAlternate> messageReceiverAlternate) {
121                 this.messageReceiverAlternate = messageReceiverAlternate;
122         }
123 
124      
125 
126         public void setId(Long id) {
127                 this.id = id;
128         }
129 }