This project has retired. For details please refer to its Attic page.
ChangeRecord xref
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 javax.persistence.Column;
21  import javax.persistence.Entity;
22  import javax.persistence.GeneratedValue;
23  import javax.persistence.GenerationType;
24  import javax.persistence.Id;
25  import javax.persistence.Lob;
26  import javax.persistence.Table;
27  import javax.persistence.TableGenerator;
28  import javax.persistence.UniqueConstraint;
29  
30  @Entity
31  @Table(name = "j3_chg_record"
32          //, uniqueConstraints = @UniqueConstraint(columnNames = {"node_id", "orginating_usn"}) 
33  )
34   
35  public class ChangeRecord implements Serializable {
36  
37          private static final long serialVersionUID = 1L;
38  
39          protected String nodeID;
40          protected Long originatingUSN;
41          private byte[] contents;
42          private RecordType e = RecordType.ChangeRecordNull;
43          private Long id;
44          private String entityKey;
45          private boolean appliedLocally = false;
46  
47          @Column(name = "change_contents")
48          @Lob
49          public byte[] getContents() {
50                  return contents;
51          }
52  
53          public void setContents(byte[] contents) {
54                  this.contents = contents;
55          }
56  
57          public enum RecordType {
58  
59                  ChangeRecordNewData,
60                  ChangeRecordDelete,
61                  ChangeRecordPublisherAssertion,
62                  ChangeRecordHide,
63                  ChangeRecordDeleteAssertion,
64                  ChangeRecordAcknowledgement,
65                  ChangeRecordCorrection,
66                  ChangeRecordNewDataConditional,
67                  ChangeRecordConditionFailed,
68                  ChangeRecordNull
69          }
70  
71          public void setRecordType(RecordType e) {
72                  this.e = e;
73          }
74  
75          @Column(name = "record_type")
76          public RecordType getRecordType() {
77                  return e;
78          }
79  
80          @Id
81          @GeneratedValue(strategy = GenerationType.TABLE,
82               generator = "personGen")
83          @TableGenerator(name = "personGen",
84               table = "JPAGEN_GENERATORS",
85               pkColumnName = "NAME",
86               pkColumnValue = "JPAGEN_PERSON_GEN",
87               valueColumnName = "VALUE")
88          public Long getId() {
89                  return id;
90          }
91  
92          public void setId(Long id) {
93                  this.id = id;
94          }
95  
96          @Column(name = "node_id")
97          public String getNodeID() {
98                  return nodeID;
99          }
100 
101         public void setNodeID(String value) {
102                 this.nodeID = value;
103         }
104 
105         @Column(name = "entity_key")
106         public String getEntityKey() {
107                 return entityKey;
108         }
109 
110         public void setEntityKey(String value) {
111                 this.entityKey = value;
112         }
113 
114         @Column(name = "orginating_usn")
115         public Long getOriginatingUSN() {
116                 return originatingUSN;
117         }
118 
119         public void setOriginatingUSN(Long value) {
120                 this.originatingUSN = value;
121         }
122         
123         /**
124          * returns true if the changes represented by this change record were applied successfully at this node
125          * @return 
126          */
127         @Column(name = "appliedlocal")
128         public boolean getIsAppliedLocally() {
129                 return appliedLocally;
130         }
131 
132         public void setIsAppliedLocally(boolean value) {
133                 this.appliedLocally = value;
134         }
135 }