This commit is contained in:
@@ -73,7 +73,7 @@ public class Article implements Serializable {
|
||||
public Article(int reference, String title, String topic,
|
||||
String url_article, String mainAuthor,
|
||||
ArrayList<String> secondaryAuthor, int state) {
|
||||
this.id = id;
|
||||
this.id = reference;
|
||||
this.title = title;
|
||||
this.topic = topic;
|
||||
this.URL_article = url_article;
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package org.yacos.core.conferences;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
@@ -22,7 +19,7 @@ import org.yacos.core.users.User;
|
||||
public class Conference {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
private String id;
|
||||
private Integer id;
|
||||
private String titre;
|
||||
private String description;
|
||||
private String otherInformations;
|
||||
@@ -121,17 +118,17 @@ public class Conference {
|
||||
public void setTitre(String titre) {
|
||||
this.titre = titre;
|
||||
}
|
||||
public String getId() {
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Conference() {
|
||||
}
|
||||
|
||||
public Conference(String id, String titre, String descirption, String infoComplementray, Date dataAbstract, Date dateArticle, Date dateEvaluation, Date dateStart, Date dateEnd) {
|
||||
public Conference(Integer id, String titre, String descirption, String infoComplementray, Date dataAbstract, Date dateArticle, Date dateEvaluation, Date dateStart, Date dateEnd) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.titre = titre;
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
package org.yacos.core.conferences;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
|
||||
import org.yacos.core.article.Article;
|
||||
import org.yacos.core.article.ArticleManagerBean;
|
||||
|
||||
@Stateless
|
||||
public class ConferenceManagerBean implements IConferenceManager {
|
||||
@@ -20,6 +16,7 @@ public class ConferenceManagerBean implements IConferenceManager {
|
||||
em.persist(conf);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Conference> getConferences() {
|
||||
return em.createQuery("from Conference conf ORDER BY conf.id").getResultList();
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ public class Criterion {
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
private Integer id;
|
||||
private String name;
|
||||
private Integer min;
|
||||
private Integer max;
|
||||
private Integer min_rating;
|
||||
private Integer max_rating;
|
||||
|
||||
@ManyToOne(targetEntity=Conference.class)
|
||||
@JoinColumn(name="conference_id",nullable=false)
|
||||
@@ -78,28 +78,28 @@ public class Criterion {
|
||||
* @return the minimum value for this criterion
|
||||
*/
|
||||
public Integer getMin() {
|
||||
return min;
|
||||
return min_rating;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param min the minimum value for this criterion
|
||||
*/
|
||||
public void setMin(Integer min) {
|
||||
this.min = min;
|
||||
this.min_rating = min;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximum value for this criterion
|
||||
*/
|
||||
public Integer getMax() {
|
||||
return max;
|
||||
return max_rating;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param max the maximum value for this criterion
|
||||
*/
|
||||
public void setMax(Integer max) {
|
||||
this.max = max;
|
||||
this.max_rating = max;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,26 @@
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,17 @@
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
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;
|
||||
@@ -20,7 +21,7 @@ public class Rating {
|
||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||
private Integer id;
|
||||
private Integer value;
|
||||
@ManyToOne(targetEntity=Criterion.class)
|
||||
@ManyToOne(targetEntity=Criterion.class,fetch=FetchType.EAGER)
|
||||
@JoinColumn(name="criterion_id",nullable=false)
|
||||
private Criterion criterion;
|
||||
@ManyToOne(targetEntity=Report.class)
|
||||
|
||||
@@ -7,6 +7,7 @@ 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;
|
||||
@@ -28,7 +29,7 @@ public class Report {
|
||||
private Integer id;
|
||||
private String commentPCMember;
|
||||
private String commentAuthor;
|
||||
@OneToMany(targetEntity=Rating.class,mappedBy="report")
|
||||
@OneToMany(targetEntity=Rating.class,mappedBy="report",fetch=FetchType.EAGER)
|
||||
private Collection<Rating> ratings;
|
||||
@ManyToOne(targetEntity=User.class)
|
||||
@JoinColumn(name="referee_id",nullable=false)
|
||||
|
||||
@@ -2,8 +2,9 @@ package org.yacos.core.users;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface IUserManagerBean {
|
||||
public interface IUsersManager {
|
||||
public Collection<User> getUsers();
|
||||
public void addUser(User user);
|
||||
public void removeUser(User user);
|
||||
public User getUser(String login);
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.yacos.core.users;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
@@ -9,8 +8,6 @@ import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.yacos.core.conferences.Conference;
|
||||
import org.yacos.core.users.RoleType.RoleTypeEnum;
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package org.yacos.core.users;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToMany;
|
||||
@@ -97,7 +95,7 @@ public class User {
|
||||
}
|
||||
|
||||
public void addRole(Role role){
|
||||
// TODO
|
||||
roles.add(role);
|
||||
}
|
||||
|
||||
public void addRoleForConference(RoleType roleType, Conference conference){
|
||||
@@ -115,8 +113,7 @@ public class User {
|
||||
|
||||
@OneToMany(targetEntity=Role.class,mappedBy="user")
|
||||
public Collection<Role> getRoles(){
|
||||
// TODO
|
||||
return null;
|
||||
return roles;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,16 +6,23 @@ 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 IUserManagerBean{
|
||||
public class UsersManagerBean implements IUsersManager{
|
||||
@PersistenceContext
|
||||
EntityManager em;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Collection<User> getUsers(){
|
||||
// TODO
|
||||
return null;
|
||||
Query query = em.createNativeQuery("from User", User.class);
|
||||
return query.getResultList();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -23,7 +30,7 @@ public class UsersManagerBean implements IUserManagerBean{
|
||||
* @param user
|
||||
*/
|
||||
public void addUser(User user){
|
||||
// TODO
|
||||
em.persist(user);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,6 +38,11 @@ public class UsersManagerBean implements IUserManagerBean{
|
||||
* @param user
|
||||
*/
|
||||
public void removeUser(User user){
|
||||
// TODO
|
||||
User persistedUser = em.find(User.class, user.getLogin());
|
||||
em.remove(persistedUser);
|
||||
}
|
||||
|
||||
public User getUser(String login) {
|
||||
return em.find(User.class, login);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user