Subversion Repositories WebE

Compare Revisions

Last modification

Ignore whitespace Rev 32 → Rev 33

/trunk/src/ch/ffhs/webE/domain/Object.java
File deleted
Property changes:
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
Index: History.java
===================================================================
--- History.java (revision 32)
+++ History.java (revision 33)
@@ -25,7 +25,7 @@
private Integer id;
private User user;
private ActionType actionType;
- private Object object;
+ private ObjectEntity object;
private String value;
private String comment;
private Date date;
@@ -33,7 +33,7 @@
public History() {
}
- public History(User user, ActionType actionType, Object object, Date date) {
+ public History(User user, ActionType actionType, ObjectEntity object, Date date) {
this.user = user;
this.actionType = actionType;
this.object = object;
@@ -40,7 +40,7 @@
this.date = date;
}
- public History(User user, ActionType actionType, Object object,
+ public History(User user, ActionType actionType, ObjectEntity object,
String value, String comment, Date date) {
this.user = user;
this.actionType = actionType;
@@ -83,11 +83,11 @@
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "objects_id", nullable = false)
- public Object getObject() {
+ public ObjectEntity getObject() {
return this.object;
}
- public void setObject(Object object) {
+ public void setObject(ObjectEntity object) {
this.object = object;
}
/trunk/src/ch/ffhs/webE/domain/Relationship.java
26,7 → 26,7
 
private int objectId;
private Term termByTermTo;
private Object object;
private ObjectEntity object;
private RelationshipType relationshipType;
private Term termByTermFrom;
 
33,7 → 33,7
public Relationship() {
}
 
public Relationship(Term termByTermTo, Object object,
public Relationship(Term termByTermTo, ObjectEntity object,
RelationshipType relationshipType, Term termByTermFrom) {
this.termByTermTo = termByTermTo;
this.object = object;
65,11 → 65,11
 
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
public Object getObject() {
public ObjectEntity getObject() {
return this.object;
}
 
public void setObject(Object object) {
public void setObject(ObjectEntity object) {
this.object = object;
}
 
/trunk/src/ch/ffhs/webE/domain/ObjectEntity.java
0,0 → 1,272
package ch.ffhs.webE.domain;
 
// Generated 19.12.2010 14:46:08 by Hibernate Tools 3.4.0.Beta1
 
import static javax.persistence.GenerationType.IDENTITY;
 
import java.io.Serializable;
import java.util.Date;
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 javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
 
/**
* ObjectEntity generated by hbm2java
*/
@Entity
@Table(name = "object", catalog = "webengineering")
public class ObjectEntity implements Serializable
{
/**
* Version ID for serialization
*/
private static final long serialVersionUID = 1L;
 
/* Persistent fields */
private Integer id;
private User userByEditorId;
private ObjectType objectType;
private User userByOwnerId;
private Date locked;
private Date modified;
private Boolean deleted;
private Term term;
private Set<History> histories = new HashSet<History>(0);
private Relationship relationship;
 
/**
*
*/
public ObjectEntity()
{
}
 
/**
* @param userByEditorId
* @param objectType
* @param userByOwnerId
*/
public ObjectEntity(User userByEditorId, ObjectType objectType,
User userByOwnerId)
{
this.userByEditorId = userByEditorId;
this.objectType = objectType;
this.userByOwnerId = userByOwnerId;
}
 
/**
* @param userByEditorId
* @param objectType
* @param userByOwnerId
* @param locked
* @param modified
* @param deleted
* @param term
* @param histories
* @param relationship
*/
public ObjectEntity(User userByEditorId, ObjectType objectType,
User userByOwnerId, Date locked, Date modified, Boolean deleted,
Term term, Set<History> histories, Relationship relationship)
{
this.userByEditorId = userByEditorId;
this.objectType = objectType;
this.userByOwnerId = userByOwnerId;
this.locked = locked;
this.modified = modified;
this.deleted = deleted;
this.term = term;
this.histories = histories;
this.relationship = relationship;
}
 
/**
* @return
*/
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId()
{
return this.id;
}
 
/**
* @param id
*/
public void setId(Integer id)
{
this.id = id;
}
 
/**
* @return
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "editor_id", nullable = false)
public User getUserByEditorId()
{
return this.userByEditorId;
}
 
/**
* @param userByEditorId
*/
public void setUserByEditorId(User userByEditorId)
{
this.userByEditorId = userByEditorId;
}
 
/**
* @return
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "object_type_id", nullable = false)
public ObjectType getObjectType()
{
return this.objectType;
}
 
/**
* @param objectType
*/
public void setObjectType(ObjectType objectType)
{
this.objectType = objectType;
}
 
/**
* @return
*/
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "owner_id", nullable = false)
public User getUserByOwnerId()
{
return this.userByOwnerId;
}
 
/**
* @param userByOwnerId
*/
public void setUserByOwnerId(User userByOwnerId)
{
this.userByOwnerId = userByOwnerId;
}
 
/**
* @return
*/
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "locked", length = 19)
public Date getLocked()
{
return this.locked;
}
 
/**
* @param locked
*/
public void setLocked(Date locked)
{
this.locked = locked;
}
 
/**
* @return
*/
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "modified", length = 19)
public Date getModified()
{
return this.modified;
}
 
/**
* @param modified
*/
public void setModified(Date modified)
{
this.modified = modified;
}
 
/**
* @return
*/
@Column(name = "deleted")
public Boolean getDeleted()
{
return this.deleted;
}
 
/**
* @param deleted
*/
public void setDeleted(Boolean deleted)
{
this.deleted = deleted;
}
 
/**
* @return
*/
@OneToOne(fetch = FetchType.LAZY, mappedBy = "object")
public Term getTerm()
{
return this.term;
}
 
/**
* @param term
*/
public void setTerm(Term term)
{
this.term = term;
}
 
/**
* @return
*/
@OneToMany(fetch = FetchType.LAZY, mappedBy = "object")
public Set<History> getHistories()
{
return this.histories;
}
 
/**
* @param histories
*/
public void setHistories(Set<History> histories)
{
this.histories = histories;
}
 
/**
* @return
*/
@OneToOne(fetch = FetchType.LAZY, mappedBy = "object")
public Relationship getRelationship()
{
return this.relationship;
}
 
/**
* @param relationship
*/
public void setRelationship(Relationship relationship)
{
this.relationship = relationship;
}
 
}
Property changes:
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: Term.java
===================================================================
--- Term.java (revision 32)
+++ Term.java (revision 33)
@@ -2,8 +2,11 @@
// Generated 19.12.2010 14:46:08 by Hibernate Tools 3.4.0.Beta1
+import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
+
+import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
@@ -13,7 +16,9 @@
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
+import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
+
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
@@ -22,81 +27,139 @@
*/
@Entity
@Table(name = "term", catalog = "webengineering", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
-public class Term implements java.io.Serializable {
+public class Term implements Serializable
+{
+ /**
+ * Version ID for serialization
+ */
+ private static final long serialVersionUID = 1L;
- private int objectId;
- private Object object;
- private String name;
- private Set<Relationship> relationshipsForTermTo = new HashSet<Relationship>(
- 0);
- private Set<Relationship> relationshipsForTermFrom = new HashSet<Relationship>(
- 0);
+ @Transient
+ private int objectId;
- public Term() {
- }
+ private ObjectEntity object;
+ private String name;
+ private Set<Relationship> relationshipsForTermTo = new HashSet<Relationship>(
+ 0);
+ private Set<Relationship> relationshipsForTermFrom = new HashSet<Relationship>(
+ 0);
- public Term(Object object) {
- this.object = object;
- }
+ /**
+ * No-op constructor
+ */
+ public Term()
+ {
+ }
- public Term(Object object, String name,
- Set<Relationship> relationshipsForTermTo,
- Set<Relationship> relationshipsForTermFrom) {
- this.object = object;
- this.name = name;
- this.relationshipsForTermTo = relationshipsForTermTo;
- this.relationshipsForTermFrom = relationshipsForTermFrom;
- }
+ /**
+ * @param object
+ */
+ public Term(ObjectEntity object)
+ {
+ this.object = object;
+ }
- @GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name = "property", value = "object"))
- @Id
- @GeneratedValue(generator = "generator")
- @Column(name = "object_id", unique = true, nullable = false)
- public int getObjectId() {
- return this.objectId;
- }
+ /**
+ * @param object
+ * @param name
+ * @param relationshipsForTermTo
+ * @param relationshipsForTermFrom
+ */
+ public Term(ObjectEntity object, String name,
+ Set<Relationship> relationshipsForTermTo,
+ Set<Relationship> relationshipsForTermFrom)
+ {
+ this.object = object;
+ this.name = name;
+ this.relationshipsForTermTo = relationshipsForTermTo;
+ this.relationshipsForTermFrom = relationshipsForTermFrom;
+ }
- public void setObjectId(int objectId) {
- this.objectId = objectId;
- }
+ /**
+ * @return
+ */
+ @GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name = "property", value = "object"))
+ @Id
+ @GeneratedValue(generator = "generator")
+ @Column(name = "object_id", unique = true, nullable = false)
+ public int getObjectId()
+ {
+ return this.objectId;
+ }
- @OneToOne(fetch = FetchType.LAZY)
- @PrimaryKeyJoinColumn
- public Object getObject() {
- return this.object;
- }
+ /**
+ * @param objectId
+ */
+ public void setObjectId(int objectId)
+ {
+ this.objectId = objectId;
+ }
- public void setObject(Object object) {
- this.object = object;
- }
+ /**
+ * @return ObjectEntity domain object
+ */
+ @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @PrimaryKeyJoinColumn
+ public ObjectEntity getObject()
+ {
+ return this.object;
+ }
- @Column(name = "name", unique = true)
- public String getName() {
- return this.name;
- }
+ /**
+ * @param object
+ */
+ public void setObject(ObjectEntity object)
+ {
+ this.object = object;
+ }
- public void setName(String name) {
- this.name = name;
- }
+ /**
+ * @return
+ */
+ @Column(name = "name", unique = true)
+ public String getName()
+ {
+ return this.name;
+ }
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "termByTermTo")
- public Set<Relationship> getRelationshipsForTermTo() {
- return this.relationshipsForTermTo;
- }
+ /**
+ * @param name
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
- public void setRelationshipsForTermTo(
- Set<Relationship> relationshipsForTermTo) {
- this.relationshipsForTermTo = relationshipsForTermTo;
- }
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "termByTermTo")
+ public Set<Relationship> getRelationshipsForTermTo()
+ {
+ return this.relationshipsForTermTo;
+ }
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "termByTermFrom")
- public Set<Relationship> getRelationshipsForTermFrom() {
- return this.relationshipsForTermFrom;
- }
+ /**
+ * @param relationshipsForTermTo
+ */
+ public void setRelationshipsForTermTo(Set<Relationship> relationshipsForTermTo)
+ {
+ this.relationshipsForTermTo = relationshipsForTermTo;
+ }
- public void setRelationshipsForTermFrom(
- Set<Relationship> relationshipsForTermFrom) {
- this.relationshipsForTermFrom = relationshipsForTermFrom;
- }
+ /**
+ * @return
+ */
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "termByTermFrom")
+ public Set<Relationship> getRelationshipsForTermFrom()
+ {
+ return this.relationshipsForTermFrom;
+ }
+ /**
+ * @param relationshipsForTermFrom
+ */
+ public void setRelationshipsForTermFrom(
+ Set<Relationship> relationshipsForTermFrom)
+ {
+ this.relationshipsForTermFrom = relationshipsForTermFrom;
+ }
+
}
/trunk/src/ch/ffhs/webE/domain/ObjectType.java
4,6 → 4,7
 
import java.util.HashSet;
import java.util.Set;
 
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
17,51 → 18,65
*/
@Entity
@Table(name = "object_type", catalog = "webengineering", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
public class ObjectType implements java.io.Serializable {
public class ObjectType implements java.io.Serializable
{
/**
* ObjectEntity type ID for a term
*/
public static final int TERM = 1;
 
private int objectTypeId;
private String name;
private Set<Object> objects = new HashSet<Object>(0);
private int objectTypeId;
private String name;
private Set<ObjectEntity> objects = new HashSet<ObjectEntity>(0);
 
public ObjectType() {
}
public ObjectType()
{
}
 
public ObjectType(int objectTypeId) {
this.objectTypeId = objectTypeId;
}
public ObjectType(int objectTypeId)
{
this.objectTypeId = objectTypeId;
}
 
public ObjectType(int objectTypeId, String name, Set<Object> objects) {
this.objectTypeId = objectTypeId;
this.name = name;
this.objects = objects;
}
public ObjectType(int objectTypeId, String name, Set<ObjectEntity> objects)
{
this.objectTypeId = objectTypeId;
this.name = name;
this.objects = objects;
}
 
@Id
@Column(name = "object_type_id", unique = true, nullable = false)
public int getObjectTypeId() {
return this.objectTypeId;
}
@Id
@Column(name = "object_type_id", unique = true, nullable = false)
public int getObjectTypeId()
{
return this.objectTypeId;
}
 
public void setObjectTypeId(int objectTypeId) {
this.objectTypeId = objectTypeId;
}
public void setObjectTypeId(int objectTypeId)
{
this.objectTypeId = objectTypeId;
}
 
@Column(name = "name", unique = true, length = 45)
public String getName() {
return this.name;
}
@Column(name = "name", unique = true, length = 45)
public String getName()
{
return this.name;
}
 
public void setName(String name) {
this.name = name;
}
public void setName(String name)
{
this.name = name;
}
 
@OneToMany(fetch = FetchType.LAZY, mappedBy = "objectType")
public Set<Object> getObjects() {
return this.objects;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "objectType")
public Set<ObjectEntity> getObjects()
{
return this.objects;
}
 
public void setObjects(Set<Object> objects) {
this.objects = objects;
}
public void setObjects(Set<ObjectEntity> objects)
{
this.objects = objects;
}
 
}
/trunk/src/ch/ffhs/webE/domain/User.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;
19,121 → 21,147
*/
@Entity
@Table(name = "user", catalog = "webengineering", uniqueConstraints = @UniqueConstraint(columnNames = "username"))
public class User implements java.io.Serializable {
public class User implements java.io.Serializable
{
/**
* Version ID for serialization
*/
private static final long serialVersionUID = 1L;
 
private Integer id;
private String username;
private String password;
private String firstname;
private String lastname;
private boolean admin;
private Set<Object> objectsForOwnerId = new HashSet<Object>(0);
private Set<Object> objectsForEditorId = new HashSet<Object>(0);
private Set<History> histories = new HashSet<History>(0);
private Integer id;
private String username;
private String password;
private String firstname;
private String lastname;
private boolean admin;
private Set<ObjectEntity> objectsForOwnerId = new HashSet<ObjectEntity>(0);
private Set<ObjectEntity> objectsForEditorId = new HashSet<ObjectEntity>(0);
private Set<History> histories = new HashSet<History>(0);
 
public User() {
}
public User()
{
}
 
public User(String username, String password, boolean admin) {
this.username = username;
this.password = password;
this.admin = admin;
}
public User(String username, String password, boolean admin)
{
this.username = username;
this.password = password;
this.admin = admin;
}
 
public User(String username, String password, String firstname,
String lastname, boolean admin, Set<Object> objectsForOwnerId,
Set<Object> objectsForEditorId, Set<History> histories) {
this.username = username;
this.password = password;
this.firstname = firstname;
this.lastname = lastname;
this.admin = admin;
this.objectsForOwnerId = objectsForOwnerId;
this.objectsForEditorId = objectsForEditorId;
this.histories = histories;
}
public User(String username, String password, String firstname,
String lastname, boolean admin, Set<ObjectEntity> objectsForOwnerId,
Set<ObjectEntity> objectsForEditorId, Set<History> histories)
{
this.username = username;
this.password = password;
this.firstname = firstname;
this.lastname = lastname;
this.admin = admin;
this.objectsForOwnerId = objectsForOwnerId;
this.objectsForEditorId = objectsForEditorId;
this.histories = histories;
}
 
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId() {
return this.id;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId()
{
return this.id;
}
 
public void setId(Integer id) {
this.id = id;
}
public void setId(Integer id)
{
this.id = id;
}
 
@Column(name = "username", unique = true, nullable = false)
public String getUsername() {
return this.username;
}
@Column(name = "username", unique = true, nullable = false)
public String getUsername()
{
return this.username;
}
 
public void setUsername(String username) {
this.username = username;
}
public void setUsername(String username)
{
this.username = username;
}
 
@Column(name = "password", nullable = false, length = 32)
public String getPassword() {
return this.password;
}
@Column(name = "password", nullable = false, length = 32)
public String getPassword()
{
return this.password;
}
 
public void setPassword(String password) {
this.password = password;
}
public void setPassword(String password)
{
this.password = password;
}
 
@Column(name = "firstname", length = 45)
public String getFirstname() {
return this.firstname;
}
@Column(name = "firstname", length = 45)
public String getFirstname()
{
return this.firstname;
}
 
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public void setFirstname(String firstname)
{
this.firstname = firstname;
}
 
@Column(name = "lastname", length = 45)
public String getLastname() {
return this.lastname;
}
@Column(name = "lastname", length = 45)
public String getLastname()
{
return this.lastname;
}
 
public void setLastname(String lastname) {
this.lastname = lastname;
}
public void setLastname(String lastname)
{
this.lastname = lastname;
}
 
@Column(name = "admin", nullable = false)
public boolean isAdmin() {
return this.admin;
}
@Column(name = "admin", nullable = false)
public boolean isAdmin()
{
return this.admin;
}
 
public void setAdmin(boolean admin) {
this.admin = admin;
}
public void setAdmin(boolean admin)
{
this.admin = admin;
}
 
@OneToMany(fetch = FetchType.LAZY, mappedBy = "userByOwnerId")
public Set<Object> getObjectsForOwnerId() {
return this.objectsForOwnerId;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "userByOwnerId")
public Set<ObjectEntity> getObjectsForOwnerId()
{
return this.objectsForOwnerId;
}
 
public void setObjectsForOwnerId(Set<Object> objectsForOwnerId) {
this.objectsForOwnerId = objectsForOwnerId;
}
public void setObjectsForOwnerId(Set<ObjectEntity> objectsForOwnerId)
{
this.objectsForOwnerId = objectsForOwnerId;
}
 
@OneToMany(fetch = FetchType.LAZY, mappedBy = "userByEditorId")
public Set<Object> getObjectsForEditorId() {
return this.objectsForEditorId;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "userByEditorId")
public Set<ObjectEntity> getObjectsForEditorId()
{
return this.objectsForEditorId;
}
 
public void setObjectsForEditorId(Set<Object> objectsForEditorId) {
this.objectsForEditorId = objectsForEditorId;
}
public void setObjectsForEditorId(Set<ObjectEntity> objectsForEditorId)
{
this.objectsForEditorId = objectsForEditorId;
}
 
@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
public Set<History> getHistories() {
return this.histories;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
public Set<History> getHistories()
{
return this.histories;
}
 
public void setHistories(Set<History> histories) {
this.histories = histories;
}
public void setHistories(Set<History> histories)
{
this.histories = histories;
}
 
}