Policy failures:
Code warning - failed on resource Article.java. Reason: The assignment to variable id has no effect, line 75 - failed on resource ArticleManagerBean.java. Reason: The import java.util.Collection is never used, line 5 - failed on resource Preference.java. Reason: The import javax.persistence.Entity is never used, line 6 - failed on resource Delegation.java. Reason: The import javax.persistence.Entity is never used, line 8 - failed on resource Preference.java. Reason: The import javax.persistence.Id is never used, line 7 ... and more. Override reason: e
This commit is contained in:
@@ -3,27 +3,24 @@ 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 javax.persistence.*;
|
||||
|
||||
|
||||
import org.yacos.core.conferences.Conference;
|
||||
import org.yacos.core.users.User;
|
||||
|
||||
@Entity
|
||||
//@Entity
|
||||
public class Article implements Serializable {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
// @Id
|
||||
// @GeneratedValue(strategy=GenerationType.AUTO)
|
||||
private int id;
|
||||
private String title;
|
||||
private String topic;
|
||||
@@ -34,30 +31,30 @@ public class Article implements Serializable {
|
||||
/**
|
||||
* The conference this article has been submitted for
|
||||
*/
|
||||
@ManyToOne(targetEntity=Conference.class)
|
||||
@JoinColumn(name="conference_id",nullable=false)
|
||||
//@ManyToOne(targetEntity=Conference.class)
|
||||
//@JoinColumn(name="conference_id",nullable=false)
|
||||
private Conference conference;
|
||||
|
||||
/**
|
||||
* The referees reviewing this article
|
||||
*/
|
||||
@ManyToMany(targetEntity=User.class)
|
||||
/*@ManyToMany(targetEntity=User.class)
|
||||
@JoinTable(
|
||||
name="articles_referees_map",
|
||||
joinColumns=@JoinColumn(name="user_id"),
|
||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||
)
|
||||
)*/
|
||||
|
||||
private Collection<User> referees;
|
||||
|
||||
/**
|
||||
* The PC Members responsible for this article evaluation
|
||||
*/
|
||||
@ManyToMany(targetEntity=User.class)
|
||||
/*@ManyToMany(targetEntity=User.class)
|
||||
@JoinTable(
|
||||
name="articles_pcmembers_map",
|
||||
joinColumns=@JoinColumn(name="user_id"),
|
||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||
)
|
||||
)*/
|
||||
private Collection<User> pcMembers;
|
||||
|
||||
private int state;
|
||||
@@ -68,6 +65,8 @@ public class Article implements Serializable {
|
||||
|
||||
public Article() {
|
||||
secondaryAuthors = new ArrayList<String>();
|
||||
referees = new ArrayList<User>();
|
||||
pcMembers = new ArrayList<User>();
|
||||
}
|
||||
|
||||
public Article(int reference, String title, String topic,
|
||||
@@ -82,8 +81,8 @@ public class Article implements Serializable {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
//@Id
|
||||
//@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -140,22 +139,23 @@ public class Article implements Serializable {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@ManyToMany(targetEntity=User.class)
|
||||
/*@ManyToMany(targetEntity=User.class)
|
||||
@JoinTable(
|
||||
name="articles_referees_map",
|
||||
joinColumns=@JoinColumn(name="user_id"),
|
||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
||||
)
|
||||
)*/
|
||||
public Collection<User> getReferees(){
|
||||
return referees;
|
||||
return this.referees;
|
||||
//return em.createQuery("SELECT u FROM User u").getResultList();
|
||||
}
|
||||
|
||||
@ManyToMany(targetEntity=User.class)
|
||||
/*@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;
|
||||
}
|
||||
@@ -179,12 +179,12 @@ public class Article implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
@ManyToOne(targetEntity=Conference.class)
|
||||
//@ManyToOne(targetEntity=Conference.class)
|
||||
public Conference getConference(){
|
||||
return conference;
|
||||
}
|
||||
|
||||
@ManyToOne(targetEntity=Conference.class)
|
||||
//@ManyToOne(targetEntity=Conference.class)
|
||||
public void setConference(Conference conference){
|
||||
this.conference = conference;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.yacos.core.article;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
@@ -20,38 +22,49 @@ public class ArticleManagerBean implements IArticleManager, Serializable {
|
||||
@PersistenceContext
|
||||
EntityManager em;
|
||||
|
||||
List<Article> articles;
|
||||
|
||||
public ArticleManagerBean() {
|
||||
|
||||
articles = new ArrayList<Article>();
|
||||
}
|
||||
|
||||
public void addArticle(Article a) {
|
||||
em.persist(a);
|
||||
//em.persist(a);
|
||||
articles.add(a);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
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) {
|
||||
removeArticle(getArticle(id));
|
||||
newArticle.setId(id);
|
||||
addArticle(newArticle);
|
||||
em.flush();
|
||||
//em.flush();
|
||||
}
|
||||
|
||||
public void removeArticle(Article a) {
|
||||
em.remove(a);
|
||||
em.flush();
|
||||
//em.remove(a);
|
||||
//em.flush();
|
||||
articles.remove(a);
|
||||
}
|
||||
|
||||
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){
|
||||
article.assignToPCMember(pcMember);
|
||||
em.flush();
|
||||
//em.flush();
|
||||
}
|
||||
|
||||
public List<User> getArticlePCMembers(Article article) {
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
*/
|
||||
package org.yacos.core.article;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import org.yacos.core.users.User;
|
||||
@@ -12,24 +15,26 @@ import org.yacos.core.users.User;
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
public class Delegation {
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id")
|
||||
//@Entity
|
||||
public class Delegation implements Serializable {
|
||||
//@ManyToOne(targetEntity=Article.class)
|
||||
//@JoinColumn(name="article_id")
|
||||
|
||||
|
||||
private Article article;
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id")
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="pcmember_id")
|
||||
private User pcMember;
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="referee_id")
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="referee_id")
|
||||
private User referee;
|
||||
|
||||
/**
|
||||
* Article being evaluated through this delegation
|
||||
* @return the article
|
||||
*/
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id")
|
||||
//@ManyToOne(targetEntity=Article.class)
|
||||
//@JoinColumn(name="article_id")
|
||||
public Article getArticle() {
|
||||
return article;
|
||||
}
|
||||
@@ -37,8 +42,8 @@ public class Delegation {
|
||||
* Define the article evaluated through this delegation
|
||||
* @param article the article to set
|
||||
*/
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id")
|
||||
//@ManyToOne(targetEntity=Article.class)
|
||||
//@JoinColumn(name="article_id")
|
||||
public void setArticle(Article article) {
|
||||
this.article = article;
|
||||
}
|
||||
@@ -46,8 +51,8 @@ public class Delegation {
|
||||
* PCMember that delegated the article to a referee
|
||||
* @return the pcMember
|
||||
*/
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id")
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="pcmember_id")
|
||||
public User getPcMember() {
|
||||
return pcMember;
|
||||
}
|
||||
@@ -55,8 +60,8 @@ public class Delegation {
|
||||
* Set PCMember that delegated the article to a referee
|
||||
* @param pcMember the pcMember to set
|
||||
*/
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id")
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="pcmember_id")
|
||||
public void setPcMember(User pcMember) {
|
||||
this.pcMember = pcMember;
|
||||
}
|
||||
@@ -64,8 +69,8 @@ public class Delegation {
|
||||
* Get the referee that will evaluate this article
|
||||
* @return the referee
|
||||
*/
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="referee_id")
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="referee_id")
|
||||
public User getReferee() {
|
||||
return referee;
|
||||
}
|
||||
@@ -73,11 +78,12 @@ public class Delegation {
|
||||
* Get
|
||||
* @param referee the referee to set
|
||||
*/
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="referee_id")
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="referee_id")
|
||||
public void setReferee(User referee) {
|
||||
this.referee = referee;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
package org.yacos.core.article;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Id;
|
||||
|
||||
import org.yacos.core.users.User;
|
||||
|
||||
@@ -13,44 +12,54 @@ import org.yacos.core.users.User;
|
||||
* @author christiancorsano
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
//@Entity
|
||||
public class Preference {
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id",nullable=false)
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="pcmember_id",nullable=false)
|
||||
|
||||
//@Id
|
||||
private int id;
|
||||
|
||||
private User pcMember;
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id",nullable=false)
|
||||
//@ManyToOne(targetEntity=Article.class)
|
||||
//@JoinColumn(name="article_id",nullable=false)
|
||||
private Article article;
|
||||
/**
|
||||
* @return the pcMember
|
||||
*/
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id",nullable=false)
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="pcmember_id",nullable=false)
|
||||
public User getPcMember() {
|
||||
return pcMember;
|
||||
}
|
||||
/**
|
||||
* @param pcMember the pcMember to set
|
||||
*/
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="pcmember_id",nullable=false)
|
||||
//@ManyToOne(targetEntity=User.class)
|
||||
//@JoinColumn(name="pcmember_id",nullable=false)
|
||||
public void setPcMember(User pcMember) {
|
||||
this.pcMember = pcMember;
|
||||
}
|
||||
/**
|
||||
* @return the article
|
||||
*/
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id",nullable=false)
|
||||
//@ManyToOne(targetEntity=Article.class)
|
||||
//@JoinColumn(name="article_id",nullable=false)
|
||||
public Article getArticle() {
|
||||
return article;
|
||||
}
|
||||
/**
|
||||
* @param article the article to set
|
||||
*/
|
||||
@ManyToOne(targetEntity=Article.class)
|
||||
@JoinColumn(name="article_id",nullable=false)
|
||||
//@ManyToOne(targetEntity=Article.class)
|
||||
//@JoinColumn(name="article_id",nullable=false)
|
||||
public void setArticle(Article article) {
|
||||
this.article = article;
|
||||
}
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user