Subversion Repositories WebE

Compare Revisions

Last modification

Ignore whitespace Rev 33 → Rev 34

/trunk/src/ch/ffhs/webE/domain/Relationship.java
12,7 → 12,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;
 
21,76 → 23,91
*/
@Entity
@Table(name = "relationship", catalog = "webengineering", uniqueConstraints = @UniqueConstraint(columnNames = {
"term_from", "term_to", "type" }))
public class Relationship implements java.io.Serializable {
"term_from", "term_to", "type_id" }))
public class Relationship implements java.io.Serializable
{
private int objectId;
 
private int objectId;
private Term termByTermTo;
private ObjectEntity object;
private RelationshipType relationshipType;
private Term termByTermFrom;
@Transient
private ObjectEntity object;
 
public Relationship() {
}
private Term termFrom;
private Term termTo;
private RelationshipType relationshipType;
 
public Relationship(Term termByTermTo, ObjectEntity object,
RelationshipType relationshipType, Term termByTermFrom) {
this.termByTermTo = termByTermTo;
this.object = object;
this.relationshipType = relationshipType;
this.termByTermFrom = termByTermFrom;
}
public Relationship()
{
}
 
@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 Relationship(Term termByTermTo, ObjectEntity object,
RelationshipType relationshipType, Term termByTermFrom)
{
this.termTo = termByTermTo;
this.object = object;
this.relationshipType = relationshipType;
this.termFrom = termByTermFrom;
}
 
public void setObjectId(int objectId) {
this.objectId = objectId;
}
@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;
}
 
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "term_to", nullable = false)
public Term getTermByTermTo() {
return this.termByTermTo;
}
public void setObjectId(int objectId)
{
this.objectId = objectId;
}
 
public void setTermByTermTo(Term termByTermTo) {
this.termByTermTo = termByTermTo;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "term_to", nullable = false)
public Term getTermTo()
{
return this.termTo;
}
 
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
public ObjectEntity getObject() {
return this.object;
}
public void setTermTo(Term termByTermTo)
{
this.termTo = termByTermTo;
}
 
public void setObject(ObjectEntity object) {
this.object = object;
}
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
public ObjectEntity getObject()
{
return this.object;
}
 
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "type", nullable = false)
public RelationshipType getRelationshipType() {
return this.relationshipType;
}
public void setObject(ObjectEntity object)
{
this.object = object;
}
 
public void setRelationshipType(RelationshipType relationshipType) {
this.relationshipType = relationshipType;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "type_id", nullable = false)
public RelationshipType getRelationshipType()
{
return this.relationshipType;
}
 
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "term_from", nullable = false)
public Term getTermByTermFrom() {
return this.termByTermFrom;
}
public void setRelationshipType(RelationshipType relationshipType)
{
this.relationshipType = relationshipType;
}
 
public void setTermByTermFrom(Term termByTermFrom) {
this.termByTermFrom = termByTermFrom;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "term_from", nullable = false)
public Term getTermFrom()
{
return this.termFrom;
}
 
