org.apache.mailreaderjpa.Subscription Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.mailreaderjpa;
import java.io.Serializable;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Version;
/**
* JPA entity class for the MAILREADER_SUBSCRIPTIONS
table.
*/
@Entity(name="mailreader_subscriptions")
@NamedQueries({
@NamedQuery(name="Subscription.findAll", query="SELECT s FROM mailreader_subscriptions s"),
@NamedQuery(name="Subscription.findByUserId", query="SELECT s FROM mailreader_subscriptions s WHERE s.user = :userid")
})
public class Subscription implements Serializable {
@Id
@Column(name="subscription_id")
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
/** Creates a new instance of Subscription */
public Subscription() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String toString() {
return "org.apache.mailreaderjpa.Subscription[id=" + getId() + "]";
}
public int hashCode() {
if (getId() != null) {
return getId().intValue();
} else {
return super.hashCode();
}
}
public boolean equals(Object obj) {
if ((obj instanceof Subscription)
&& (getId() != null)) {
return getId().equals(((Subscription) obj).getId());
} else {
return false;
}
}
@Column(name="auto_connect")
private boolean autoConnect;
@Column(nullable=false)
private String host;
@Column(nullable=false)
private String password;
@JoinColumn(name="protocol_id")
@OneToOne
private Protocol protocol;
@JoinColumn(name="user_id", nullable=false)
@ManyToOne
private User user;
@Column(nullable=false)
private String username;
@Column(name="last_update")
@Version()
private Timestamp lastUpdate;
public boolean isAutoConnect() {
return autoConnect;
}
public void setAutoConnect(boolean autoConnect) {
this.autoConnect = autoConnect;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Protocol getProtocol() {
return protocol;
}
public void setProtocol(Protocol protocol) {
this.protocol = protocol;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Timestamp getLastUpdate() {
return lastUpdate;
}
public void setLastUpdate(Timestamp lastUpdate) {
this.lastUpdate = lastUpdate;
}
}