//
// Copyright 2009 Robin Komiwes, Bruno Verachten, Christophe Cordenier
//
// Licensed 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 com.wooki.domain.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
/**
* User added comment on existing book.
*
* @author ccordenier
*/
@Entity
@Table(name = "Comments")
public class Comment extends WookiEntity
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "comment_id", nullable = false)
private Long id;
@Column(name = "title")
private String title;
@ManyToOne
@JoinColumn(name = "publication_id", nullable = false)
private Publication publication;
@OneToOne
@JoinColumn(name = "comment_label_id")
private CommentLabel label;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
private User user;
@Enumerated(EnumType.STRING)
@Column(name = "state", nullable = false)
private CommentState state;
@Column(name = "domId", nullable = false)
private String domId;
@Column(name = "content")
private String content;
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public Publication getPublication()
{
return publication;
}
public void setPublication(Publication chapter)
{
this.publication = chapter;
}
public CommentLabel getLabel()
{
return label;
}
public void setLabel(CommentLabel state)
{
this.label = state;
}
public String getDomId()
{
return domId;
}
public void setDomId(String domId)
{
this.domId = domId;
}
public String getContent()
{
return content;
}
public void setContent(String content)
{
this.content = content;
}
public User getUser()
{
return user;
}
public void setUser(User user)
{
this.user = user;
}
public CommentState getState()
{
return state;
}
public void setState(CommentState state)
{
this.state = state;
}
}