Policy failures:
Code warning - failed on resource Report.java. Reason: The import javax.persistence.CascadeType is never used, line 9 - failed on resource Report.java. Reason: The import javax.persistence.FetchType is never used, line 11 - failed on resource UserManagerBean.java. Reason: The import org.yacos.core.article.Article is never used, line 15 - failed on resource Article.java. Reason: The import org.yacos.core.users.Role is never used, line 2 Override reason: u
This commit is contained in:
@@ -2,7 +2,6 @@ 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.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
@@ -20,6 +19,7 @@ import javax.persistence.OneToMany;
|
|||||||
|
|
||||||
import org.yacos.core.conferences.Conference;
|
import org.yacos.core.conferences.Conference;
|
||||||
import org.yacos.core.evaluation.Report;
|
import org.yacos.core.evaluation.Report;
|
||||||
|
import org.yacos.core.users.Role;
|
||||||
import org.yacos.core.users.User;
|
import org.yacos.core.users.User;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@@ -37,8 +37,8 @@ public class Article implements Serializable {
|
|||||||
private String topic;
|
private String topic;
|
||||||
private String URL_article;
|
private String URL_article;
|
||||||
|
|
||||||
//@ManyToOne(targetEntity=Conference.class)
|
@ManyToOne(targetEntity=Conference.class)
|
||||||
//@JoinColumn(name="mainAuthor",nullable=false)
|
@JoinColumn(name="mainAuthor",nullable=false)
|
||||||
private User mainAuthor;
|
private User mainAuthor;
|
||||||
|
|
||||||
private ArrayList<String> secondaryAuthors;
|
private ArrayList<String> secondaryAuthors;
|
||||||
@@ -50,16 +50,8 @@ public class Article implements Serializable {
|
|||||||
@JoinColumn(name="conference_id",nullable=false)
|
@JoinColumn(name="conference_id",nullable=false)
|
||||||
private Conference conference;
|
private Conference conference;
|
||||||
|
|
||||||
/**
|
@OneToMany(cascade=CascadeType.ALL, targetEntity=Delegation.class, mappedBy="article")
|
||||||
* The referees reviewing this article
|
private List<Delegation> delegation;
|
||||||
*/
|
|
||||||
@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
|
* The PC Members responsible for this article evaluation
|
||||||
@@ -70,13 +62,13 @@ public class Article implements Serializable {
|
|||||||
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 List<User> pcMembers;
|
||||||
|
|
||||||
@OneToMany(targetEntity=Preference.class,mappedBy="article")
|
@OneToMany(targetEntity=Preference.class,mappedBy="article", cascade=CascadeType.ALL)
|
||||||
private Collection<Preference> preferences;
|
private List<Preference> preferences;
|
||||||
|
|
||||||
@OneToMany(targetEntity=Report.class, mappedBy="article", cascade=CascadeType.ALL)
|
@OneToMany(targetEntity=Report.class, mappedBy="article", cascade=CascadeType.ALL)
|
||||||
private Collection<Report> report;
|
private List<Report> report;
|
||||||
|
|
||||||
|
|
||||||
public enum State {
|
public enum State {
|
||||||
@@ -105,7 +97,6 @@ public class Article implements Serializable {
|
|||||||
this.secondaryAuthors = new ArrayList<String>();
|
this.secondaryAuthors = new ArrayList<String>();
|
||||||
}
|
}
|
||||||
this.state = state;
|
this.state = state;
|
||||||
referees = new ArrayList<User>();
|
|
||||||
pcMembers = new ArrayList<User>();
|
pcMembers = new ArrayList<User>();
|
||||||
this.conference = conference;
|
this.conference = conference;
|
||||||
}
|
}
|
||||||
@@ -160,7 +151,7 @@ public class Article implements Serializable {
|
|||||||
return secondaryAuthors;
|
return secondaryAuthors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSecondaryAuthors(List<String> secondaryAuthors) {
|
public void setSecondaryAuthors(ArrayList<String> secondaryAuthors) {
|
||||||
this.secondaryAuthors = new ArrayList<String>(secondaryAuthors);
|
this.secondaryAuthors = new ArrayList<String>(secondaryAuthors);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,37 +164,14 @@ public class Article implements Serializable {
|
|||||||
public void setState(State state) {
|
public void setState(State state) {
|
||||||
this.state=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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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)
|
@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 List<User> getPcMembers() {
|
||||||
return pcMembers;
|
return pcMembers;
|
||||||
}
|
}
|
||||||
@ManyToMany(targetEntity=User.class)
|
@ManyToMany(targetEntity=User.class)
|
||||||
@@ -212,10 +180,9 @@ public class Article implements Serializable {
|
|||||||
joinColumns=@JoinColumn(name="user_id"),
|
joinColumns=@JoinColumn(name="user_id"),
|
||||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||||
)
|
)
|
||||||
public void setPCMembers(Collection<User> pcMembers){
|
public void setPcMembers(List<User> pcMembers) {
|
||||||
this.pcMembers = pcMembers;
|
this.pcMembers = pcMembers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPCMember(User pcMember){
|
public void addPCMember(User pcMember){
|
||||||
if(! pcMembers.contains(pcMember)){
|
if(! pcMembers.contains(pcMember)){
|
||||||
pcMembers.add(pcMember);
|
pcMembers.add(pcMember);
|
||||||
@@ -229,11 +196,11 @@ public class Article implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void delegateTo(User referee, User pcMember) {
|
public void delegateTo(User referee, User pcMember) {
|
||||||
if(pcMembers.contains(pcMember)){
|
/* if(pcMembers.contains(pcMember)){
|
||||||
if(! referees.contains(referee)){
|
if(! referees.contains(referee)){
|
||||||
referees.add(referee);
|
referees.add(referee);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
@ManyToOne(targetEntity=Conference.class)
|
@ManyToOne(targetEntity=Conference.class)
|
||||||
@JoinColumn(name="conference_id",nullable=false)
|
@JoinColumn(name="conference_id",nullable=false)
|
||||||
@@ -249,16 +216,16 @@ public class Article implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* @return the preferences
|
* @return the preferences
|
||||||
*/
|
*/
|
||||||
@OneToMany(targetEntity=Preference.class,mappedBy="article")
|
@OneToMany(targetEntity=Preference.class,mappedBy="article", cascade=CascadeType.ALL)
|
||||||
public Collection<Preference> getPreferences() {
|
public List<Preference> getPreferences() {
|
||||||
return preferences;
|
return preferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param preferences the preferences to set
|
* @param preferences the preferences to set
|
||||||
*/
|
*/
|
||||||
@OneToMany(targetEntity=Preference.class,mappedBy="article")
|
@OneToMany(targetEntity=Preference.class,mappedBy="article", cascade=CascadeType.ALL)
|
||||||
public void setPreferences(Collection<Preference> preferences) {
|
public void setPreferences(List<Preference> preferences) {
|
||||||
this.preferences = preferences;
|
this.preferences = preferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,12 +233,24 @@ public class Article implements Serializable {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OneToMany(targetEntity=Report.class, mappedBy="article")
|
@OneToMany(targetEntity=Report.class, mappedBy="article", cascade=CascadeType.ALL)
|
||||||
public Collection<Report> getReport() {
|
public List<Report> getReport() {
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
@OneToMany(targetEntity=Report.class, mappedBy="article")
|
@OneToMany(targetEntity=Report.class, mappedBy="article", cascade=CascadeType.ALL)
|
||||||
public void setReport(Collection<Report> report) {
|
public void setReport(List<Report> report) {
|
||||||
this.report = report;
|
this.report = report;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OneToMany(cascade=CascadeType.ALL, targetEntity=Delegation.class, mappedBy="article")
|
||||||
|
public List<Delegation> getDelegation() {
|
||||||
|
return delegation;
|
||||||
|
}
|
||||||
|
|
||||||
|
@OneToMany(cascade=CascadeType.ALL, targetEntity=Delegation.class, mappedBy="article")
|
||||||
|
public void setDelegation(List<Delegation> delegation) {
|
||||||
|
this.delegation = delegation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
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.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
@@ -34,7 +35,7 @@ public class ArticleManagerBean implements IArticleManager, Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Article addArticle(String title, String topic,String url_article,
|
public Article addArticle(String title, String topic,String url_article,
|
||||||
String mainAuthorLogin, List<String> secondaryAuthors, State state,Integer conferenceId) {
|
String mainAuthorLogin, ArrayList<String> secondaryAuthors, State state,Integer conferenceId) {
|
||||||
Article a = new Article();
|
Article a = new Article();
|
||||||
a.setTitle(title);
|
a.setTitle(title);
|
||||||
a.setTopic(topic);
|
a.setTopic(topic);
|
||||||
@@ -110,7 +111,7 @@ public class ArticleManagerBean implements IArticleManager, Serializable {
|
|||||||
|
|
||||||
public List<User> getArticlePCMembers(Integer articleId) {
|
public List<User> getArticlePCMembers(Integer articleId) {
|
||||||
Article article = this.getArticle(articleId);
|
Article article = this.getArticle(articleId);
|
||||||
List<User> users = (List<User>)article.getPCMembers();
|
List<User> users = (List<User>)article.getPcMembers();
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.yacos.core.article;
|
package org.yacos.core.article;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ejb.Remote;
|
import javax.ejb.Remote;
|
||||||
@@ -7,7 +8,6 @@ import javax.ejb.Remote;
|
|||||||
import org.yacos.core.article.Article.State;
|
import org.yacos.core.article.Article.State;
|
||||||
import org.yacos.core.article.Preference.PreferenceType;
|
import org.yacos.core.article.Preference.PreferenceType;
|
||||||
import org.yacos.core.exceptions.ConferenceDoesntExistException;
|
import org.yacos.core.exceptions.ConferenceDoesntExistException;
|
||||||
import org.yacos.core.users.User;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ import org.yacos.core.users.User;
|
|||||||
public interface IArticleManager {
|
public interface IArticleManager {
|
||||||
public Article getArticle(Integer id);
|
public Article getArticle(Integer id);
|
||||||
public Article addArticle(String title, String topic,String url_article,
|
public Article addArticle(String title, String topic,String url_article,
|
||||||
String mainauthor, List<String> secondaryAuthor, State state,Integer integer);
|
String mainauthor, ArrayList<String> secondaryAuthor, State state,Integer integer);
|
||||||
public void removeArticle(Integer articleId);
|
public void removeArticle(Integer articleId);
|
||||||
public void updateArticle(Article article);
|
public void updateArticle(Article article);
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ public class Preference implements Serializable {
|
|||||||
LIKE,INDIFFERENT,DISLIKE,CONFLICT
|
LIKE,INDIFFERENT,DISLIKE,CONFLICT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Preference(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private PreferenceType preferenceType;
|
private PreferenceType preferenceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,7 +79,7 @@ public class Preference implements Serializable {
|
|||||||
public void setArticle(Article article) {
|
public void setArticle(Article article) {
|
||||||
this.article = article;
|
this.article = article;
|
||||||
}
|
}
|
||||||
public PreferenceType getPreference() {
|
public PreferenceType getPreferenceType() {
|
||||||
return preferenceType;
|
return preferenceType;
|
||||||
}
|
}
|
||||||
public void setPreferenceType(PreferenceType preferenceType) {
|
public void setPreferenceType(PreferenceType preferenceType) {
|
||||||
|
|||||||
@@ -80,8 +80,6 @@ public class Criterion implements Serializable {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the name of this criterion
|
* @return the name of this criterion
|
||||||
*/
|
*/
|
||||||
@@ -96,32 +94,19 @@ public class Criterion implements Serializable {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the minimum value for this criterion
|
public Integer getMin_rating() {
|
||||||
*/
|
|
||||||
public Integer getMin() {
|
|
||||||
return min_rating;
|
return min_rating;
|
||||||
}
|
}
|
||||||
|
public void setMin_rating(Integer min_rating) {
|
||||||
/**
|
this.min_rating = min_rating;
|
||||||
* @param min the minimum value for this criterion
|
|
||||||
*/
|
|
||||||
public void setMin(Integer min) {
|
|
||||||
this.min_rating = min;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Integer getMax_rating() {
|
||||||
* @return the maximum value for this criterion
|
|
||||||
*/
|
|
||||||
public Integer getMax() {
|
|
||||||
return max_rating;
|
return max_rating;
|
||||||
}
|
}
|
||||||
|
public void setMax_rating(Integer max_rating) {
|
||||||
/**
|
this.max_rating = max_rating;
|
||||||
* @param max the maximum value for this criterion
|
|
||||||
*/
|
|
||||||
public void setMax(Integer max) {
|
|
||||||
this.max_rating = max;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ public class EvaluationManagerBean implements IEvaluationManager {
|
|||||||
cm = getConferenceManager();
|
cm = getConferenceManager();
|
||||||
Criterion crit = new Criterion();
|
Criterion crit = new Criterion();
|
||||||
crit.setName(name);
|
crit.setName(name);
|
||||||
crit.setMin(min_rating);
|
crit.setMin_rating(min_rating);
|
||||||
crit.setMax(max_rating);
|
crit.setMax_rating(max_rating);
|
||||||
crit.setConference(cm.getConference(confId));
|
crit.setConference(cm.getConference(confId));
|
||||||
em.persist(crit);
|
em.persist(crit);
|
||||||
em.flush();
|
em.flush();
|
||||||
@@ -165,4 +165,33 @@ public class EvaluationManagerBean implements IEvaluationManager {
|
|||||||
return q.getResultList();
|
return q.getResultList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* rating methods
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Rating addRating(Integer value, Criterion criterion, Report report) {
|
||||||
|
Rating rating = new Rating(value,criterion,report);
|
||||||
|
em.persist(rating);
|
||||||
|
em.flush();
|
||||||
|
return rating;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public List<Rating> getRatingForReport(Integer reportId){
|
||||||
|
Query q = em.createQuery("select r.ratings from Report r where r.id=?");
|
||||||
|
q.setParameter(1, reportId);
|
||||||
|
return q.getResultList();
|
||||||
|
}
|
||||||
|
public void removeRating(Criterion criterion, Report report) {
|
||||||
|
Rating rating = em.find(Rating.class, new RatingPK(criterion,report));
|
||||||
|
em.remove(rating);
|
||||||
|
em.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rating updateRating(Rating rating) {
|
||||||
|
em.merge(rating);
|
||||||
|
em.flush();
|
||||||
|
return rating;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,4 +30,9 @@ public interface IEvaluationManager {
|
|||||||
public Report getReportforArticleAndReferee(int articleId, String refereeLogin);
|
public Report getReportforArticleAndReferee(int articleId, String refereeLogin);
|
||||||
public List<Report> getReportsForArticle(int articleId);
|
public List<Report> getReportsForArticle(int articleId);
|
||||||
public List<Report> getReportsForReferee(String refereeLogin);
|
public List<Report> getReportsForReferee(String refereeLogin);
|
||||||
|
|
||||||
|
public Rating addRating(Integer value,Criterion criterion,Report report);
|
||||||
|
public void removeRating(Criterion criterion,Report report);
|
||||||
|
public Rating updateRating(Rating rating);
|
||||||
|
public List<Rating> getRatingForReport(Integer reportId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,49 +6,49 @@ package org.yacos.core.evaluation;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.IdClass;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author christiancorsano
|
* @author christiancorsano
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
|
@IdClass(RatingPK.class)
|
||||||
public class Rating implements Serializable
|
public class Rating implements Serializable
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
@ManyToOne(targetEntity=Criterion.class)//,fetch=FetchType.EAGER)
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
private Integer value;
|
|
||||||
@ManyToOne(targetEntity=Criterion.class,fetch=FetchType.EAGER)
|
|
||||||
@JoinColumn(name="criterion_id",nullable=false)
|
@JoinColumn(name="criterion_id",nullable=false)
|
||||||
private Criterion criterion;
|
private Criterion criterion;
|
||||||
|
|
||||||
|
@Id
|
||||||
@ManyToOne(targetEntity=Report.class)
|
@ManyToOne(targetEntity=Report.class)
|
||||||
@JoinColumn(name="report_id",nullable=false)
|
@JoinColumn(name="report_id",nullable=false)
|
||||||
private Report report;
|
private Report report;
|
||||||
|
|
||||||
/**
|
private Integer value;
|
||||||
* @return the id
|
|
||||||
*/
|
public Rating(){
|
||||||
public Integer getId() {
|
super();
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param id the id to set
|
|
||||||
*/
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Rating(Integer value, Criterion criterion, Report report) {
|
||||||
|
super();
|
||||||
|
this.value = value;
|
||||||
|
this.criterion = criterion;
|
||||||
|
this.report = report;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the value
|
* @return the value
|
||||||
*/
|
*/
|
||||||
@@ -93,6 +93,8 @@ public class Rating implements Serializable
|
|||||||
public void setReport(Report report) {
|
public void setReport(Report report) {
|
||||||
this.report = report;
|
this.report = report;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
45
YACOSCore/ejbModule/org/yacos/core/evaluation/RatingPK.java
Normal file
45
YACOSCore/ejbModule/org/yacos/core/evaluation/RatingPK.java
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
package org.yacos.core.evaluation;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
|
||||||
|
public class RatingPK implements Serializable{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
@ManyToOne(targetEntity=Criterion.class)//,fetch=FetchType.EAGER)
|
||||||
|
@JoinColumn(name="criterion_id",nullable=false)
|
||||||
|
private Criterion criterion;
|
||||||
|
|
||||||
|
@ManyToOne(targetEntity=Report.class)
|
||||||
|
@JoinColumn(name="report_id",nullable=false)
|
||||||
|
private Report report;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (! (obj instanceof RatingPK) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
RatingPK other = (RatingPK) obj;
|
||||||
|
return this.criterion.getId().equals(other.criterion.getId()) &&
|
||||||
|
this.report.getId() == other.report.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return this.criterion.getId().hashCode() ^ this.report.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public RatingPK(){
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public RatingPK(Criterion criterion, Report report) {
|
||||||
|
super();
|
||||||
|
this.criterion = criterion;
|
||||||
|
this.report = report;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,9 +4,9 @@
|
|||||||
package org.yacos.core.evaluation;
|
package org.yacos.core.evaluation;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
@@ -38,8 +38,8 @@ public class Report implements Serializable
|
|||||||
private String commentPCMember;
|
private String commentPCMember;
|
||||||
private String commentAuthor;
|
private String commentAuthor;
|
||||||
|
|
||||||
@OneToMany(targetEntity=Rating.class,mappedBy="report",fetch=FetchType.EAGER)
|
@OneToMany(targetEntity=Rating.class,mappedBy="report")//, cascade=CascadeType.ALL, fetch=FetchType.EAGER)
|
||||||
private Collection<Rating> ratings;
|
private List<Rating> ratings;
|
||||||
|
|
||||||
@ManyToOne(targetEntity=User.class)
|
@ManyToOne(targetEntity=User.class)
|
||||||
@JoinColumn(name="referee_id",nullable=false)
|
@JoinColumn(name="referee_id",nullable=false)
|
||||||
@@ -58,7 +58,7 @@ public class Report implements Serializable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Report(String commentPCMember, String commentAuthor,
|
public Report(String commentPCMember, String commentAuthor,
|
||||||
Collection<Rating> ratings, User referee, Article article) {
|
List<Rating> ratings, User referee, Article article) {
|
||||||
super();
|
super();
|
||||||
this.commentPCMember = commentPCMember;
|
this.commentPCMember = commentPCMember;
|
||||||
this.commentAuthor = commentAuthor;
|
this.commentAuthor = commentAuthor;
|
||||||
@@ -140,15 +140,12 @@ public class Report implements Serializable
|
|||||||
this.article = article;
|
this.article = article;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRating(Rating rating){
|
|
||||||
ratings.add(rating);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the ratings
|
* @return the ratings
|
||||||
*/
|
*/
|
||||||
@OneToMany(targetEntity=Rating.class,mappedBy="report")
|
@OneToMany(targetEntity=Rating.class,mappedBy="report")
|
||||||
public Collection<Rating> getRatings() {
|
public List<Rating> getRatings() {
|
||||||
return ratings;
|
return ratings;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -158,4 +155,6 @@ public class Report implements Serializable
|
|||||||
public void setRatings(List<Rating> ratings) {
|
public void setRatings(List<Rating> ratings) {
|
||||||
this.ratings = ratings;
|
this.ratings = ratings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,13 +28,8 @@ public class Role implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
|
||||||
* Dummy field to make the composite PK work despite the ManyToOne relationship
|
|
||||||
*/
|
|
||||||
/*@Id
|
|
||||||
@Column(name="user_id",insertable=false,updatable=false)
|
|
||||||
private String user_id;
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* User for which this role is defined
|
* User for which this role is defined
|
||||||
* Primary Key
|
* Primary Key
|
||||||
@@ -44,13 +39,7 @@ public class Role implements Serializable {
|
|||||||
@ManyToOne(targetEntity=User.class,optional=false)
|
@ManyToOne(targetEntity=User.class,optional=false)
|
||||||
@JoinColumn(name="user_id",nullable=false)
|
@JoinColumn(name="user_id",nullable=false)
|
||||||
private User user;
|
private User user;
|
||||||
/**
|
|
||||||
* Dummy field to make the composite PK work despite the ManyToOne relationship
|
|
||||||
*/
|
|
||||||
/*@Id
|
|
||||||
@Column(name="conference_id",insertable=false,updatable=false)
|
|
||||||
private Integer conference_id;
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* Conference for which this role is defined
|
* Conference for which this role is defined
|
||||||
* Primary Key
|
* Primary Key
|
||||||
@@ -91,7 +80,6 @@ public class Role implements Serializable {
|
|||||||
@JoinColumn(name="user_id",nullable=false)
|
@JoinColumn(name="user_id",nullable=false)
|
||||||
public void setUser(User user) {
|
public void setUser(User user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
//this.user_id = user.getLogin();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ManyToOne(targetEntity=Conference.class,optional=false)
|
@ManyToOne(targetEntity=Conference.class,optional=false)
|
||||||
@@ -105,10 +93,9 @@ public class Role implements Serializable {
|
|||||||
@JoinColumn(name="conference_id",nullable=false)
|
@JoinColumn(name="conference_id",nullable=false)
|
||||||
public void setConference(Conference conference) {
|
public void setConference(Conference conference) {
|
||||||
this.conference = conference;
|
this.conference = conference;
|
||||||
//this.conference_id = conference.getId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the type of this role
|
* @return the type of this role
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -113,12 +113,9 @@ public class UserManagerBean implements IUserManager{
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public List<User> getPCMemberForArticle(Integer articleId){
|
public List<User> getPCMemberForArticle(Integer articleId){
|
||||||
//select p from Paper p join p.referees r where r.login=:aLogin and p.conference=:aConf
|
//select p from Paper p join p.referees r where r.login=:aLogin and p.conference=:aConf
|
||||||
//Query query = em.createQuery("select members from Article a join a.pcMembers members WHERE a.id = ?");
|
Query query = em.createQuery("select a.pcMembers from Article a where a.id=?");
|
||||||
//query.setParameter(1, articleId);
|
query.setParameter(1, articleId);
|
||||||
//return query.getResultList();
|
return query.getResultList();
|
||||||
Article article = em.find(Article.class, articleId);
|
|
||||||
return (List)article.getPCMembers();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|||||||
Reference in New Issue
Block a user