View Javadoc
1   package org.apache.juddi.model;
2   /*
3    * Copyright 2001-2008 The Apache Software Foundation.
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  import java.util.Date;
19  
20  import javax.persistence.Column;
21  import javax.persistence.Entity;
22  import javax.persistence.Id;
23  import javax.persistence.Inheritance;
24  import javax.persistence.InheritanceType;
25  import javax.persistence.Table;
26  import javax.persistence.Temporal;
27  import javax.persistence.TemporalType;
28  
29  /**
30   * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
31   */
32  @Entity
33  @Table(name = "j3_uddi_entity")
34  @Inheritance(strategy = InheritanceType.JOINED)
35  public abstract class UddiEntity implements Comparable<UddiEntity>{
36  
37  	protected String entityKey;
38  	protected Date created;
39  	protected Date modified;
40  	protected Date modifiedIncludingChildren;
41  	protected String nodeId;
42  	protected String authorizedName;
43          protected boolean xfer = false;
44  	
45  	@Id
46  	@Column(name = "entity_key", nullable = false, length = 255)
47  	public String getEntityKey() {
48  		return entityKey;
49  	}
50  	public void setEntityKey(String entityKey) {
51  		this.entityKey = entityKey;
52  	}
53  
54  	@Temporal(TemporalType.TIMESTAMP)
55  	@Column(name = "created", length = 29)
56  	public Date getCreated() {
57  		if (created!=null) {
58  			return new Date(created.getTime());
59  		} else {
60  			return null;
61  		}
62  	}
63  	public void setCreated(Date created) {
64  		this.created = created;
65  	}
66  	
67  	@Temporal(TemporalType.TIMESTAMP)
68  	@Column(name = "modified", nullable = false, length = 29)
69  	public Date getModified() {
70  		if (modified!=null) {
71  			return new Date(modified.getTime());
72  		} else {
73  			return null;
74  		}
75  	}
76  	public void setModified(Date modified) {
77  		this.modified = modified;
78  	}
79  
80  	@Temporal(TemporalType.TIMESTAMP)
81  	@Column(name = "modified_including_children", length = 29)
82  	public Date getModifiedIncludingChildren() {
83  		if (modifiedIncludingChildren!=null) {
84  			return new Date(modifiedIncludingChildren.getTime());
85  		} else {
86  			return null;
87  		}
88  	}
89  	public void setModifiedIncludingChildren(Date modifiedIncludingChildren) {
90  		this.modifiedIncludingChildren = modifiedIncludingChildren;
91  	}
92  	
93          /**
94           * As of 3.2, node_id is a required field
95           * @return node id
96           */
97  	@Column(name = "node_id", nullable=false,length = 255)
98  	public String getNodeId() {
99  		return nodeId;
100 	}
101 	public void setNodeId(String nodeId) {
102 		this.nodeId = nodeId;
103 	}
104 
105 	
106 	@Column(name = "authorized_name", nullable=false, length = 255)
107 	public String getAuthorizedName() {
108 		return authorizedName;
109 	}
110 	public void setAuthorizedName(String authorizedName) {
111 		this.authorizedName = authorizedName;
112 	}
113 	
114 	public int compareTo(UddiEntity o) {
115 		if (o==null || o.getEntityKey()==null) return 0;
116 		if (o.getEntityKey().equals(getEntityKey())) return 1;
117 		else return 0;
118 	}
119 
120         public void setIsTransferInProgress(boolean b) {
121                 xfer = b;
122         }
123         @Column(name="xfer", nullable=false)
124         public boolean getIsTransferInProgress()
125         {
126                 return xfer;
127         }
128 
129 }