2009/05/20 - Apache Shale has been retired.

For more information, please explore the Attic.

View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to you under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  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  package org.apache.mailreaderjpa;
18  
19  import java.io.Serializable;
20  import java.sql.Timestamp;
21  import javax.persistence.Column;
22  import javax.persistence.Entity;
23  import javax.persistence.GeneratedValue;
24  import javax.persistence.GenerationType;
25  import javax.persistence.Id;
26  import javax.persistence.JoinColumn;
27  import javax.persistence.ManyToOne;
28  import javax.persistence.NamedQueries;
29  import javax.persistence.NamedQuery;
30  import javax.persistence.OneToOne;
31  import javax.persistence.Version;
32  
33  /***
34   * <p>JPA entity class for the <code>MAILREADER_SUBSCRIPTIONS</code> table.</p>
35   */
36  @Entity(name="mailreader_subscriptions")
37  @NamedQueries({
38      @NamedQuery(name="Subscription.findAll", query="SELECT s FROM mailreader_subscriptions s"),
39      @NamedQuery(name="Subscription.findByUserId", query="SELECT s FROM mailreader_subscriptions s WHERE s.user = :userid")
40  })
41  public class Subscription implements Serializable {
42  
43      @Id
44      @Column(name="subscription_id")
45      @GeneratedValue(strategy = GenerationType.AUTO)
46      private Integer id;
47      
48      /*** Creates a new instance of Subscription */
49      public Subscription() {
50      }
51  
52      public Integer getId() {
53          return id;
54      }
55  
56      public void setId(Integer id) {
57          this.id = id;
58      }
59  
60      public String toString() {
61          return "org.apache.mailreaderjpa.Subscription[id=" + getId() + "]";
62      }
63      
64      public int hashCode() {
65          if (getId() != null) {
66              return getId().intValue();
67          } else {
68              return super.hashCode();
69          }
70      }
71  
72      public boolean equals(Object obj) {
73          if ((obj instanceof Subscription)
74              && (getId() != null)) {
75              return getId().equals(((Subscription) obj).getId());
76          } else {
77              return false;
78          }
79      }
80  
81      @Column(name="auto_connect")
82      private boolean autoConnect;
83      @Column(nullable=false)
84      private String host;
85      @Column(nullable=false)
86      private String password;
87      @JoinColumn(name="protocol_id")
88      @OneToOne
89      private Protocol protocol;
90      @JoinColumn(name="user_id", nullable=false)
91      @ManyToOne
92      private User user;
93      @Column(nullable=false)
94      private String username;
95      @Column(name="last_update")
96      @Version()
97      private Timestamp lastUpdate;
98  
99      public boolean isAutoConnect() {
100         return autoConnect;
101     }
102 
103     public void setAutoConnect(boolean autoConnect) {
104         this.autoConnect = autoConnect;
105     }
106 
107     public String getHost() {
108         return host;
109     }
110 
111     public void setHost(String host) {
112         this.host = host;
113     }
114 
115     public String getPassword() {
116         return password;
117     }
118 
119     public void setPassword(String password) {
120         this.password = password;
121     }
122 
123     public Protocol getProtocol() {
124         return protocol;
125     }
126 
127     public void setProtocol(Protocol protocol) {
128         this.protocol = protocol;
129     }
130 
131     public User getUser() {
132         return user;
133     }
134 
135     public void setUser(User user) {
136         this.user = user;
137     }
138 
139     public String getUsername() {
140         return username;
141     }
142 
143     public void setUsername(String username) {
144         this.username = username;
145     }
146 
147     public Timestamp getLastUpdate() {
148         return lastUpdate;
149     }
150 
151     public void setLastUpdate(Timestamp lastUpdate) {
152         this.lastUpdate = lastUpdate;
153     }
154 
155 }