* LoginAction.java - Use UserDAOImpl type for better source lookup * TermAction.ava - Use obvious serialization version - Implemented add() * UserAction.java - Use more obvious serialization version * TermDAO.java - Renamed listTermById() to getTermById() - Added Javadoc * TermDAOImpl.java - Fixed "FROM term" bug (no SQL, case-sensitive) - saveOrUpdate() now returns boolean (for TermAction) * Term.java - Now imports java.io.Serializable - Added serialization version ID - Use TermDAOImpl type for better source lookup * struts.xml - /doTermAdd now triggers add() - Added basic Term actions * user/nav.jsp - Added /listTerm link to trigger user/termList.jsp * user/termAddForm.jsp - Now functional and reusable for Rename Term * General: - Clean-up: + Renamed Object to ObjectEntity + Source formatting - Added javax.persistence and org.hibernate sources (for Javadoc) - Added PDF documentation generated from OpenDocument Text
/trunk/src/ch/ffhs/webE/domain/ObjectEntity.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 33) |
+++ History.java (revision 21) |
@@ -25,7 +25,7 @@ |
private Integer id; |
private User user; |
private ActionType actionType; |
- private ObjectEntity object; |
+ private Object object; |
private String value; |
private String comment; |
private Date date; |
@@ -33,7 +33,7 @@ |
public History() { |
} |
- public History(User user, ActionType actionType, ObjectEntity object, Date date) { |
+ public History(User user, ActionType actionType, Object 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, ObjectEntity object, |
+ public History(User user, ActionType actionType, Object 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 ObjectEntity getObject() { |
+ public Object getObject() { |
return this.object; |
} |
- public void setObject(ObjectEntity object) { |
+ public void setObject(Object object) { |
this.object = object; |
} |
/trunk/src/ch/ffhs/webE/domain/Relationship.java |
---|
26,7 → 26,7 |
private int objectId; |
private Term termByTermTo; |
private ObjectEntity object; |
private Object object; |
private RelationshipType relationshipType; |
private Term termByTermFrom; |
33,7 → 33,7 |
public Relationship() { |
} |
public Relationship(Term termByTermTo, ObjectEntity object, |
public Relationship(Term termByTermTo, Object object, |
RelationshipType relationshipType, Term termByTermFrom) { |
this.termByTermTo = termByTermTo; |
this.object = object; |
65,11 → 65,11 |
@OneToOne(fetch = FetchType.LAZY) |
@PrimaryKeyJoinColumn |
public ObjectEntity getObject() { |
public Object getObject() { |
return this.object; |
} |
public void setObject(ObjectEntity object) { |
public void setObject(Object object) { |
this.object = object; |
} |
/trunk/src/ch/ffhs/webE/domain/Object.java |
---|
0,0 → 1,160 |
package ch.ffhs.webE.domain; |
// Generated 19.12.2010 14:46:08 by Hibernate Tools 3.4.0.Beta1 |
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 static javax.persistence.GenerationType.IDENTITY; |
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; |
/** |
* Object generated by hbm2java |
*/ |
@Entity |
@Table(name = "object", catalog = "webengineering") |
public class Object implements java.io.Serializable { |
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 Object() { |
} |
public Object(User userByEditorId, ObjectType objectType, User userByOwnerId) { |
this.userByEditorId = userByEditorId; |
this.objectType = objectType; |
this.userByOwnerId = userByOwnerId; |
} |
public Object(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; |
} |
@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; |
} |
@ManyToOne(fetch = FetchType.LAZY) |
@JoinColumn(name = "editor_id", nullable = false) |
public User getUserByEditorId() { |
return this.userByEditorId; |
} |
public void setUserByEditorId(User userByEditorId) { |
this.userByEditorId = userByEditorId; |
} |
@ManyToOne(fetch = FetchType.LAZY) |
@JoinColumn(name = "object_type_id", nullable = false) |
public ObjectType getObjectType() { |
return this.objectType; |
} |
public void setObjectType(ObjectType objectType) { |
this.objectType = objectType; |
} |
@ManyToOne(fetch = FetchType.LAZY) |
@JoinColumn(name = "owner_id", nullable = false) |
public User getUserByOwnerId() { |
return this.userByOwnerId; |
} |
public void setUserByOwnerId(User userByOwnerId) { |
this.userByOwnerId = userByOwnerId; |
} |
@Temporal(TemporalType.TIMESTAMP) |
@Column(name = "locked", length = 19) |
public Date getLocked() { |
return this.locked; |
} |
public void setLocked(Date locked) { |
this.locked = locked; |
} |
@Temporal(TemporalType.TIMESTAMP) |
@Column(name = "modified", length = 19) |
public Date getModified() { |
return this.modified; |
} |
public void setModified(Date modified) { |
this.modified = modified; |
} |
@Column(name = "deleted") |
public Boolean getDeleted() { |
return this.deleted; |
} |
public void setDeleted(Boolean deleted) { |
this.deleted = deleted; |
} |
@OneToOne(fetch = FetchType.LAZY, mappedBy = "object") |
public Term getTerm() { |
return this.term; |
} |
public void setTerm(Term term) { |
this.term = term; |
} |
@OneToMany(fetch = FetchType.LAZY, mappedBy = "object") |
public Set<History> getHistories() { |
return this.histories; |
} |
public void setHistories(Set<History> histories) { |
this.histories = histories; |
} |
@OneToOne(fetch = FetchType.LAZY, mappedBy = "object") |
public Relationship getRelationship() { |
return this.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 33) |
+++ Term.java (revision 21) |
@@ -2,11 +2,8 @@ |
// 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; |
@@ -16,9 +13,7 @@ |
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; |
@@ -27,139 +22,81 @@ |
*/ |
@Entity |
@Table(name = "term", catalog = "webengineering", uniqueConstraints = @UniqueConstraint(columnNames = "name")) |
-public class Term implements Serializable |
-{ |
- /** |
- * Version ID for serialization |
- */ |
- private static final long serialVersionUID = 1L; |
+public class Term implements java.io.Serializable { |
- @Transient |
- private int objectId; |
+ 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); |
- private ObjectEntity object; |
- private String name; |
- private Set<Relationship> relationshipsForTermTo = new HashSet<Relationship>( |
- 0); |
- private Set<Relationship> relationshipsForTermFrom = new HashSet<Relationship>( |
- 0); |
+ public Term() { |
+ } |
- /** |
- * No-op constructor |
- */ |
- public Term() |
- { |
- } |
+ public Term(Object object) { |
+ this.object = object; |
+ } |
- /** |
- * @param object |
- */ |
- public Term(ObjectEntity object) |
- { |
- this.object = object; |
- } |
+ 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 |
- * @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; |
- } |
+ @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; |
+ } |
- /** |
- * @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; |
- } |
+ public void setObjectId(int objectId) { |
+ this.objectId = objectId; |
+ } |
- /** |
- * @param objectId |
- */ |
- public void setObjectId(int objectId) |
- { |
- this.objectId = objectId; |
- } |
+ @OneToOne(fetch = FetchType.LAZY) |
+ @PrimaryKeyJoinColumn |
+ public Object getObject() { |
+ return this.object; |
+ } |
- /** |
- * @return ObjectEntity domain object |
- */ |
- @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) |
- @PrimaryKeyJoinColumn |
- public ObjectEntity getObject() |
- { |
- return this.object; |
- } |
+ public void setObject(Object object) { |
+ this.object = object; |
+ } |
- /** |
- * @param object |
- */ |
- public void setObject(ObjectEntity object) |
- { |
- this.object = object; |
- } |
+ @Column(name = "name", unique = true) |
+ public String getName() { |
+ return this.name; |
+ } |
- /** |
- * @return |
- */ |
- @Column(name = "name", unique = true) |
- public String getName() |
- { |
- return this.name; |
- } |
+ public void setName(String name) { |
+ this.name = name; |
+ } |
- /** |
- * @param name |
- */ |
- public void setName(String name) |
- { |
- this.name = name; |
- } |
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "termByTermTo") |
+ public Set<Relationship> getRelationshipsForTermTo() { |
+ return this.relationshipsForTermTo; |
+ } |
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "termByTermTo") |
- public Set<Relationship> getRelationshipsForTermTo() |
- { |
- return this.relationshipsForTermTo; |
- } |
+ public void setRelationshipsForTermTo( |
+ Set<Relationship> relationshipsForTermTo) { |
+ this.relationshipsForTermTo = relationshipsForTermTo; |
+ } |
- /** |
- * @param relationshipsForTermTo |
- */ |
- public void setRelationshipsForTermTo(Set<Relationship> relationshipsForTermTo) |
- { |
- this.relationshipsForTermTo = relationshipsForTermTo; |
- } |
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "termByTermFrom") |
+ public Set<Relationship> getRelationshipsForTermFrom() { |
+ return this.relationshipsForTermFrom; |
+ } |
- /** |
- * @return |
- */ |
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "termByTermFrom") |
- public Set<Relationship> getRelationshipsForTermFrom() |
- { |
- return this.relationshipsForTermFrom; |
- } |
+ public void setRelationshipsForTermFrom( |
+ Set<Relationship> relationshipsForTermFrom) { |
+ this.relationshipsForTermFrom = relationshipsForTermFrom; |
+ } |
- /** |
- * @param relationshipsForTermFrom |
- */ |
- public void setRelationshipsForTermFrom( |
- Set<Relationship> relationshipsForTermFrom) |
- { |
- this.relationshipsForTermFrom = relationshipsForTermFrom; |
- } |
- |
} |
/trunk/src/ch/ffhs/webE/domain/ObjectType.java |
---|
4,7 → 4,6 |
import java.util.HashSet; |
import java.util.Set; |
import javax.persistence.Column; |
import javax.persistence.Entity; |
import javax.persistence.FetchType; |
18,65 → 17,51 |
*/ |
@Entity |
@Table(name = "object_type", catalog = "webengineering", uniqueConstraints = @UniqueConstraint(columnNames = "name")) |
public class ObjectType implements java.io.Serializable |
{ |
/** |
* ObjectEntity type ID for a term |
*/ |
public static final int TERM = 1; |
public class ObjectType implements java.io.Serializable { |
private int objectTypeId; |
private String name; |
private Set<ObjectEntity> objects = new HashSet<ObjectEntity>(0); |
private int objectTypeId; |
private String name; |
private Set<Object> objects = new HashSet<Object>(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<ObjectEntity> objects) |
{ |
this.objectTypeId = objectTypeId; |
this.name = name; |
this.objects = objects; |
} |
public ObjectType(int objectTypeId, String name, Set<Object> 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<ObjectEntity> getObjects() |
{ |
return this.objects; |
} |
@OneToMany(fetch = FetchType.LAZY, mappedBy = "objectType") |
public Set<Object> getObjects() { |
return this.objects; |
} |
public void setObjects(Set<ObjectEntity> objects) |
{ |
this.objects = objects; |
} |
public void setObjects(Set<Object> objects) { |
this.objects = objects; |
} |
} |
/trunk/src/ch/ffhs/webE/domain/User.java |
---|
2,15 → 2,13 |
// 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; |
21,147 → 19,121 |
*/ |
@Entity |
@Table(name = "user", catalog = "webengineering", uniqueConstraints = @UniqueConstraint(columnNames = "username")) |
public class User implements java.io.Serializable |
{ |
/** |
* Version ID for serialization |
*/ |
private static final long serialVersionUID = 1L; |
public class User implements java.io.Serializable { |
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); |
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); |
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<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; |
} |
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; |
} |
@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<ObjectEntity> getObjectsForOwnerId() |
{ |
return this.objectsForOwnerId; |
} |
@OneToMany(fetch = FetchType.LAZY, mappedBy = "userByOwnerId") |
public Set<Object> getObjectsForOwnerId() { |
return this.objectsForOwnerId; |
} |
public void setObjectsForOwnerId(Set<ObjectEntity> objectsForOwnerId) |
{ |
this.objectsForOwnerId = objectsForOwnerId; |
} |
public void setObjectsForOwnerId(Set<Object> objectsForOwnerId) { |
this.objectsForOwnerId = objectsForOwnerId; |
} |
@OneToMany(fetch = FetchType.LAZY, mappedBy = "userByEditorId") |
public Set<ObjectEntity> getObjectsForEditorId() |
{ |
return this.objectsForEditorId; |
} |
@OneToMany(fetch = FetchType.LAZY, mappedBy = "userByEditorId") |
public Set<Object> getObjectsForEditorId() { |
return this.objectsForEditorId; |
} |
public void setObjectsForEditorId(Set<ObjectEntity> objectsForEditorId) |
{ |
this.objectsForEditorId = objectsForEditorId; |
} |
public void setObjectsForEditorId(Set<Object> 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; |
} |
} |