Effacement du dossier test
Policy failures: Code warning - failed on resource core. Reason: The assignment to variable id has no effect, line 136 - failed on resource core. Reason: The import javax.persistence.JoinColumn is never used, line 11 - failed on resource core. Reason: The import javax.persistence.OneToOne is never used, line 13 - failed on resource core. Reason: The import org.yacos.core.users.User is never used, line 18 - failed on resource core. Reason: The serializable class Conference does not declare a static final serialVersionUID field of type long, line 21 ... and more. Override reason: haha
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="ejbModule"/>
|
<classpathentry kind="src" path="ejbModule"/>
|
||||||
<classpathentry kind="src" path="test"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.generic.runtimeTarget/JBoss v4.2"/>
|
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.generic.runtimeTarget/JBoss v4.2"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.5.0_12"/>
|
||||||
<classpathentry kind="output" path="build/classes"/>
|
<classpathentry kind="output" path="build/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
3
YACOSCore/.settings/org.eclipse.jdt.ui.prefs
Normal file
3
YACOSCore/.settings/org.eclipse.jdt.ui.prefs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#Wed Dec 12 10:51:21 GMT+01:00 2007
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
#Tue Dec 11 22:09:32 CET 2007
|
#Thu Dec 13 15:08:28 GMT+01:00 2007
|
||||||
classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER\:\:org.eclipse.jdt.internal.launching.macosx.MacOSXType\:\:JVM\ 1.5.0\ (MacOS\ X\ Default)/owners=jst.java\:5.0
|
classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER\:\:org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType\:\:jdk1.5.0_12/owners=jst.java\:5.0
|
||||||
classpath.helper/org.eclipse.jst.server.core.container\:\:org.eclipse.jst.server.generic.runtimeTarget\:\:JBoss\ v5.0/owners=jst.ejb\:3.0
|
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
<project-modules id="moduleCoreId" project-version="1.5.0">
|
<project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
<wb-module deploy-name="YACOSCore">
|
<wb-module deploy-name="YACOSCore">
|
||||||
<wb-resource deploy-path="/" source-path="/ejbModule"/>
|
<wb-resource deploy-path="/" source-path="/ejbModule"/>
|
||||||
<wb-resource deploy-path="/" source-path="/test"/>
|
|
||||||
<property name="java-output-path" value="build/classes"/>
|
<property name="java-output-path" value="build/classes"/>
|
||||||
</wb-module>
|
</wb-module>
|
||||||
</project-modules>
|
</project-modules>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<faceted-project>
|
<faceted-project>
|
||||||
<runtime name="JBoss v5.0"/>
|
|
||||||
<fixed facet="jst.java"/>
|
<fixed facet="jst.java"/>
|
||||||
<fixed facet="jst.ejb"/>
|
<fixed facet="jst.ejb"/>
|
||||||
<installed facet="jst.java" version="5.0"/>
|
<installed facet="jst.java" version="5.0"/>
|
||||||
|
|||||||
@@ -1,241 +0,0 @@
|
|||||||
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.OneToMany;
|
|
||||||
|
|
||||||
import org.yacos.core.conferences.Conference;
|
|
||||||
import org.yacos.core.users.User;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
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;
|
|
||||||
private String URL_article;
|
|
||||||
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;
|
|
||||||
|
|
||||||
@OneToMany(targetEntity=Preference.class,mappedBy="article")
|
|
||||||
private Collection<Preference> preferences;
|
|
||||||
|
|
||||||
private int state;
|
|
||||||
|
|
||||||
public enum state {
|
|
||||||
SUMMARY, FINAL
|
|
||||||
};
|
|
||||||
|
|
||||||
public Article() {
|
|
||||||
secondaryAuthors = new ArrayList<String>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Article(int reference, String title, String topic,
|
|
||||||
String url_article, String mainAuthor,
|
|
||||||
ArrayList<String> secondaryAuthor, int state) {
|
|
||||||
this.id = reference;
|
|
||||||
this.title = title;
|
|
||||||
this.topic = topic;
|
|
||||||
this.URL_article = url_article;
|
|
||||||
this.mainAuthor = mainAuthor;
|
|
||||||
this.secondaryAuthors = secondaryAuthor;
|
|
||||||
this.state = state;
|
|
||||||
secondaryAuthors = new ArrayList<String>();
|
|
||||||
referees = new ArrayList<User>();
|
|
||||||
pcMembers = new ArrayList<User>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTopic() {
|
|
||||||
return topic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTopic(String topic) {
|
|
||||||
this.topic = topic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getURL_article() {
|
|
||||||
return URL_article;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setURL_article(String url_article) {
|
|
||||||
URL_article = url_article;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMainAuthor() {
|
|
||||||
return mainAuthor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMainAuthor(String mainAuthor) {
|
|
||||||
this.mainAuthor = mainAuthor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<String> getSecondaryAuthors() {
|
|
||||||
return secondaryAuthors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSecondaryAuthors(ArrayList<String> secondaryAuthors) {
|
|
||||||
this.secondaryAuthors = secondaryAuthors;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getState() {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param referees the referees to set
|
|
||||||
*/
|
|
||||||
@ManyToMany(targetEntity=User.class)
|
|
||||||
@JoinTable(
|
|
||||||
name="articles_referees_map",
|
|
||||||
joinColumns=@JoinColumn(name="user_id"),
|
|
||||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
|
||||||
)
|
|
||||||
public void setReferees(Collection<User> referees) {
|
|
||||||
this.referees = referees;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ManyToMany(targetEntity=User.class)
|
|
||||||
@JoinTable(
|
|
||||||
name="articles_pcmembers_map",
|
|
||||||
joinColumns=@JoinColumn(name="user_id"),
|
|
||||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
|
||||||
)
|
|
||||||
public Collection<User> getPCMembers(){
|
|
||||||
return pcMembers;
|
|
||||||
}
|
|
||||||
@ManyToMany(targetEntity=User.class)
|
|
||||||
@JoinTable(
|
|
||||||
name="articles_pcmembers_map",
|
|
||||||
joinColumns=@JoinColumn(name="user_id"),
|
|
||||||
inverseJoinColumns=@JoinColumn(name="article_id")
|
|
||||||
)
|
|
||||||
public void setPCMembers(Collection<User> pcMembers){
|
|
||||||
this.pcMembers = pcMembers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void assignToPCMember(User pcMember){
|
|
||||||
// TODO : Checking if the User is a pcMember for this conference (not implemented yet)
|
|
||||||
//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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the preferences
|
|
||||||
*/
|
|
||||||
@OneToMany(targetEntity=Preference.class,mappedBy="article")
|
|
||||||
public Collection<Preference> getPreferences() {
|
|
||||||
return preferences;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param preferences the preferences to set
|
|
||||||
*/
|
|
||||||
@OneToMany(targetEntity=Preference.class,mappedBy="article")
|
|
||||||
public void setPreferences(Collection<Preference> preferences) {
|
|
||||||
this.preferences = preferences;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasMember(){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
package org.yacos.core.article;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ejb.Stateless;
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.NoResultException;
|
|
||||||
import javax.persistence.PersistenceContext;
|
|
||||||
import javax.persistence.Query;
|
|
||||||
|
|
||||||
import org.yacos.core.users.User;
|
|
||||||
|
|
||||||
@Stateless
|
|
||||||
public class ArticleManagerBean implements IArticleManager, Serializable {
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@PersistenceContext
|
|
||||||
EntityManager em;
|
|
||||||
|
|
||||||
public ArticleManagerBean() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addArticle(Article a) {
|
|
||||||
em.persist(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public List<Article> getArticles() {
|
|
||||||
return em.createQuery("from Article a ORDER BY a.title").getResultList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateArticle(Integer id, Article newArticle) {
|
|
||||||
removeArticle(getArticle(id));
|
|
||||||
newArticle.setId(id);
|
|
||||||
addArticle(newArticle);
|
|
||||||
em.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Preference getArticlePreferenceForUser(Article article,
|
|
||||||
String pcMemberLogin) {
|
|
||||||
Query query = em.createQuery("SELECT p FROM Preference p WHERE p.article.id = :articleid AND p.pcMember.id = :pcmemberlogin");
|
|
||||||
query.setParameter("articleid",article.getId());
|
|
||||||
query.setParameter("pcmemberlogin", pcMemberLogin);
|
|
||||||
try {
|
|
||||||
return (Preference) query.getSingleResult();
|
|
||||||
} catch (NoResultException e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArticlePreferences(Article article,
|
|
||||||
List<Preference> preferences) {
|
|
||||||
article.setPreferences(preferences);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addArticlePreference(Preference preference) {
|
|
||||||
if(! em.contains(preference)){
|
|
||||||
em.persist(preference);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addArticlePreference(Integer article_id, String userLogin, String preferenceValue) {
|
|
||||||
Preference preference = new Preference();
|
|
||||||
Article article = getArticle(article_id);
|
|
||||||
preference.setArticle(article);
|
|
||||||
User pcMember = em.find(User.class, userLogin);
|
|
||||||
preference.setPcMember(pcMember);
|
|
||||||
preference.setPreference(preferenceValue);
|
|
||||||
em.persist(preference);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.yacos.core.article;
|
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.ManyToOne;
|
|
||||||
import org.yacos.core.users.User;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author christiancorsano
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
public class Delegation {
|
|
||||||
/**
|
|
||||||
* Id mandatory in every entity.
|
|
||||||
*/
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
@ManyToOne(targetEntity=Article.class)
|
|
||||||
@JoinColumn(name="article_id")
|
|
||||||
private Article article;
|
|
||||||
@ManyToOne(targetEntity=User.class)
|
|
||||||
@JoinColumn(name="pcmember_id")
|
|
||||||
private User pcMember;
|
|
||||||
@ManyToOne(targetEntity=User.class)
|
|
||||||
@JoinColumn(name="referee_id")
|
|
||||||
private User referee;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the id
|
|
||||||
*/
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param id the id to set
|
|
||||||
*/
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Article being evaluated through this delegation
|
|
||||||
* @return the article
|
|
||||||
*/
|
|
||||||
@ManyToOne(targetEntity=Article.class)
|
|
||||||
@JoinColumn(name="article_id")
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package org.yacos.core.article;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import javax.ejb.Remote;
|
|
||||||
|
|
||||||
@Remote
|
|
||||||
public interface IArticleManager {
|
|
||||||
public Article getArticle(Integer id);
|
|
||||||
public void addArticle(Article a);
|
|
||||||
public void removeArticle(Article a);
|
|
||||||
public void updateArticle(Integer id, Article newArticle);
|
|
||||||
|
|
||||||
public List<?> getArticlePCMembers(Article article);
|
|
||||||
public List<?> getArticleReferees(Article article);
|
|
||||||
public Preference getArticlePreferenceForUser(Article article, String pcMemberLogin);
|
|
||||||
public void setArticlePreferences(Article article, List<Preference> preferences);
|
|
||||||
public void addArticlePreference(Integer article_id, String userLogin, String preferenceValue);
|
|
||||||
|
|
||||||
public List<Article> getArticles();
|
|
||||||
}
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.yacos.core.article;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.ManyToOne;
|
|
||||||
|
|
||||||
import org.yacos.core.users.User;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author christiancorsano
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
public class Preference implements Serializable {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
/**
|
|
||||||
* Id mandatory in every entity.
|
|
||||||
*/
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
@ManyToOne(targetEntity=User.class)
|
|
||||||
@JoinColumn(name="pcmember_id",nullable=false)
|
|
||||||
private User pcMember;
|
|
||||||
@ManyToOne(targetEntity=Article.class)
|
|
||||||
@JoinColumn(name="article_id",nullable=false)
|
|
||||||
private Article article;
|
|
||||||
|
|
||||||
|
|
||||||
private String preference;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the id
|
|
||||||
*/
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param id the id to set
|
|
||||||
*/
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
public String getPreference() {
|
|
||||||
return preference;
|
|
||||||
}
|
|
||||||
public void setPreference(String preference) {
|
|
||||||
this.preference = preference;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,156 +0,0 @@
|
|||||||
package org.yacos.core.conferences;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
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 implements Serializable{
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
private String titre;
|
|
||||||
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=true)
|
|
||||||
@JoinColumn(name="chairman_id",nullable=true)
|
|
||||||
private User chairman;
|
|
||||||
*/
|
|
||||||
@OneToMany(targetEntity=Article.class,mappedBy="conference")
|
|
||||||
private Collection<Article> articles;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the chairman
|
|
||||||
*/
|
|
||||||
/*@OneToOne(targetEntity=User.class,optional=true)
|
|
||||||
@JoinColumn(name="chairman_id",nullable=true)
|
|
||||||
public User getChairman() {
|
|
||||||
return chairman;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @param chairman the chairman to set
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
@OneToOne(targetEntity=User.class,optional=true)
|
|
||||||
@JoinColumn(name="chairman_id",nullable=true)
|
|
||||||
public void setChairman(User chairman) {
|
|
||||||
this.chairman = chairman;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
@Temporal(TemporalType.DATE)
|
|
||||||
public Date getDataAbstract() {
|
|
||||||
return dateAbstract;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Temporal(TemporalType.DATE)
|
|
||||||
public void setDataAbstract(Date 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 getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
public void setDescription(String descirption) {
|
|
||||||
this.description = descirption;
|
|
||||||
}
|
|
||||||
public String getOtherInformations() {
|
|
||||||
return otherInformations;
|
|
||||||
}
|
|
||||||
public void setOtherInformations(String otherInformations) {
|
|
||||||
this.otherInformations = otherInformations;
|
|
||||||
}
|
|
||||||
public String getTitre() {
|
|
||||||
return titre;
|
|
||||||
}
|
|
||||||
public void setTitre(String titre) {
|
|
||||||
this.titre = titre;
|
|
||||||
}
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Conference() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Conference(String titre, String descirption, String infoComplementray, Date dataAbstract, Date dateArticle, Date dateEvaluation, Date dateStart, Date dateEnd) {
|
|
||||||
super();
|
|
||||||
this.id = id;
|
|
||||||
this.titre = titre;
|
|
||||||
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 void setArticles(Collection<Article> articles) {
|
|
||||||
this.articles = articles;
|
|
||||||
}
|
|
||||||
|
|
||||||
@OneToMany(targetEntity=Article.class,mappedBy="articles")
|
|
||||||
public Collection<Article> getArticles() {
|
|
||||||
return articles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
package org.yacos.core.conferences;
|
|
||||||
|
|
||||||
import javax.ejb.Stateless;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.PersistenceContext;
|
|
||||||
import org.yacos.core.article.Article;
|
|
||||||
|
|
||||||
@Stateless
|
|
||||||
public class ConferenceManagerBean implements IConferenceManager {
|
|
||||||
@PersistenceContext
|
|
||||||
EntityManager em;
|
|
||||||
|
|
||||||
public void addConference(Conference conf) {
|
|
||||||
em.persist(conf);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
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 new ArrayList<Article>(getConference(conference_id).getArticles());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
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(Integer id);
|
|
||||||
public List<Conference> getConferences();
|
|
||||||
public void remove(Integer id);
|
|
||||||
public void update(Conference newC,Integer id);
|
|
||||||
public List<Article> getArticles(Integer id);
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
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_rating;
|
|
||||||
private Integer max_rating;
|
|
||||||
|
|
||||||
@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_rating;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param min the minimum value for this criterion
|
|
||||||
*/
|
|
||||||
public void setMin(Integer min) {
|
|
||||||
this.min_rating = min;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the maximum value for this criterion
|
|
||||||
*/
|
|
||||||
public Integer getMax() {
|
|
||||||
return max_rating;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param max the maximum value for this criterion
|
|
||||||
*/
|
|
||||||
public void setMax(Integer max) {
|
|
||||||
this.max_rating = max;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.yacos.core.evaluation;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import javax.ejb.Stateless;
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.PersistenceContext;
|
|
||||||
import javax.persistence.Query;
|
|
||||||
|
|
||||||
import org.yacos.core.article.Article;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author christiancorsano
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Stateless
|
|
||||||
public class EvaluationManager implements IEvaluationManager {
|
|
||||||
@PersistenceContext
|
|
||||||
EntityManager em;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public List<Report> getReportsForArticle(Article article) {
|
|
||||||
Query q = em.createNativeQuery("from Report where article_id="+article.getId(), Report.class);
|
|
||||||
return q.getResultList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.yacos.core.evaluation;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.ejb.Remote;
|
|
||||||
|
|
||||||
import org.yacos.core.article.Article;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author christiancorsano
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Remote
|
|
||||||
public interface IEvaluationManager {
|
|
||||||
public List<Report> getReportsForArticle(Article article);
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.yacos.core.evaluation;
|
|
||||||
|
|
||||||
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.ManyToOne;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author christiancorsano
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
public class Rating {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
private Integer value;
|
|
||||||
@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;
|
|
||||||
/**
|
|
||||||
* @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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.yacos.core.evaluation;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
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.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",fetch=FetchType.EAGER)
|
|
||||||
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,13 +0,0 @@
|
|||||||
package org.yacos.core.users;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import javax.ejb.Remote;
|
|
||||||
|
|
||||||
@Remote
|
|
||||||
public interface IUsersManager {
|
|
||||||
public Collection<User> getUsers();
|
|
||||||
public void addUser(User user);
|
|
||||||
public void removeUser(User user);
|
|
||||||
public User getUser(String login);
|
|
||||||
}
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
package org.yacos.core.users;
|
|
||||||
|
|
||||||
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 org.yacos.core.conferences.Conference;
|
|
||||||
import org.yacos.core.users.RoleType.RoleTypeEnum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An role of a given type (author,chairman,PCmember or referee)
|
|
||||||
* defined for a user and a conference
|
|
||||||
* @author christiancorsano
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
public class Role {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
/**
|
|
||||||
* User for which this role is defined
|
|
||||||
*/
|
|
||||||
@ManyToOne(targetEntity=User.class,optional=false)
|
|
||||||
@JoinColumn(name="user_id",nullable=false)
|
|
||||||
private User user;
|
|
||||||
/**
|
|
||||||
* Conference for which this role is defined
|
|
||||||
*/
|
|
||||||
@ManyToOne(targetEntity=Conference.class,optional=false)
|
|
||||||
@JoinColumn(name="conference_id",nullable=false)
|
|
||||||
private Conference conference;
|
|
||||||
/**
|
|
||||||
* The type of this role
|
|
||||||
*/
|
|
||||||
@Enumerated(EnumType.ORDINAL)
|
|
||||||
private RoleTypeEnum type;
|
|
||||||
|
|
||||||
public Role(RoleTypeEnum type,User user, Conference conference) {
|
|
||||||
super();
|
|
||||||
setType(type);
|
|
||||||
setUser(user);
|
|
||||||
setConference(conference);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return the id
|
|
||||||
*/
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param id the id to set
|
|
||||||
*/
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return the user who plays this role
|
|
||||||
*/
|
|
||||||
public User getUser() {
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param user the user who is to play this role
|
|
||||||
*/
|
|
||||||
public void setUser(User user) {
|
|
||||||
this.user = user;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return the conference for which this role is defined
|
|
||||||
*/
|
|
||||||
public Conference getConference() {
|
|
||||||
return conference;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param conference the conference for which this role is defined
|
|
||||||
*/
|
|
||||||
public void setConference(Conference conference) {
|
|
||||||
this.conference = conference;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @return the type of this role
|
|
||||||
*/
|
|
||||||
public RoleTypeEnum getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @param type the type of this role
|
|
||||||
*/
|
|
||||||
public void setType(RoleTypeEnum type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.yacos.core.users;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author christiancorsano
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class RoleType {
|
|
||||||
// TODO : see what we do with this class
|
|
||||||
public enum RoleTypeEnum {
|
|
||||||
AUTHOR,CHAIRMAN,PCMEMBER,REFEREE
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Author constant role
|
|
||||||
*/
|
|
||||||
static public final RoleType author = new RoleType("author");
|
|
||||||
/**
|
|
||||||
* Chairman constant role
|
|
||||||
*/
|
|
||||||
static public final RoleType chairman = new RoleType("chairman");
|
|
||||||
/**
|
|
||||||
* PCMember constant role
|
|
||||||
*/
|
|
||||||
static public final RoleType PCmember = new RoleType("PCmember");
|
|
||||||
/**
|
|
||||||
* Referee constant role
|
|
||||||
*/
|
|
||||||
static public final RoleType Referee = new RoleType("referee");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of this role type
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Private constructor : used to instanciate the constants
|
|
||||||
* @param name Name of the new RoleType
|
|
||||||
*/
|
|
||||||
private RoleType(String name){
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the name of this RoleType
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,159 +0,0 @@
|
|||||||
package org.yacos.core.users;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
|
|
||||||
import org.yacos.core.conferences.Conference;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A unique User of the system.
|
|
||||||
* The user is registered globally in the application and would be able to get different roles for
|
|
||||||
* different conferences.
|
|
||||||
* @author christiancorsano
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
public class User implements Serializable{
|
|
||||||
/**
|
|
||||||
* Unique login of the user
|
|
||||||
* Is used to identify the user, should be unique and can't be modified
|
|
||||||
*/
|
|
||||||
@Id
|
|
||||||
private String login;
|
|
||||||
/**
|
|
||||||
* Password : used for authentication purpose only, is only writable
|
|
||||||
*/
|
|
||||||
private String password;
|
|
||||||
/**
|
|
||||||
* First Name of the user
|
|
||||||
*/
|
|
||||||
private String firstName;
|
|
||||||
/**
|
|
||||||
* Last name of the user
|
|
||||||
*/
|
|
||||||
private String lastName;
|
|
||||||
/**
|
|
||||||
* Organization or lab the user belongs to
|
|
||||||
*/
|
|
||||||
private String organization;
|
|
||||||
/**
|
|
||||||
* Active email (has to be used frequently) of the user
|
|
||||||
*/
|
|
||||||
private String email;
|
|
||||||
/**
|
|
||||||
* Roles for this user
|
|
||||||
*/
|
|
||||||
@OneToMany(targetEntity=Role.class,mappedBy="user")
|
|
||||||
private Collection<Role> roles;
|
|
||||||
|
|
||||||
public User(String login, String password, String firstName,
|
|
||||||
String lastName, String organization, String email,
|
|
||||||
Collection<Role> roles) {
|
|
||||||
super();
|
|
||||||
this.login = login;
|
|
||||||
this.password = password;
|
|
||||||
this.firstName = firstName;
|
|
||||||
this.lastName = lastName;
|
|
||||||
this.organization = organization;
|
|
||||||
this.email = email;
|
|
||||||
this.roles = roles;
|
|
||||||
}
|
|
||||||
|
|
||||||
public User() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Id
|
|
||||||
public String getLogin() {
|
|
||||||
return login;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFirstName() {
|
|
||||||
return firstName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFirstName(String firstName) {
|
|
||||||
this.firstName = firstName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLastName() {
|
|
||||||
return lastName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastName(String lastName) {
|
|
||||||
this.lastName = lastName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOrganization() {
|
|
||||||
return organization;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrganization(String organization) {
|
|
||||||
this.organization = organization;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getEmail() {
|
|
||||||
return email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEmail(String email) {
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addRole(Role role){
|
|
||||||
roles.add(role);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addRoleForConference(RoleType roleType, Conference conference){
|
|
||||||
if(! hasRoleForConference(roleType,conference)){
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// TODO : declare and throw an exception
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasRoleForConference(RoleType roleType, Conference conference){
|
|
||||||
// TODO
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@OneToMany(targetEntity=Role.class,mappedBy="user")
|
|
||||||
public Collection<Role> getRoles(){
|
|
||||||
return roles;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the password
|
|
||||||
*/
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param login the login to set
|
|
||||||
*/
|
|
||||||
public void setLogin(String login) {
|
|
||||||
this.login = login;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param roles the roles to set
|
|
||||||
*/
|
|
||||||
@OneToMany(targetEntity=Role.class,mappedBy="user")
|
|
||||||
public void setRoles(Collection<Role> roles) {
|
|
||||||
this.roles = roles;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.yacos.core.users;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import javax.ejb.Stateless;
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.PersistenceContext;
|
|
||||||
import javax.persistence.Query;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author christiancorsano
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Stateless
|
|
||||||
public class UsersManagerBean implements IUsersManager{
|
|
||||||
@PersistenceContext
|
|
||||||
EntityManager em;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public Collection<User> getUsers(){
|
|
||||||
Query query = em.createNativeQuery("from User", User.class);
|
|
||||||
return query.getResultList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a user into the system
|
|
||||||
* @param user
|
|
||||||
*/
|
|
||||||
public void addUser(User user){
|
|
||||||
em.persist(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes a user from the system
|
|
||||||
* @param user
|
|
||||||
*/
|
|
||||||
public void removeUser(User user){
|
|
||||||
User persistedUser = em.find(User.class, user.getLogin());
|
|
||||||
em.remove(persistedUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
public User getUser(String login) {
|
|
||||||
return em.find(User.class, login);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.yacos.tests.core;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author christiancorsano
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class TestRole {
|
|
||||||
public void aRoleShouldBeUnique(){
|
|
||||||
// TODO : look for roles of the same type, same user and same conference
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
package org.yacos.tests.core;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
import javax.naming.Context;
|
|
||||||
import javax.naming.InitialContext;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.yacos.core.users.IUsersManager;
|
|
||||||
import org.yacos.core.users.User;
|
|
||||||
|
|
||||||
public class TestUser {
|
|
||||||
private IUsersManager manager;
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setUp() throws Exception {
|
|
||||||
Context context = new InitialContext();
|
|
||||||
manager = (IUsersManager) context.lookup("UsersManagerBean/remote");
|
|
||||||
|
|
||||||
manager.removeUser(manager.getUser("toto"));
|
|
||||||
|
|
||||||
User toto = new User();
|
|
||||||
toto.setLogin("toto");
|
|
||||||
toto.setFirstName("Toto");
|
|
||||||
toto.setLastName("John");
|
|
||||||
manager.addUser(toto);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testManagerPresence(){
|
|
||||||
assertNotNull(manager);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUserWritingReading(){
|
|
||||||
|
|
||||||
User user = manager.getUser("toto");
|
|
||||||
assertNotNull(user);
|
|
||||||
assertEquals("toto", user.getLogin());
|
|
||||||
assertEquals("Toto", user.getLastName());
|
|
||||||
assertEquals("John", user.getFirstName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user