Merged CorePersistence Branch
This commit is contained in:
@@ -3,24 +3,27 @@ package org.yacos.core.article;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
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.conferences.Conference;
|
||||||
import org.yacos.core.users.User;
|
import org.yacos.core.users.User;
|
||||||
|
|
||||||
//@Entity
|
@Entity
|
||||||
public class Article implements Serializable {
|
public class Article implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
// @Id
|
@Id
|
||||||
// @GeneratedValue(strategy=GenerationType.AUTO)
|
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||||
private int id;
|
private int id;
|
||||||
private String title;
|
private String title;
|
||||||
private String topic;
|
private String topic;
|
||||||
@@ -31,30 +34,30 @@ public class Article implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* The conference this article has been submitted for
|
* The conference this article has been submitted for
|
||||||
*/
|
*/
|
||||||
//@ManyToOne(targetEntity=Conference.class)
|
@ManyToOne(targetEntity=Conference.class)
|
||||||
//@JoinColumn(name="conference_id",nullable=false)
|
@JoinColumn(name="conference_id",nullable=false)
|
||||||
private Conference conference;
|
private Conference conference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The referees reviewing this article
|
* The referees reviewing this article
|
||||||
*/
|
*/
|
||||||
/*@ManyToMany(targetEntity=User.class)
|
@ManyToMany(targetEntity=User.class)
|
||||||
@JoinTable(
|
@JoinTable(
|
||||||
name="articles_referees_map",
|
name="articles_referees_map",
|
||||||
joinColumns=@JoinColumn(name="user_id"),
|
joinColumns=@JoinColumn(name="user_id"),
|
||||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||||
)*/
|
)
|
||||||
|
|
||||||
private Collection<User> referees;
|
private Collection<User> referees;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The PC Members responsible for this article evaluation
|
* The PC Members responsible for this article evaluation
|
||||||
*/
|
*/
|
||||||
/*@ManyToMany(targetEntity=User.class)
|
@ManyToMany(targetEntity=User.class)
|
||||||
@JoinTable(
|
@JoinTable(
|
||||||
name="articles_pcmembers_map",
|
name="articles_pcmembers_map",
|
||||||
joinColumns=@JoinColumn(name="user_id"),
|
joinColumns=@JoinColumn(name="user_id"),
|
||||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||||
)*/
|
)
|
||||||
private Collection<User> pcMembers;
|
private Collection<User> pcMembers;
|
||||||
|
|
||||||
private int state;
|
private int state;
|
||||||
@@ -65,8 +68,6 @@ public class Article implements Serializable {
|
|||||||
|
|
||||||
public Article() {
|
public Article() {
|
||||||
secondaryAuthors = new ArrayList<String>();
|
secondaryAuthors = new ArrayList<String>();
|
||||||
referees = new ArrayList<User>();
|
|
||||||
pcMembers = new ArrayList<User>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Article(int reference, String title, String topic,
|
public Article(int reference, String title, String topic,
|
||||||
@@ -81,8 +82,8 @@ public class Article implements Serializable {
|
|||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Id
|
@Id
|
||||||
//@GeneratedValue(strategy=GenerationType.AUTO)
|
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -139,26 +140,47 @@ public class Article implements Serializable {
|
|||||||
this.state = state;
|
this.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@ManyToMany(targetEntity=User.class)
|
@ManyToMany(targetEntity=User.class)
|
||||||
@JoinTable(
|
@JoinTable(
|
||||||
name="articles_referees_map",
|
name="articles_referees_map",
|
||||||
joinColumns=@JoinColumn(name="user_id"),
|
joinColumns=@JoinColumn(name="user_id"),
|
||||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||||
)*/
|
)
|
||||||
public Collection<User> getReferees(){
|
public Collection<User> getReferees(){
|
||||||
return this.referees;
|
return referees;
|
||||||
//return em.createQuery("SELECT u FROM User u").getResultList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@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(
|
@JoinTable(
|
||||||
name="articles_pcmembers_map",
|
name="articles_pcmembers_map",
|
||||||
joinColumns=@JoinColumn(name="user_id"),
|
joinColumns=@JoinColumn(name="user_id"),
|
||||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||||
)*/
|
)
|
||||||
public Collection<User> getPCMembers(){
|
public Collection<User> getPCMembers(){
|
||||||
return pcMembers;
|
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){
|
public void assignToPCMember(User pcMember){
|
||||||
// TODO : Checking if the User is a pcMember for this conference (not implemented yet)
|
// 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(){
|
public Conference getConference(){
|
||||||
return conference;
|
return conference;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@ManyToOne(targetEntity=Conference.class)
|
@ManyToOne(targetEntity=Conference.class)
|
||||||
public void setConference(Conference conference){
|
public void setConference(Conference conference){
|
||||||
this.conference = conference;
|
this.conference = conference;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package org.yacos.core.article;
|
package org.yacos.core.article;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
@@ -22,49 +20,38 @@ public class ArticleManagerBean implements IArticleManager, Serializable {
|
|||||||
@PersistenceContext
|
@PersistenceContext
|
||||||
EntityManager em;
|
EntityManager em;
|
||||||
|
|
||||||
List<Article> articles;
|
|
||||||
|
|
||||||
public ArticleManagerBean() {
|
public ArticleManagerBean() {
|
||||||
articles = new ArrayList<Article>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addArticle(Article a) {
|
public void addArticle(Article a) {
|
||||||
//em.persist(a);
|
em.persist(a);
|
||||||
articles.add(a);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public List<Article> getArticles() {
|
public List<Article> getArticles() {
|
||||||
//return em.createQuery("from Article a ORDER BY a.title").getResultList();
|
return em.createQuery("from Article a ORDER BY a.title").getResultList();
|
||||||
return articles;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateArticle(Integer id, Article newArticle) {
|
public void updateArticle(Integer id, Article newArticle) {
|
||||||
removeArticle(getArticle(id));
|
removeArticle(getArticle(id));
|
||||||
newArticle.setId(id);
|
newArticle.setId(id);
|
||||||
addArticle(newArticle);
|
addArticle(newArticle);
|
||||||
//em.flush();
|
em.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeArticle(Article a) {
|
public void removeArticle(Article a) {
|
||||||
//em.remove(a);
|
em.remove(a);
|
||||||
//em.flush();
|
em.flush();
|
||||||
articles.remove(a);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Article getArticle(Integer id) {
|
public Article getArticle(Integer id) {
|
||||||
//return em.find(Article.class, id);
|
return em.find(Article.class, id);
|
||||||
for (Article a : articles) {
|
|
||||||
if(a.getId()== id){
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assignArticleToPCMember(Article article,User pcMember){
|
public void assignArticleToPCMember(Article article,User pcMember){
|
||||||
article.assignToPCMember(pcMember);
|
article.assignToPCMember(pcMember);
|
||||||
//em.flush();
|
em.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<User> getArticlePCMembers(Article article) {
|
public List<User> getArticlePCMembers(Article article) {
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.yacos.core.article;
|
package org.yacos.core.article;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
@@ -15,26 +15,43 @@ import org.yacos.core.users.User;
|
|||||||
* @author christiancorsano
|
* @author christiancorsano
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
//@Entity
|
@Entity
|
||||||
public class Delegation implements Serializable {
|
public class Delegation {
|
||||||
//@ManyToOne(targetEntity=Article.class)
|
/**
|
||||||
//@JoinColumn(name="article_id")
|
* Id mandatory in every entity.
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
@ManyToOne(targetEntity=Article.class)
|
||||||
|
@JoinColumn(name="article_id")
|
||||||
private Article article;
|
private Article article;
|
||||||
//@ManyToOne(targetEntity=User.class)
|
@ManyToOne(targetEntity=User.class)
|
||||||
//@JoinColumn(name="pcmember_id")
|
@JoinColumn(name="pcmember_id")
|
||||||
private User pcMember;
|
private User pcMember;
|
||||||
//@ManyToOne(targetEntity=User.class)
|
@ManyToOne(targetEntity=User.class)
|
||||||
//@JoinColumn(name="referee_id")
|
@JoinColumn(name="referee_id")
|
||||||
private User referee;
|
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
|
* Article being evaluated through this delegation
|
||||||
* @return the article
|
* @return the article
|
||||||
*/
|
*/
|
||||||
//@ManyToOne(targetEntity=Article.class)
|
@ManyToOne(targetEntity=Article.class)
|
||||||
//@JoinColumn(name="article_id")
|
@JoinColumn(name="article_id")
|
||||||
public Article getArticle() {
|
public Article getArticle() {
|
||||||
return article;
|
return article;
|
||||||
}
|
}
|
||||||
@@ -42,8 +59,8 @@ public class Delegation implements Serializable {
|
|||||||
* Define the article evaluated through this delegation
|
* Define the article evaluated through this delegation
|
||||||
* @param article the article to set
|
* @param article the article to set
|
||||||
*/
|
*/
|
||||||
//@ManyToOne(targetEntity=Article.class)
|
@ManyToOne(targetEntity=Article.class)
|
||||||
//@JoinColumn(name="article_id")
|
@JoinColumn(name="article_id")
|
||||||
public void setArticle(Article article) {
|
public void setArticle(Article article) {
|
||||||
this.article = article;
|
this.article = article;
|
||||||
}
|
}
|
||||||
@@ -51,8 +68,8 @@ public class Delegation implements Serializable {
|
|||||||
* PCMember that delegated the article to a referee
|
* PCMember that delegated the article to a referee
|
||||||
* @return the pcMember
|
* @return the pcMember
|
||||||
*/
|
*/
|
||||||
//@ManyToOne(targetEntity=User.class)
|
@ManyToOne(targetEntity=User.class)
|
||||||
//@JoinColumn(name="pcmember_id")
|
@JoinColumn(name="pcmember_id")
|
||||||
public User getPcMember() {
|
public User getPcMember() {
|
||||||
return pcMember;
|
return pcMember;
|
||||||
}
|
}
|
||||||
@@ -60,8 +77,8 @@ public class Delegation implements Serializable {
|
|||||||
* Set PCMember that delegated the article to a referee
|
* Set PCMember that delegated the article to a referee
|
||||||
* @param pcMember the pcMember to set
|
* @param pcMember the pcMember to set
|
||||||
*/
|
*/
|
||||||
//@ManyToOne(targetEntity=User.class)
|
@ManyToOne(targetEntity=User.class)
|
||||||
//@JoinColumn(name="pcmember_id")
|
@JoinColumn(name="pcmember_id")
|
||||||
public void setPcMember(User pcMember) {
|
public void setPcMember(User pcMember) {
|
||||||
this.pcMember = pcMember;
|
this.pcMember = pcMember;
|
||||||
}
|
}
|
||||||
@@ -69,8 +86,8 @@ public class Delegation implements Serializable {
|
|||||||
* Get the referee that will evaluate this article
|
* Get the referee that will evaluate this article
|
||||||
* @return the referee
|
* @return the referee
|
||||||
*/
|
*/
|
||||||
//@ManyToOne(targetEntity=User.class)
|
@ManyToOne(targetEntity=User.class)
|
||||||
//@JoinColumn(name="referee_id")
|
@JoinColumn(name="referee_id")
|
||||||
public User getReferee() {
|
public User getReferee() {
|
||||||
return referee;
|
return referee;
|
||||||
}
|
}
|
||||||
@@ -78,12 +95,11 @@ public class Delegation implements Serializable {
|
|||||||
* Get
|
* Get
|
||||||
* @param referee the referee to set
|
* @param referee the referee to set
|
||||||
*/
|
*/
|
||||||
//@ManyToOne(targetEntity=User.class)
|
@ManyToOne(targetEntity=User.class)
|
||||||
//@JoinColumn(name="referee_id")
|
@JoinColumn(name="referee_id")
|
||||||
public void setReferee(User referee) {
|
public void setReferee(User referee) {
|
||||||
this.referee = referee;
|
this.referee = referee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package org.yacos.core.article;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.ejb.Remote;
|
import javax.ejb.Remote;
|
||||||
|
|
||||||
import org.yacos.core.conferences.Conference;
|
|
||||||
|
|
||||||
@Remote
|
@Remote
|
||||||
public interface IArticleManager {
|
public interface IArticleManager {
|
||||||
public Article getArticle(Integer id);
|
public Article getArticle(Integer id);
|
||||||
|
|||||||
@@ -4,7 +4,11 @@
|
|||||||
package org.yacos.core.article;
|
package org.yacos.core.article;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
|
||||||
import org.yacos.core.users.User;
|
import org.yacos.core.users.User;
|
||||||
|
|
||||||
@@ -12,54 +16,67 @@ import org.yacos.core.users.User;
|
|||||||
* @author christiancorsano
|
* @author christiancorsano
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
//@Entity
|
@Entity
|
||||||
public class Preference {
|
public class Preference {
|
||||||
//@ManyToOne(targetEntity=User.class)
|
/**
|
||||||
//@JoinColumn(name="pcmember_id",nullable=false)
|
* Id mandatory in every entity.
|
||||||
|
*/
|
||||||
//@Id
|
@Id
|
||||||
private int id;
|
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
@ManyToOne(targetEntity=User.class)
|
||||||
|
@JoinColumn(name="pcmember_id",nullable=false)
|
||||||
private User pcMember;
|
private User pcMember;
|
||||||
//@ManyToOne(targetEntity=Article.class)
|
@ManyToOne(targetEntity=Article.class)
|
||||||
//@JoinColumn(name="article_id",nullable=false)
|
@JoinColumn(name="article_id",nullable=false)
|
||||||
private Article article;
|
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
|
* @return the pcMember
|
||||||
*/
|
*/
|
||||||
//@ManyToOne(targetEntity=User.class)
|
@ManyToOne(targetEntity=User.class)
|
||||||
//@JoinColumn(name="pcmember_id",nullable=false)
|
@JoinColumn(name="pcmember_id",nullable=false)
|
||||||
public User getPcMember() {
|
public User getPcMember() {
|
||||||
return pcMember;
|
return pcMember;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param pcMember the pcMember to set
|
* @param pcMember the pcMember to set
|
||||||
*/
|
*/
|
||||||
//@ManyToOne(targetEntity=User.class)
|
@ManyToOne(targetEntity=User.class)
|
||||||
//@JoinColumn(name="pcmember_id",nullable=false)
|
@JoinColumn(name="pcmember_id",nullable=false)
|
||||||
public void setPcMember(User pcMember) {
|
public void setPcMember(User pcMember) {
|
||||||
this.pcMember = pcMember;
|
this.pcMember = pcMember;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return the article
|
* @return the article
|
||||||
*/
|
*/
|
||||||
//@ManyToOne(targetEntity=Article.class)
|
@ManyToOne(targetEntity=Article.class)
|
||||||
//@JoinColumn(name="article_id",nullable=false)
|
@JoinColumn(name="article_id",nullable=false)
|
||||||
public Article getArticle() {
|
public Article getArticle() {
|
||||||
return article;
|
return article;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param article the article to set
|
* @param article the article to set
|
||||||
*/
|
*/
|
||||||
//@ManyToOne(targetEntity=Article.class)
|
@ManyToOne(targetEntity=Article.class)
|
||||||
//@JoinColumn(name="article_id",nullable=false)
|
@JoinColumn(name="article_id",nullable=false)
|
||||||
public void setArticle(Article article) {
|
public void setArticle(Article article) {
|
||||||
this.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;
|
package org.yacos.core.conferences;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
|
|
||||||
import org.yacos.core.article.Article;
|
import org.yacos.core.article.Article;
|
||||||
|
import org.yacos.core.article.ArticleManagerBean;
|
||||||
|
|
||||||
@Stateless
|
@Stateless
|
||||||
public class ConferenceManagerBean implements IConferenceManager {
|
public class ConferenceManagerBean implements IConferenceManager {
|
||||||
@PersistenceContext
|
@PersistenceContext
|
||||||
EntityManager em;
|
EntityManager em;
|
||||||
|
|
||||||
private List<Conference> conferences;
|
|
||||||
|
|
||||||
public void addConference(Conference conf) {
|
public void addConference(Conference conf) {
|
||||||
//em.persist(conf);
|
em.persist(conf);
|
||||||
conferences.add(conf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Conference> getConferences() {
|
public List<Conference> getConferences() {
|
||||||
//return em.createQuery("from Conference conf ORDER BY conf.id").getResultList();
|
return em.createQuery("from Conference conf ORDER BY conf.id").getResultList();
|
||||||
return conferences;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Conference getConference(Integer id) {
|
public Conference getConference(Integer id) {
|
||||||
//return em.find(Conference.class, id);
|
return em.find(Conference.class, id);
|
||||||
for (Conference c : conferences) {
|
|
||||||
if(c.getId()== id){
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(Integer id) {
|
public void remove(Integer id) {
|
||||||
Conference conf=this.getConference(id);
|
Conference conf=this.getConference(id);
|
||||||
//em.remove(conf);
|
em.remove(conf);
|
||||||
conferences.remove(conf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(Conference newC, Integer id) {
|
public void update(Conference newC, Integer id) {
|
||||||
@@ -48,7 +39,7 @@ public class ConferenceManagerBean implements IConferenceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<Article> getArticles(Integer conference_id) {
|
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;
|
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.conferences.Conference;
|
||||||
|
import org.yacos.core.users.RoleType.RoleTypeEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An role of a given type (author,chairman,PCmember or referee)
|
* An role of a given type (author,chairman,PCmember or referee)
|
||||||
@@ -8,26 +20,47 @@ import org.yacos.core.conferences.Conference;
|
|||||||
* @author christiancorsano
|
* @author christiancorsano
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Entity
|
||||||
public class Role {
|
public class Role {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||||
|
private Integer id;
|
||||||
/**
|
/**
|
||||||
* User for which this role is defined
|
* User for which this role is defined
|
||||||
*/
|
*/
|
||||||
|
@ManyToOne(targetEntity=User.class,optional=false)
|
||||||
|
@JoinColumn(name="user_id",nullable=false)
|
||||||
private User user;
|
private User user;
|
||||||
/**
|
/**
|
||||||
* Conference for which this role is defined
|
* Conference for which this role is defined
|
||||||
*/
|
*/
|
||||||
|
@ManyToOne(targetEntity=Conference.class,optional=false)
|
||||||
|
@JoinColumn(name="conference_id",nullable=false)
|
||||||
private Conference conference;
|
private Conference conference;
|
||||||
/**
|
/**
|
||||||
* The type of this role
|
* 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();
|
super();
|
||||||
setType(type);
|
setType(type);
|
||||||
setUser(user);
|
setUser(user);
|
||||||
setConference(conference);
|
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
|
* @return the user who plays this role
|
||||||
*/
|
*/
|
||||||
@@ -55,13 +88,13 @@ public class Role {
|
|||||||
/**
|
/**
|
||||||
* @return the type of this role
|
* @return the type of this role
|
||||||
*/
|
*/
|
||||||
public RoleType getType() {
|
public RoleTypeEnum getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param type the type of this role
|
* @param type the type of this role
|
||||||
*/
|
*/
|
||||||
public void setType(RoleType type) {
|
public void setType(RoleTypeEnum type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ package org.yacos.core.users;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RoleType {
|
public class RoleType {
|
||||||
|
// TODO : see what we do with this class
|
||||||
|
public enum RoleTypeEnum {
|
||||||
|
AUTHOR,CHAIRMAN,PCMEMBER,REFEREE
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Author constant role
|
* 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