Merged CorePersistence Branch
This commit is contained in:
@@ -3,24 +3,27 @@ package org.yacos.core.article;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import javax.persistence.*;
|
||||
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.ManyToOne;
|
||||
import org.yacos.core.conferences.Conference;
|
||||
import org.yacos.core.users.User;
|
||||
|
||||
//@Entity
|
||||
@Entity
|
||||
public class Article implements Serializable {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// @Id
|
||||
// @GeneratedValue(strategy=GenerationType.AUTO)
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
private int id;
|
||||
private String title;
|
||||
private String topic;
|
||||
@@ -31,30 +34,30 @@ public class Article implements Serializable {
|
||||
/**
|
||||
* The conference this article has been submitted for
|
||||
*/
|
||||
//@ManyToOne(targetEntity=Conference.class)
|
||||
//@JoinColumn(name="conference_id",nullable=false)
|
||||
@ManyToOne(targetEntity=Conference.class)
|
||||
@JoinColumn(name="conference_id",nullable=false)
|
||||
private Conference conference;
|
||||
|
||||
/**
|
||||
* The referees reviewing this article
|
||||
*/
|
||||
/*@ManyToMany(targetEntity=User.class)
|
||||
@ManyToMany(targetEntity=User.class)
|
||||
@JoinTable(
|
||||
name="articles_referees_map",
|
||||
joinColumns=@JoinColumn(name="user_id"),
|
||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||
)*/
|
||||
|
||||
)
|
||||
private Collection<User> referees;
|
||||
|
||||
/**
|
||||
* The PC Members responsible for this article evaluation
|
||||
*/
|
||||
/*@ManyToMany(targetEntity=User.class)
|
||||
@ManyToMany(targetEntity=User.class)
|
||||
@JoinTable(
|
||||
name="articles_pcmembers_map",
|
||||
joinColumns=@JoinColumn(name="user_id"),
|
||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||
)*/
|
||||
)
|
||||
private Collection<User> pcMembers;
|
||||
|
||||
private int state;
|
||||
@@ -65,8 +68,6 @@ public class Article implements Serializable {
|
||||
|
||||
public Article() {
|
||||
secondaryAuthors = new ArrayList<String>();
|
||||
referees = new ArrayList<User>();
|
||||
pcMembers = new ArrayList<User>();
|
||||
}
|
||||
|
||||
public Article(int reference, String title, String topic,
|
||||
@@ -81,8 +82,8 @@ public class Article implements Serializable {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
//@Id
|
||||
//@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -139,26 +140,47 @@ public class Article implements Serializable {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
/*@ManyToMany(targetEntity=User.class)
|
||||
@ManyToMany(targetEntity=User.class)
|
||||
@JoinTable(
|
||||
name="articles_referees_map",
|
||||
joinColumns=@JoinColumn(name="user_id"),
|
||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||
)*/
|
||||
)
|
||||
public Collection<User> getReferees(){
|
||||
return this.referees;
|
||||
//return em.createQuery("SELECT u FROM User u").getResultList();
|
||||
return referees;
|
||||
}
|
||||
|
||||
/*@ManyToMany(targetEntity=User.class)
|
||||
/**
|
||||
* @param referees the referees to set
|
||||
*/
|
||||
@ManyToMany(targetEntity=User.class)
|
||||
@JoinTable(
|
||||
name="articles_referees_map",
|
||||
joinColumns=@JoinColumn(name="user_id"),
|
||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||
)
|
||||
public void setReferees(Collection<User> referees) {
|
||||
this.referees = referees;
|
||||
}
|
||||
|
||||
@ManyToMany(targetEntity=User.class)
|
||||
@JoinTable(
|
||||
name="articles_pcmembers_map",
|
||||
joinColumns=@JoinColumn(name="user_id"),
|
||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||
)*/
|
||||
)
|
||||
public Collection<User> getPCMembers(){
|
||||
return pcMembers;
|
||||
}
|
||||
@ManyToMany(targetEntity=User.class)
|
||||
@JoinTable(
|
||||
name="articles_pcmembers_map",
|
||||
joinColumns=@JoinColumn(name="user_id"),
|
||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||
)
|
||||
public void setPCMembers(Collection<User> pcMembers){
|
||||
this.pcMembers = pcMembers;
|
||||
}
|
||||
|
||||
public void assignToPCMember(User pcMember){
|
||||
// TODO : Checking if the User is a pcMember for this conference (not implemented yet)
|
||||
@@ -179,12 +201,12 @@ public class Article implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
//@ManyToOne(targetEntity=Conference.class)
|
||||
@ManyToOne(targetEntity=Conference.class)
|
||||
public Conference getConference(){
|
||||
return conference;
|
||||
}
|
||||
|
||||
//@ManyToOne(targetEntity=Conference.class)
|
||||
@ManyToOne(targetEntity=Conference.class)
|
||||
public void setConference(Conference conference){
|
||||
this.conference = conference;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package org.yacos.core.article;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
@@ -22,49 +20,38 @@ public class ArticleManagerBean implements IArticleManager, Serializable {
|
||||
@PersistenceContext
|
||||
EntityManager em;
|
||||
|
||||
List<Article> articles;
|
||||
|
||||
public ArticleManagerBean() {
|
||||
articles = new ArrayList<Article>();
|
||||
|
||||
}
|
||||
|
||||
public void addArticle(Article a) {
|
||||
//em.persist(a);
|
||||
articles.add(a);
|
||||
em.persist(a);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Article> getArticles() {
|
||||
//return em.createQuery("from Article a ORDER BY a.title").getResultList();
|
||||
return articles;
|
||||
return em.createQuery("from Article a ORDER BY a.title").getResultList();
|
||||
}
|
||||
|
||||
public void updateArticle(Integer id, Article newArticle) {
|
||||
removeArticle(getArticle(id));
|
||||
newArticle.setId(id);
|
||||
addArticle(newArticle);
|
||||
//em.flush();
|
||||
em.flush();
|
||||
}
|
||||
|
||||
public void removeArticle(Article a) {
|
||||
//em.remove(a);
|
||||
//em.flush();
|
||||
articles.remove(a);
|
||||
em.remove(a);
|
||||
em.flush();
|
||||
}
|
||||
|
||||
public Article getArticle(Integer id) {
|
||||
//return em.find(Article.class, id);
|
||||
for (Article a : articles) {
|
||||
if(a.getId()== id){
|
||||
return a;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return em.find(Article.class, id);
|
||||
}
|
||||
|
||||
public void assignArticleToPCMember(Article article,User pcMember){
|
||||
article.assignToPCMember(pcMember);
|
||||
//em.flush();
|
||||
em.flush();
|
||||
}
|
||||
|
||||
public List<User> getArticlePCMembers(Article article) {
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
*/
|
||||
package org.yacos.core.article;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
@@ -15,26 +15,43 @@ import org.yacos.core.users.User;
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
//@Entity
|
||||
public class Delegation implements Serializable {
|
||||
//@ManyToOne(targetEntity=Article.class)
|
||||
//@JoinColumn(name="article_id")
|
||||
|
||||
|
||||
@Entity
|
||||
public class Delegation {
|
||||
/**
|
||||
* Id mandatory in every entity.
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
private Integer id;
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id")
|
||||
private Article article;
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="pcmember_id")
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id")
|
||||
private User pcMember;
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="referee_id")
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="referee_id")
|
||||
private User referee;
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Article being evaluated through this delegation
|
||||
* @return the article
|
||||
*/
|
||||
//@ManyToOne(targetEntity=Article.class)
|
||||
//@JoinColumn(name="article_id")
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id")
|
||||
public Article getArticle() {
|
||||
return article;
|
||||
}
|
||||
@@ -42,8 +59,8 @@ public class Delegation implements Serializable {
|
||||
* Define the article evaluated through this delegation
|
||||
* @param article the article to set
|
||||
*/
|
||||
//@ManyToOne(targetEntity=Article.class)
|
||||
//@JoinColumn(name="article_id")
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id")
|
||||
public void setArticle(Article article) {
|
||||
this.article = article;
|
||||
}
|
||||
@@ -51,8 +68,8 @@ public class Delegation implements Serializable {
|
||||
* PCMember that delegated the article to a referee
|
||||
* @return the pcMember
|
||||
*/
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="pcmember_id")
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id")
|
||||
public User getPcMember() {
|
||||
return pcMember;
|
||||
}
|
||||
@@ -60,8 +77,8 @@ public class Delegation implements Serializable {
|
||||
* Set PCMember that delegated the article to a referee
|
||||
* @param pcMember the pcMember to set
|
||||
*/
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="pcmember_id")
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id")
|
||||
public void setPcMember(User pcMember) {
|
||||
this.pcMember = pcMember;
|
||||
}
|
||||
@@ -69,8 +86,8 @@ public class Delegation implements Serializable {
|
||||
* Get the referee that will evaluate this article
|
||||
* @return the referee
|
||||
*/
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="referee_id")
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="referee_id")
|
||||
public User getReferee() {
|
||||
return referee;
|
||||
}
|
||||
@@ -78,12 +95,11 @@ public class Delegation implements Serializable {
|
||||
* Get
|
||||
* @param referee the referee to set
|
||||
*/
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="referee_id")
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="referee_id")
|
||||
public void setReferee(User referee) {
|
||||
this.referee = referee;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ package org.yacos.core.article;
|
||||
import java.util.List;
|
||||
import javax.ejb.Remote;
|
||||
|
||||
import org.yacos.core.conferences.Conference;
|
||||
|
||||
@Remote
|
||||
public interface IArticleManager {
|
||||
public Article getArticle(Integer id);
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
package org.yacos.core.article;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
import org.yacos.core.users.User;
|
||||
|
||||
@@ -12,54 +16,67 @@ import org.yacos.core.users.User;
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
//@Entity
|
||||
@Entity
|
||||
public class Preference {
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="pcmember_id",nullable=false)
|
||||
|
||||
//@Id
|
||||
private int id;
|
||||
|
||||
/**
|
||||
* Id mandatory in every entity.
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
private Integer id;
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id",nullable=false)
|
||||
private User pcMember;
|
||||
//@ManyToOne(targetEntity=Article.class)
|
||||
//@JoinColumn(name="article_id",nullable=false)
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id",nullable=false)
|
||||
private Article article;
|
||||
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
@Id
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
@Id
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the pcMember
|
||||
*/
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="pcmember_id",nullable=false)
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id",nullable=false)
|
||||
public User getPcMember() {
|
||||
return pcMember;
|
||||
}
|
||||
/**
|
||||
* @param pcMember the pcMember to set
|
||||
*/
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="pcmember_id",nullable=false)
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id",nullable=false)
|
||||
public void setPcMember(User pcMember) {
|
||||
this.pcMember = pcMember;
|
||||
}
|
||||
/**
|
||||
* @return the article
|
||||
*/
|
||||
//@ManyToOne(targetEntity=Article.class)
|
||||
//@JoinColumn(name="article_id",nullable=false)
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id",nullable=false)
|
||||
public Article getArticle() {
|
||||
return article;
|
||||
}
|
||||
/**
|
||||
* @param article the article to set
|
||||
*/
|
||||
//@ManyToOne(targetEntity=Article.class)
|
||||
//@JoinColumn(name="article_id",nullable=false)
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id",nullable=false)
|
||||
public void setArticle(Article article) {
|
||||
this.article = article;
|
||||
}
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +1,36 @@
|
||||
package org.yacos.core.conferences;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
|
||||
import org.yacos.core.article.Article;
|
||||
import org.yacos.core.article.ArticleManagerBean;
|
||||
|
||||
@Stateless
|
||||
public class ConferenceManagerBean implements IConferenceManager {
|
||||
@PersistenceContext
|
||||
EntityManager em;
|
||||
|
||||
private List<Conference> conferences;
|
||||
|
||||
public void addConference(Conference conf) {
|
||||
//em.persist(conf);
|
||||
conferences.add(conf);
|
||||
em.persist(conf);
|
||||
}
|
||||
|
||||
public List<Conference> getConferences() {
|
||||
//return em.createQuery("from Conference conf ORDER BY conf.id").getResultList();
|
||||
return conferences;
|
||||
return em.createQuery("from Conference conf ORDER BY conf.id").getResultList();
|
||||
}
|
||||
|
||||
public Conference getConference(Integer id) {
|
||||
//return em.find(Conference.class, id);
|
||||
for (Conference c : conferences) {
|
||||
if(c.getId()== id){
|
||||
return c;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return em.find(Conference.class, id);
|
||||
}
|
||||
|
||||
public void remove(Integer id) {
|
||||
Conference conf=this.getConference(id);
|
||||
//em.remove(conf);
|
||||
conferences.remove(conf);
|
||||
em.remove(conf);
|
||||
}
|
||||
|
||||
public void update(Conference newC, Integer id) {
|
||||
@@ -48,7 +39,7 @@ public class ConferenceManagerBean implements IConferenceManager {
|
||||
}
|
||||
|
||||
public List<Article> getArticles(Integer conference_id) {
|
||||
return getConference(conference_id).getArticles();
|
||||
return new ArrayList<Article>(getConference(conference_id).getArticles());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
105
YACOSCore/ejbModule/org/yacos/core/evaluation/Criterion.java
Normal file
105
YACOSCore/ejbModule/org/yacos/core/evaluation/Criterion.java
Normal file
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.yacos.core.evaluation;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
import org.yacos.core.conferences.Conference;
|
||||
|
||||
/**
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
public class Criterion {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
private Integer id;
|
||||
private String name;
|
||||
private Integer min;
|
||||
private Integer max;
|
||||
|
||||
@ManyToOne(targetEntity=Conference.class)
|
||||
@JoinColumn(name="conference_id",nullable=false)
|
||||
private Conference conference;
|
||||
|
||||
@ManyToOne(targetEntity=Conference.class)
|
||||
@JoinColumn(name="conference_id",nullable=false)
|
||||
public Conference getConference(){
|
||||
return conference;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param conference the conference to set
|
||||
*/
|
||||
@ManyToOne(targetEntity=Conference.class)
|
||||
@JoinColumn(name="conference_id",nullable=false)
|
||||
public void setConference(Conference conference) {
|
||||
this.conference = conference;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the name of this criterion
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name of this criterion
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the minimum value for this criterion
|
||||
*/
|
||||
public Integer getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param min the minimum value for this criterion
|
||||
*/
|
||||
public void setMin(Integer min) {
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximum value for this criterion
|
||||
*/
|
||||
public Integer getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param max the maximum value for this criterion
|
||||
*/
|
||||
public void setMax(Integer max) {
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.yacos.core.evaluation;
|
||||
|
||||
/**
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
public class EvaluationManager implements IEvaluationManager {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.yacos.core.evaluation;
|
||||
|
||||
/**
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
public interface IEvaluationManager {
|
||||
|
||||
}
|
||||
89
YACOSCore/ejbModule/org/yacos/core/evaluation/Rating.java
Normal file
89
YACOSCore/ejbModule/org/yacos/core/evaluation/Rating.java
Normal file
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.yacos.core.evaluation;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
/**
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
public class Rating {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
private Integer id;
|
||||
private Integer value;
|
||||
@ManyToOne(targetEntity=Criterion.class)
|
||||
@JoinColumn(name="criterion_id",nullable=false)
|
||||
private Criterion criterion;
|
||||
@ManyToOne(targetEntity=Report.class)
|
||||
@JoinColumn(name="report_id",nullable=false)
|
||||
private Report report;
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
@Id
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
@Id
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* @return the value
|
||||
*/
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* @param value the value to set
|
||||
*/
|
||||
public void setValue(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
/**
|
||||
* @return the criterion
|
||||
*/
|
||||
@ManyToOne(targetEntity=Criterion.class)
|
||||
@JoinColumn(name="criterion_id",nullable=false)
|
||||
public Criterion getCriterion() {
|
||||
return criterion;
|
||||
}
|
||||
/**
|
||||
* @param criterion the criterion to set
|
||||
*/
|
||||
@ManyToOne(targetEntity=Criterion.class)
|
||||
@JoinColumn(name="criterion_id",nullable=false)
|
||||
public void setCriterion(Criterion criterion) {
|
||||
this.criterion = criterion;
|
||||
}
|
||||
/**
|
||||
* @return the report
|
||||
*/
|
||||
@ManyToOne(targetEntity=Report.class)
|
||||
@JoinColumn(name="report_id",nullable=false)
|
||||
public Report getReport() {
|
||||
return report;
|
||||
}
|
||||
/**
|
||||
* @param report the report to set
|
||||
*/
|
||||
@ManyToOne(targetEntity=Report.class)
|
||||
@JoinColumn(name="report_id",nullable=false)
|
||||
public void setReport(Report report) {
|
||||
this.report = report;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
129
YACOSCore/ejbModule/org/yacos/core/evaluation/Report.java
Normal file
129
YACOSCore/ejbModule/org/yacos/core/evaluation/Report.java
Normal file
@@ -0,0 +1,129 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.yacos.core.evaluation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.yacos.core.article.Article;
|
||||
import org.yacos.core.users.User;
|
||||
|
||||
/**
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
public class Report {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
private Integer id;
|
||||
private String commentPCMember;
|
||||
private String commentAuthor;
|
||||
@OneToMany(targetEntity=Rating.class,mappedBy="report")
|
||||
private Collection<Rating> ratings;
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="referee_id",nullable=false)
|
||||
private User referee;
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id",nullable=false)
|
||||
private Article article;
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
@Id
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
@Id
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* @return the commentPCMember
|
||||
*/
|
||||
public String getCommentPCMember() {
|
||||
return commentPCMember;
|
||||
}
|
||||
/**
|
||||
* @param commentPCMember the commentPCMember to set
|
||||
*/
|
||||
public void setCommentPCMember(String commentPCMember) {
|
||||
this.commentPCMember = commentPCMember;
|
||||
}
|
||||
/**
|
||||
* @return the commentAuthor
|
||||
*/
|
||||
public String getCommentAuthor() {
|
||||
return commentAuthor;
|
||||
}
|
||||
/**
|
||||
* @param commentAuthor the commentAuthor to set
|
||||
*/
|
||||
public void setCommentAuthor(String commentAuthor) {
|
||||
this.commentAuthor = commentAuthor;
|
||||
}
|
||||
/**
|
||||
* @return the referee
|
||||
*/
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="referee_id",nullable=false)
|
||||
public User getReferee() {
|
||||
return referee;
|
||||
}
|
||||
/**
|
||||
* @param referee the referee to set
|
||||
*/
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="referee_id",nullable=false)
|
||||
public void setReferee(User referee) {
|
||||
this.referee = referee;
|
||||
}
|
||||
/**
|
||||
* @return the article
|
||||
*/
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id",nullable=false)
|
||||
public Article getArticle() {
|
||||
return article;
|
||||
}
|
||||
/**
|
||||
* @param article the article to set
|
||||
*/
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id",nullable=false)
|
||||
public void setArticle(Article article) {
|
||||
this.article = article;
|
||||
}
|
||||
|
||||
public void addRating(Rating rating){
|
||||
ratings.add(rating);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ratings
|
||||
*/
|
||||
@OneToMany(targetEntity=Rating.class,mappedBy="report")
|
||||
public Collection<Rating> getRatings() {
|
||||
return ratings;
|
||||
}
|
||||
/**
|
||||
* @param ratings the ratings to set
|
||||
*/
|
||||
@OneToMany(targetEntity=Rating.class,mappedBy="report")
|
||||
public void setRatings(ArrayList<Rating> ratings) {
|
||||
this.ratings = ratings;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,18 @@
|
||||
package org.yacos.core.users;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.yacos.core.conferences.Conference;
|
||||
import org.yacos.core.users.RoleType.RoleTypeEnum;
|
||||
|
||||
/**
|
||||
* An role of a given type (author,chairman,PCmember or referee)
|
||||
@@ -8,26 +20,47 @@ import org.yacos.core.conferences.Conference;
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
public class Role {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
private Integer id;
|
||||
/**
|
||||
* User for which this role is defined
|
||||
*/
|
||||
@ManyToOne(targetEntity=User.class,optional=false)
|
||||
@JoinColumn(name="user_id",nullable=false)
|
||||
private User user;
|
||||
/**
|
||||
* Conference for which this role is defined
|
||||
*/
|
||||
@ManyToOne(targetEntity=Conference.class,optional=false)
|
||||
@JoinColumn(name="conference_id",nullable=false)
|
||||
private Conference conference;
|
||||
/**
|
||||
* The type of this role
|
||||
*/
|
||||
private RoleType type;
|
||||
@Enumerated(EnumType.ORDINAL)
|
||||
private RoleTypeEnum type;
|
||||
|
||||
public Role(RoleType type,User user, Conference conference) {
|
||||
public Role(RoleTypeEnum type,User user, Conference conference) {
|
||||
super();
|
||||
setType(type);
|
||||
setUser(user);
|
||||
setConference(conference);
|
||||
}
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* @return the user who plays this role
|
||||
*/
|
||||
@@ -55,13 +88,13 @@ public class Role {
|
||||
/**
|
||||
* @return the type of this role
|
||||
*/
|
||||
public RoleType getType() {
|
||||
public RoleTypeEnum getType() {
|
||||
return type;
|
||||
}
|
||||
/**
|
||||
* @param type the type of this role
|
||||
*/
|
||||
public void setType(RoleType type) {
|
||||
public void setType(RoleTypeEnum type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ package org.yacos.core.users;
|
||||
*
|
||||
*/
|
||||
public class RoleType {
|
||||
// TODO : see what we do with this class
|
||||
public enum RoleTypeEnum {
|
||||
AUTHOR,CHAIRMAN,PCMEMBER,REFEREE
|
||||
}
|
||||
/**
|
||||
* Author constant role
|
||||
*/
|
||||
|
||||
33
YACOSCore/ejbModule/org/yacos/core/users/UsersManager.java
Normal file
33
YACOSCore/ejbModule/org/yacos/core/users/UsersManager.java
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.yacos.core.users;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
public class UsersManager {
|
||||
public Collection<User> getUsers(){
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a user into the system
|
||||
* @param user
|
||||
*/
|
||||
public void addUser(User user){
|
||||
// TODO
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a user from the system
|
||||
* @param user
|
||||
*/
|
||||
public void removeUser(User user){
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user