public void setTermFrom(Term termByTermFrom)
{
this.termFrom = termByTermFrom;
}
 
}
/trunk/src/ch/ffhs/webE/domain/RelationshipType.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,64 → 21,76
*/
@Entity
@Table(name = "relationship_type", catalog = "webengineering", uniqueConstraints = @UniqueConstraint(columnNames = "name_from"))
public class RelationshipType implements java.io.Serializable {
public class RelationshipType implements java.io.Serializable
{
 
private Integer relationshipId;
private String nameFrom;
private String nameTo;
private Set<Relationship> relationships = new HashSet<Relationship>(0);
private Integer id;
private String nameFrom;
private String nameTo;
private Set<Relationship> relationships = new HashSet<Relationship>(0);
 
public RelationshipType() {
}
public RelationshipType()
{
}
 
public RelationshipType(String nameFrom, String nameTo) {
this.nameFrom = nameFrom;
this.nameTo = nameTo;
}
public RelationshipType(String nameFrom, String nameTo)
{
this.nameFrom = nameFrom;
this.nameTo = nameTo;
}
 
public RelationshipType(String nameFrom, String nameTo,
Set<Relationship> relationships) {
this.nameFrom = nameFrom;
this.nameTo = nameTo;
this.relationships = relationships;
}
public RelationshipType(String nameFrom, String nameTo,
Set<Relationship> relationships)
{
this.nameFrom = nameFrom;
this.nameTo = nameTo;
this.relationships = relationships;
}
 
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "relationship_id", unique = true, nullable = false)
public Integer getRelationshipId() {
return this.relationshipId;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false)
public Integer getId()
{
return this.id;
}
 
public void setRelationshipId(Integer relationshipId) {
this.relationshipId = relationshipId;
}
public void setId(Integer id)
{
this.id = id;
}
 
@Column(name = "name_from", unique = true, nullable = false)
public String getNameFrom() {
return this.nameFrom;
}
@Column(name = "name_from", unique = true, nullable = false)
public String getNameFrom()
{
return this.nameFrom;
}
 
public void setNameFrom(String nameFrom) {
this.nameFrom = nameFrom;
}
public void setNameFrom(String nameFrom)
{
this.nameFrom = nameFrom;
}
 
@Column(name = "name_to", nullable = false)
public String getNameTo() {
return this.nameTo;
}
@Column(name = "name_to", nullable = false)
public String getNameTo()
{
return this.nameTo;
}
 
public void setNameTo(String nameTo) {
this.nameTo = nameTo;
}
public void setNameTo(String nameTo)
{
this.nameTo = nameTo;
}
 
@OneToMany(fetch = FetchType.LAZY, mappedBy = "relationshipType")
public Set<Relationship> getRelationships() {
return this.relationships;
}
@OneToMany(fetch = FetchType.LAZY, mappedBy = "relationshipType")
public Set<Relationship> getRelationships()
{
return this.relationships;
}
 
public void setRelationships(Set<Relationship> relationships) {
this.relationships = relationships;
}
public void setRelationships(Set<Relationship> relationships)
{
this.relationships = relationships;
}
 
}
/trunk/src/ch/ffhs/webE/domain/Term.java
45,6 → 45,12
0);
 
/**
* @var <code>true</code> if the term is edited/renamed, <code>false</code>
* otherwise
*/
public boolean edit = false;
 
/**
* No-op constructor
*/
public Term()
130,7 → 136,7
this.name = name;
}
 
@OneToMany(fetch = FetchType.LAZY, mappedBy = "termByTermTo")
@OneToMany(fetch = FetchType.LAZY, mappedBy = "termTo")
public Set<Relationship> getRelationshipsForTermTo()
{
return this.relationshipsForTermTo;
147,7 → 153,7
/**
* @return
*/
@OneToMany(fetch = FetchType.LAZY, mappedBy = "termByTermFrom")
@OneToMany(fetch = FetchType.LAZY, mappedBy = "termFrom")
public Set<Relationship> getRelationshipsForTermFrom()
{
return this.relationshipsForTermFrom;
/trunk/src/ch/ffhs/webE/domain/ObjectType.java
21,11 → 21,21
public class ObjectType implements java.io.Serializable
{
/**
* Version ID for serialization
*/
private static final long serialVersionUID = 1L;
 
/**
* ObjectEntity type ID for a term
*/
public static final int TERM = 1;
 
private int objectTypeId;
/**
* ObjectEntity type ID for a relationship
*/
public static final int RELATIONSHIP = 2;
 
private int id;
private String name;
private Set<ObjectEntity> objects = new HashSet<ObjectEntity>(0);
 
33,28 → 43,28
{
}
 
public ObjectType(int objectTypeId)
public ObjectType(int id)
{
this.objectTypeId = objectTypeId;
this.id = id;
}
 
public ObjectType(int objectTypeId, String name, Set<ObjectEntity> objects)
public ObjectType(int id, String name, Set<ObjectEntity> objects)
{
this.objectTypeId = objectTypeId;
this.id = id;
this.name = name;
this.objects = objects;
}
 
@Id
@Column(name = "object_type_id", unique = true, nullable = false)
public int getObjectTypeId()
@Column(name = "id", unique = true, nullable = false)
public int getId()
{
return this.objectTypeId;
return this.id;
}
 
public void setObjectTypeId(int objectTypeId)
public void setId(int objectTypeId)
{
this.objectTypeId = objectTypeId;
this.id = objectTypeId;
}
 
@Column(name = "name", unique = true, length = 45)