Worked on the core business entities
*** WORK IN PROGRESS ***
This commit is contained in:
@@ -2,11 +2,17 @@ package org.yacos.core.article;
|
||||
|
||||
import java.io.Serializable;
|
||||
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.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.ManyToOne;
|
||||
import org.yacos.core.conferences.Conference;
|
||||
import org.yacos.core.users.User;
|
||||
|
||||
@Entity
|
||||
public class Article implements Serializable {
|
||||
@@ -16,6 +22,8 @@ public class Article implements Serializable {
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
private int id;
|
||||
private String title;
|
||||
private String topic;
|
||||
@@ -23,6 +31,35 @@ public class Article implements Serializable {
|
||||
private String mainAuthor;
|
||||
private ArrayList<String> secondaryAuthors;
|
||||
|
||||
/**
|
||||
* The conference this article has been submitted for
|
||||
*/
|
||||
@ManyToOne(targetEntity=Conference.class)
|
||||
@JoinColumn(name="conference_id",nullable=false)
|
||||
private Conference conference;
|
||||
|
||||
/**
|
||||
* The referees reviewing this article
|
||||
*/
|
||||
@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)
|
||||
@JoinTable(
|
||||
name="articles_pcmembers_map",
|
||||
joinColumns=@JoinColumn(name="user_id"),
|
||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||
)
|
||||
private Collection<User> pcMembers;
|
||||
|
||||
private int state;
|
||||
|
||||
public enum state {
|
||||
@@ -102,4 +139,53 @@ public class Article implements Serializable {
|
||||
public void setState(int state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@ManyToMany(targetEntity=User.class)
|
||||
@JoinTable(
|
||||
name="articles_referees_map",
|
||||
joinColumns=@JoinColumn(name="user_id"),
|
||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||
)
|
||||
public Collection<User> getReferees(){
|
||||
return 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;
|
||||
}
|
||||
|
||||
public void assignToPCMember(User pcMember){
|
||||
// TODO : Checking if the User is a pcMember for this conference (not implemented yet)
|
||||
//if(pcMember.hasRoleForConference(RoleType.PCmember, this.conference)){
|
||||
if(! pcMembers.contains(pcMember)){
|
||||
pcMembers.add(pcMember);
|
||||
} else {
|
||||
//throw new DuplicateAssignationException();
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
public void delegateTo(User referee, User pcMember) {
|
||||
if(pcMembers.contains(pcMember)){
|
||||
if(! referees.contains(referee)){
|
||||
referees.add(referee);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ManyToOne(targetEntity=Conference.class)
|
||||
public Conference getConference(){
|
||||
return conference;
|
||||
}
|
||||
|
||||
@ManyToOne(targetEntity=Conference.class)
|
||||
public void setConference(Conference conference){
|
||||
this.conference = conference;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import javax.ejb.Stateless;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
|
||||
import org.yacos.core.users.User;
|
||||
|
||||
@Stateless
|
||||
public class ArticleManagerBean implements IArticleManager, Serializable {
|
||||
|
||||
@@ -26,18 +28,41 @@ public class ArticleManagerBean implements IArticleManager, Serializable {
|
||||
em.persist(a);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Article> getArticles() {
|
||||
return em.createQuery("SELECT a FROM Article a ORDER BY a.title").getResultList();
|
||||
return em.createQuery("from Article a ORDER BY a.title").getResultList();
|
||||
}
|
||||
|
||||
public void updateArticle(Article old, Article newArticle) {
|
||||
removeArticle(old);
|
||||
public void updateArticle(Integer id, Article newArticle) {
|
||||
removeArticle(getArticle(id));
|
||||
newArticle.setId(id);
|
||||
addArticle(newArticle);
|
||||
em.flush();
|
||||
}
|
||||
|
||||
public void removeArticle(Article a) {
|
||||
em.remove(a);
|
||||
em.flush();
|
||||
}
|
||||
|
||||
public Article getArticle(Integer id) {
|
||||
return em.find(Article.class, id);
|
||||
}
|
||||
|
||||
public void assignArticleToPCMember(Article article,User pcMember){
|
||||
article.assignToPCMember(pcMember);
|
||||
em.flush();
|
||||
}
|
||||
|
||||
public List<User> getArticlePCMembers(Article article) {
|
||||
return (List<User>) article.getPCMembers();
|
||||
}
|
||||
|
||||
public void delegateArticleToReferee(Article article, User referee, User pcMember){
|
||||
article.delegateTo(referee,pcMember);
|
||||
}
|
||||
|
||||
public List<User> getArticleReferees(Article article) {
|
||||
return (List<User>) article.getReferees();
|
||||
}
|
||||
}
|
||||
|
||||
83
YACOSCore/ejbModule/org/yacos/core/article/Delegation.java
Normal file
83
YACOSCore/ejbModule/org/yacos/core/article/Delegation.java
Normal file
@@ -0,0 +1,83 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.yacos.core.article;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import org.yacos.core.users.User;
|
||||
|
||||
/**
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
public class Delegation {
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id")
|
||||
private Article article;
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id")
|
||||
private User pcMember;
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="referee_id")
|
||||
private User referee;
|
||||
|
||||
/**
|
||||
* Article being evaluated through this delegation
|
||||
* @return the article
|
||||
*/
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id")
|
||||
public Article getArticle() {
|
||||
return article;
|
||||
}
|
||||
/**
|
||||
* Define the article evaluated through this delegation
|
||||
* @param article the article to set
|
||||
*/
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id")
|
||||
public void setArticle(Article article) {
|
||||
this.article = article;
|
||||
}
|
||||
/**
|
||||
* PCMember that delegated the article to a referee
|
||||
* @return the pcMember
|
||||
*/
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id")
|
||||
public User getPcMember() {
|
||||
return pcMember;
|
||||
}
|
||||
/**
|
||||
* Set PCMember that delegated the article to a referee
|
||||
* @param pcMember the pcMember to set
|
||||
*/
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id")
|
||||
public void setPcMember(User pcMember) {
|
||||
this.pcMember = pcMember;
|
||||
}
|
||||
/**
|
||||
* Get the referee that will evaluate this article
|
||||
* @return the referee
|
||||
*/
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="referee_id")
|
||||
public User getReferee() {
|
||||
return referee;
|
||||
}
|
||||
/**
|
||||
* Get
|
||||
* @param referee the referee to set
|
||||
*/
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="referee_id")
|
||||
public void setReferee(User referee) {
|
||||
this.referee = referee;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,12 +3,15 @@ package org.yacos.core.article;
|
||||
import java.util.List;
|
||||
import javax.ejb.Remote;
|
||||
|
||||
import org.yacos.core.conferences.Conference;
|
||||
|
||||
@Remote
|
||||
public interface IArticleManager {
|
||||
|
||||
public List getArticles();
|
||||
public Article getArticle(Integer id);
|
||||
public void addArticle(Article a);
|
||||
public void removeArticle(Article a);
|
||||
public void updateArticle(Article old, Article newArticle);
|
||||
public void updateArticle(Integer id, Article newArticle);
|
||||
|
||||
public List<?> getArticlePCMembers(Article article);
|
||||
public List<?> getArticleReferees(Article article);
|
||||
}
|
||||
|
||||
56
YACOSCore/ejbModule/org/yacos/core/article/Preference.java
Normal file
56
YACOSCore/ejbModule/org/yacos/core/article/Preference.java
Normal file
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.yacos.core.article;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
import org.yacos.core.users.User;
|
||||
|
||||
/**
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
public class Preference {
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id",nullable=false)
|
||||
private User pcMember;
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id",nullable=false)
|
||||
private Article article;
|
||||
/**
|
||||
* @return the pcMember
|
||||
*/
|
||||
@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)
|
||||
public void setPcMember(User pcMember) {
|
||||
this.pcMember = pcMember;
|
||||
}
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
@@ -1,60 +1,118 @@
|
||||
package org.yacos.core.conferences;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
import org.yacos.core.article.Article;
|
||||
import org.yacos.core.users.User;
|
||||
|
||||
@Entity
|
||||
public class Conference {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
private String id;
|
||||
private String titre;
|
||||
private String descirption;
|
||||
private String infoComplementray;
|
||||
private Date dataAbstract;
|
||||
private String description;
|
||||
private String otherInformations;
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date dateAbstract;
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date dateArticle;
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date dateEvaluation;
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date dateStart;
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date dateEnd;
|
||||
|
||||
@OneToOne(targetEntity=User.class,optional=false)
|
||||
@JoinColumn(name="chairman_id",nullable=false)
|
||||
private User chairman;
|
||||
|
||||
@OneToMany(targetEntity=Article.class,mappedBy="articles")
|
||||
private ArrayList<Article> articles;
|
||||
|
||||
/**
|
||||
* @return the chairman
|
||||
*/
|
||||
@OneToOne(targetEntity=User.class,optional=false)
|
||||
@JoinColumn(name="chairman_id",nullable=false)
|
||||
public User getChairman() {
|
||||
return chairman;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param chairman the chairman to set
|
||||
*/
|
||||
@OneToOne(targetEntity=User.class,optional=false)
|
||||
@JoinColumn(name="chairman_id",nullable=false)
|
||||
public void setChairman(User chairman) {
|
||||
this.chairman = chairman;
|
||||
}
|
||||
|
||||
@Temporal(TemporalType.DATE)
|
||||
public Date getDataAbstract() {
|
||||
return dataAbstract;
|
||||
return dateAbstract;
|
||||
}
|
||||
|
||||
@Temporal(TemporalType.DATE)
|
||||
public void setDataAbstract(Date dataAbstract) {
|
||||
this.dataAbstract = dataAbstract;
|
||||
this.dateAbstract = dataAbstract;
|
||||
}
|
||||
@Temporal(TemporalType.DATE)
|
||||
public Date getDateArticle() {
|
||||
return dateArticle;
|
||||
}
|
||||
@Temporal(TemporalType.DATE)
|
||||
public void setDateArticle(Date dateArticle) {
|
||||
this.dateArticle = dateArticle;
|
||||
}
|
||||
@Temporal(TemporalType.DATE)
|
||||
public Date getDateEnd() {
|
||||
return dateEnd;
|
||||
}
|
||||
@Temporal(TemporalType.DATE)
|
||||
public void setDateEnd(Date dateEnd) {
|
||||
this.dateEnd = dateEnd;
|
||||
}
|
||||
@Temporal(TemporalType.DATE)
|
||||
public Date getDateEvaluation() {
|
||||
return dateEvaluation;
|
||||
}
|
||||
@Temporal(TemporalType.DATE)
|
||||
public void setDateEvaluation(Date dateEvaluation) {
|
||||
this.dateEvaluation = dateEvaluation;
|
||||
}
|
||||
@Temporal(TemporalType.DATE)
|
||||
public Date getDateStart() {
|
||||
return dateStart;
|
||||
}
|
||||
@Temporal(TemporalType.DATE)
|
||||
public void setDateStart(Date dateStart) {
|
||||
this.dateStart = dateStart;
|
||||
}
|
||||
public String getDescirption() {
|
||||
return descirption;
|
||||
return description;
|
||||
}
|
||||
public void setDescirption(String descirption) {
|
||||
this.descirption = descirption;
|
||||
this.description = descirption;
|
||||
}
|
||||
public String getInfoComplementray() {
|
||||
return infoComplementray;
|
||||
return otherInformations;
|
||||
}
|
||||
public void setInfoComplementray(String infoComplementray) {
|
||||
this.infoComplementray = infoComplementray;
|
||||
this.otherInformations = infoComplementray;
|
||||
}
|
||||
public String getTitre() {
|
||||
return titre;
|
||||
@@ -68,17 +126,25 @@ public class Conference {
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Conference() {
|
||||
}
|
||||
|
||||
public Conference(String id, String titre, String descirption, String infoComplementray, Date dataAbstract, Date dateArticle, Date dateEvaluation, Date dateStart, Date dateEnd) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.titre = titre;
|
||||
this.descirption = descirption;
|
||||
this.infoComplementray = infoComplementray;
|
||||
this.dataAbstract = dataAbstract;
|
||||
this.description = descirption;
|
||||
this.otherInformations = infoComplementray;
|
||||
this.dateAbstract = dataAbstract;
|
||||
this.dateArticle = dateArticle;
|
||||
this.dateEvaluation = dateEvaluation;
|
||||
this.dateStart = dateStart;
|
||||
this.dateEnd = dateEnd;
|
||||
}
|
||||
|
||||
@OneToMany(targetEntity=Article.class,mappedBy="articles")
|
||||
public List<Article> getArticles() {
|
||||
return articles;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
package org.yacos.core.conferences;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
import java.util.List;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
|
||||
@Stateless
|
||||
public class ConferenceManager implements IConferenceManager {
|
||||
|
||||
|
||||
@PersistenceContext
|
||||
EntityManager em;
|
||||
|
||||
public void addConference(Conference conf) {
|
||||
em.persist(conf);
|
||||
}
|
||||
|
||||
public List<Conference> getConferences() {
|
||||
return em.createQuery("SELECT conf FROM Conference conf ORDER BY conf.id").getResultList();
|
||||
}
|
||||
|
||||
public Conference getConference(String id) {
|
||||
return em.find(Conference.class, id);
|
||||
}
|
||||
|
||||
public void remove(String id) {
|
||||
Conference conf=this.getConference(id);
|
||||
em.remove(conf);
|
||||
}
|
||||
|
||||
public void update(Conference newC, String id) {
|
||||
//newC doit avoir le meme ID pour remplacer le vieil objet.
|
||||
this.remove(id);
|
||||
this.addConference(newC);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.yacos.core.conferences;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
|
||||
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;
|
||||
|
||||
public void addConference(Conference conf) {
|
||||
em.persist(conf);
|
||||
}
|
||||
|
||||
public List<Conference> getConferences() {
|
||||
return em.createQuery("from Conference conf ORDER BY conf.id").getResultList();
|
||||
}
|
||||
|
||||
public Conference getConference(Integer id) {
|
||||
return em.find(Conference.class, id);
|
||||
}
|
||||
|
||||
public void remove(Integer id) {
|
||||
Conference conf=this.getConference(id);
|
||||
em.remove(conf);
|
||||
}
|
||||
|
||||
public void update(Conference newC, Integer id) {
|
||||
this.remove(id);
|
||||
this.addConference(newC);
|
||||
}
|
||||
|
||||
public List<Article> getArticles(Integer conference_id) {
|
||||
return getConference(conference_id).getArticles();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,11 +3,14 @@ package org.yacos.core.conferences;
|
||||
import java.util.List;
|
||||
import javax.ejb.Remote;
|
||||
|
||||
import org.yacos.core.article.Article;
|
||||
|
||||
@Remote
|
||||
public interface IConferenceManager {
|
||||
public void addConference(Conference conf);
|
||||
public Conference getConference(String id);
|
||||
public Conference getConference(Integer id);
|
||||
public List<Conference> getConferences();
|
||||
public void remove(String id);
|
||||
public void update(Conference newC,String id);
|
||||
public void remove(Integer id);
|
||||
public void update(Conference newC,Integer id);
|
||||
public List<Article> getArticles(Integer id);
|
||||
}
|
||||
|
||||
69
YACOSCore/ejbModule/org/yacos/core/evaluation/Criterion.java
Normal file
69
YACOSCore/ejbModule/org/yacos/core/evaluation/Criterion.java
Normal file
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.yacos.core.evaluation;
|
||||
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
import org.yacos.core.conferences.Conference;
|
||||
|
||||
/**
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
public class Criterion {
|
||||
private String name;
|
||||
private Integer min;
|
||||
private Integer max;
|
||||
|
||||
@ManyToOne(targetEntity=Conference.class)
|
||||
private Conference conference;
|
||||
|
||||
@ManyToOne(targetEntity=Conference.class)
|
||||
public Conference getConference(){
|
||||
return conference;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 {
|
||||
|
||||
}
|
||||
21
YACOSCore/ejbModule/org/yacos/core/evaluation/Rating.java
Normal file
21
YACOSCore/ejbModule/org/yacos/core/evaluation/Rating.java
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.yacos.core.evaluation;
|
||||
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
/**
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
public class Rating {
|
||||
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;
|
||||
}
|
||||
90
YACOSCore/ejbModule/org/yacos/core/evaluation/Report.java
Normal file
90
YACOSCore/ejbModule/org/yacos/core/evaluation/Report.java
Normal file
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.yacos.core.evaluation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
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
|
||||
*
|
||||
*/
|
||||
public class Report {
|
||||
private String commentPCMember;
|
||||
private String commentAuthor;
|
||||
@OneToMany(targetEntity=Rating.class,mappedBy="report")
|
||||
private ArrayList<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 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);
|
||||
}
|
||||
}
|
||||
@@ -88,14 +88,14 @@ public class User {
|
||||
}
|
||||
|
||||
public void addRoleForConference(RoleType roleType, Conference conference){
|
||||
if(! hasRoleForConference(roleType)){
|
||||
if(! hasRoleForConference(roleType,conference)){
|
||||
|
||||
} else {
|
||||
// TODO : declare and throw an exception
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasRoleForConference(RoleType roleType){
|
||||
public boolean hasRoleForConference(RoleType roleType, Conference conference){
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.yacos.tests.core;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.yacos.core.conferences.Conference;
|
||||
import org.yacos.core.conferences.ConferenceManagerBean;
|
||||
import org.yacos.core.conferences.IConferenceManager;
|
||||
|
||||
|
||||
public class TestConferenceManager {
|
||||
IConferenceManager conferenceManager;
|
||||
|
||||
@BeforeClass
|
||||
public void setUpManager() {
|
||||
conferenceManager = new ConferenceManagerBean();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUpConferences() {
|
||||
conferenceManager.getConferences();
|
||||
Conference conf = new Conference();
|
||||
conferenceManager.addConference(conf);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user