Subversion Repositories WebE

Compare Revisions

Last modification

Ignore whitespace Rev 35 → Rev 37

/trunk/src/ch/ffhs/webE/domain/ActionType.java
2,13 → 2,15
 
// Generated 19.12.2010 14:46:08 by Hibernate Tools 3.4.0.Beta1
 
import static javax.persistence.GenerationType.IDENTITY;
 
import java.util.HashSet;
import java.util.Set;
 
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
18,47 → 20,78
*/
@Entity
@Table(name = "action_type", catalog = "webengineering")
public class ActionType implements java.io.Serializable {
public class ActionType implements java.io.Serializable
{
/**
* History action ID for adding an item
*/
public static final int ADD = 1;
 
private Integer id;
private String name;
private Set<History> histories = new HashSet<History>(0);
/**
* History action ID for renaming a term
*/
public static final int RENAME = 2;
 
public ActionType() {
}
/**
* History action ID for modifying a relationship
*/
public static final int MODIFY = 3;
 
public ActionType(String name, Set<History> histories) {
this.name = name;
this.histories = histories;
}
private int id;
private String name;
private Set<History> histories = new HashSet<History>(0);
 
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
public ActionType()
{
}
 
public void setId(Integer id) {
this.id = id;
}
/**
* @param id
*/
public ActionType(int id)
{
this.setId(id);
}
 
@Column(name = "name", length = 45)
public String getName() {
return this.name;
}
public ActionType(String name, Set<History> histories)
{
this.setName(name);
this.setHistories(histories);
}
 
public void setName(String name) {
this.name = name;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public int getId()
{
return this.id;
}
 
@OneToMany(fetch = FetchType.LAZY, mappedBy = "actionType")
public Set<History> getHistories() {
return this.histories;
}
public void setId(int id)
{
this.id = id;
}
 
public void setHistories(Set<History> histories) {
this.histories = histories;
}
@Column(name = "name", length = 45)
public String getName()
{
return this.name;
}
 
public void setName(String name)
{
this.name = name;
}
 
@OneToMany(fetch = FetchType.LAZY, mappedBy = "actionType")
public Set<History> getHistories()
{
return this.histories;
}
 
public void setHistories(Set<History> histories)
{
this.histories = histories;
}
 
}
/trunk/src/ch/ffhs/webE/domain/History.java
2,12 → 2,14
 
// Generated 19.12.2010 14:46:08 by Hibernate Tools 3.4.0.Beta1
 
import static javax.persistence.GenerationType.IDENTITY;
 
import java.util.Date;
 
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
20,103 → 22,185
*/
@Entity
@Table(name = "history", catalog = "webengineering")
public class History implements java.io.Serializable {
public class History implements java.io.Serializable
{
/**
* Serialization version ID
*/
private static final long serialVersionUID = 1L;
 
private Integer id;
private User user;
private ActionType actionType;
private ObjectEntity object;
private String value;
private String comment;
private Date date;
private int id;
private User user;
private ActionType actionType;
private ObjectEntity object;
private String value;
private String comment;
private Date date;
 
public History() {
}
/**
*
*/
public History()
{
}
 
public History(User user, ActionType actionType, ObjectEntity object, Date date) {
this.user = user;
this.actionType = actionType;
this.object = object;
this.date = date;
}
/**
* @param user
* @param actionType
* @param object
* @param date
*/
public History(User user, ActionType actionType, ObjectEntity object,
Date date)
{
this.user = user;
this.actionType = actionType;
this.object = object;
this.date = date;
}
 
public History(User user, ActionType actionType, ObjectEntity object,
String value, String comment, Date date) {
this.user = user;
this.actionType = actionType;
this.object = object;
this.value = value;
this.comment = comment;
this.date = date;
}
/**
* @param user
* @param actionType
* @param object
* @param value
* @param comment
* @param date
*/
public History(User user, ActionType actionType, ObjectEntity object,
String value, String comment, Date date)
{
this.user = user;
this.actionType = actionType;
this.object = object;
this.value = value;
this.comment = comment;
this.date = date;
}
 
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
/**
* @return
*/
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public int getId()
{
return this.id;
}
 
public void setId(Integer id) {
this.id = id;
}
/**
* @param id
*/
public void setId(int id)
{
this.id = id;
}
 
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
public User getUser() {
return this.user;
}
/**
* @return
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
public User getUser()
{
return this.user;
}
 
public void setUser(User user) {
this.user = user;
}
/**
* @param user
*/
public void setUser(User user)
{
this.user = user;
}
 
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "action_type_id", nullable = false)
public ActionType getActionType() {
return this.actionType;
}
/**
* @return
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "action_type_id", nullable = false)
public ActionType getActionType()
{
return this.actionType;
}
 
public void setActionType(ActionType actionType) {
this.actionType = actionType;
}
/**
* @param actionType
*/
public void setActionType(ActionType actionType)
{
this.actionType = actionType;
}
 
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "objects_id", nullable = false)
public ObjectEntity getObject() {
return this.object;
}
/**
* @return
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "objects_id", nullable = false)
public ObjectEntity getObject()
{
return this.object;
}
 
public void setObject(ObjectEntity object) {
this.object = object;
}
/**
* @param object
*/
public void setObject(ObjectEntity object)
{
this.object = object;
}
 
@Column(name = "value", length = 45)
public String getValue() {
return this.value;
}
/**
* @return
*/
@Column(name = "value", length = 45)
public String getValue()
{
return this.value;
}
 
public void setValue(String value) {
this.value = value;
}
/**
* @param value
*/
public void setValue(String value)
{
this.value = value;
}
 
@Column(name = "comment")
public String getComment() {
return this.comment;
}
/**
* @return
*/
@Column(name = "comment")
public String getComment()
{
return this.comment;
}
 
public void setComment(String comment) {
this.comment = comment;
}
/**
* @param comment
*/
public void setComment(String comment)
{
this.comment = comment;
}
 
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "date", nullable = false, length = 19)
public Date getDate() {
return this.date;
}
/**
* @return
*/
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "date", nullable = false, length = 19)
public Date getDate()
{
return this.date;
}
 
public void setDate(Date date) {
this.date = date;
}
/**
* @param date
*/
public void setDate(Date date)
{
this.date = date;
}
 
}
/trunk/src/ch/ffhs/webE/domain/ObjectEntity.java
22,6 → 22,8
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
 
import org.hibernate.annotations.OrderBy;
 
/**
* ObjectEntity generated by hbm2java
*/
43,7 → 45,7
private Date modified;
private Boolean deleted;
private Term term;
private Set<History> histories = new HashSet<History>(0);
private Set<History> history = new HashSet<History>(0);
private Relationship relationship;
 
/**
74,7 → 76,7
* @param modified
* @param deleted
* @param term
* @param histories
* @param history
* @param relationship
*/
public ObjectEntity(User userByEditorId, ObjectType objectType,
88,7 → 90,7
this.modified = modified;
this.deleted = deleted;
this.term = term;
this.histories = histories;
this.history = histories;
this.relationship = relationship;
}
 
239,17 → 241,18
* @return
*/
@OneToMany(fetch = FetchType.LAZY, mappedBy = "object")
public Set<History> getHistories()
@OrderBy(clause = "date DESC")
public Set<History> getHistory()
{
return this.histories;
return this.history;
}
 
/**
* @param histories
* @param history
*/
public void setHistories(Set<History> histories)
public void setHistory(Set<History> history)
{
this.histories = histories;
this.history = history;
}
 
/**