Nya dataobject för KNÖLen
git-svn-id: svn://svn.dsv.su.se/scipro/scipro/trunk@115 73ecded7-942e-4092-bab0-0e58ef0ee984
This commit is contained in:
parent
41bcd0191d
commit
0d2250e38d
src/main/java/se/su/dsv/scipro/data/dataobjects
23
src/main/java/se/su/dsv/scipro/data/dataobjects/Comment.java
Normal file
23
src/main/java/se/su/dsv/scipro/data/dataobjects/Comment.java
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package se.su.dsv.scipro.data.dataobjects;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
/**
|
||||
* @author Johan Aschan - aschan@dsv.su.se
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="comment")
|
||||
@Cacheable(true)
|
||||
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
public class Comment extends Ratable {
|
||||
|
||||
}
|
27
src/main/java/se/su/dsv/scipro/data/dataobjects/File.java
Normal file
27
src/main/java/se/su/dsv/scipro/data/dataobjects/File.java
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package se.su.dsv.scipro.data.dataobjects;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
/**
|
||||
* @author Johan Aschan - aschan@dsv.su.se
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="file")
|
||||
@Cacheable(true)
|
||||
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
public class File extends Resource {
|
||||
|
||||
|
||||
}
|
||||
|
26
src/main/java/se/su/dsv/scipro/data/dataobjects/Link.java
Normal file
26
src/main/java/se/su/dsv/scipro/data/dataobjects/Link.java
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package se.su.dsv.scipro.data.dataobjects;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
/**
|
||||
* @author Johan Aschan - aschan@dsv.su.se
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name="link")
|
||||
@Cacheable(true)
|
||||
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
public class Link extends Resource {
|
||||
|
||||
|
||||
}
|
41
src/main/java/se/su/dsv/scipro/data/dataobjects/Ratable.java
Normal file
41
src/main/java/se/su/dsv/scipro/data/dataobjects/Ratable.java
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package se.su.dsv.scipro.data.dataobjects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
/**
|
||||
* @author Johan Aschan - aschan@dsv.su.se
|
||||
*
|
||||
*/
|
||||
@MappedSuperclass
|
||||
public abstract class Ratable extends LazyDeletableDomainObject{
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@OneToMany
|
||||
private List<Rating> ratingList = new ArrayList<Rating>();
|
||||
|
||||
public List<Rating> getRatingList() {
|
||||
return ratingList;
|
||||
}
|
||||
|
||||
public void setRatingList(List<Rating> ratingList) {
|
||||
this.ratingList = ratingList;
|
||||
}
|
||||
|
||||
}
|
48
src/main/java/se/su/dsv/scipro/data/dataobjects/Rating.java
Normal file
48
src/main/java/se/su/dsv/scipro/data/dataobjects/Rating.java
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package se.su.dsv.scipro.data.dataobjects;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
/**
|
||||
* @author Johan Aschan - aschan@dsv.su.se
|
||||
*
|
||||
*/
|
||||
|
||||
@Entity
|
||||
@Table(name="rating")
|
||||
@Cacheable(true)
|
||||
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
public class Rating extends LazyDeletableDomainObject{
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
private User user;
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package se.su.dsv.scipro.data.dataobjects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
/**
|
||||
* @author Johan Aschan - aschan@se.su.dsv
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Cacheable(true)
|
||||
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
@Table(name="resource")
|
||||
//@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
|
||||
public class Resource extends Ratable {
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name="resource_tag")
|
||||
private List<Tag> tagList = new ArrayList<Tag>();
|
||||
|
||||
@OneToMany
|
||||
private List<Comment> commentList = new ArrayList<Comment>();
|
||||
|
||||
|
||||
public List<Tag> getTagList() {
|
||||
return tagList;
|
||||
}
|
||||
|
||||
public void setTagList(List<Tag> tagList) {
|
||||
this.tagList = tagList;
|
||||
}
|
||||
|
||||
public List<Comment> getCommentList() {
|
||||
return commentList;
|
||||
}
|
||||
|
||||
public void setCommentList(List<Comment> commentList) {
|
||||
this.commentList = commentList;
|
||||
}
|
||||
}
|
34
src/main/java/se/su/dsv/scipro/data/dataobjects/Tag.java
Normal file
34
src/main/java/se/su/dsv/scipro/data/dataobjects/Tag.java
Normal file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package se.su.dsv.scipro.data.dataobjects;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
/**
|
||||
* @author Johan Aschan - aschan@dsv.su.se
|
||||
*
|
||||
*/
|
||||
|
||||
@Entity
|
||||
@Table(name="tag")
|
||||
@Cacheable(true)
|
||||
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
public class Tag extends LazyDeletableDomainObject {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private Long id;
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user