This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package org.yacos.core.conferences;
|
package org.yacos.core.conferences;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -8,21 +9,19 @@ import javax.persistence.Entity;
|
|||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
import org.yacos.core.article.Article;
|
import org.yacos.core.article.Article;
|
||||||
import org.yacos.core.users.User;
|
import org.yacos.core.users.Role;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class Conference implements Serializable{
|
public class Conference implements Serializable{
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
@GeneratedValue(strategy=GenerationType.AUTO)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
@@ -40,6 +39,12 @@ public class Conference implements Serializable{
|
|||||||
@Temporal(TemporalType.DATE)
|
@Temporal(TemporalType.DATE)
|
||||||
private Date dateEnd;
|
private Date dateEnd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Roles of users for this conference
|
||||||
|
*/
|
||||||
|
@OneToMany(targetEntity=Role.class,mappedBy="conference")
|
||||||
|
private Collection<Role> roles;
|
||||||
|
|
||||||
/*@OneToOne(targetEntity=User.class,optional=true)
|
/*@OneToOne(targetEntity=User.class,optional=true)
|
||||||
@JoinColumn(name="chairman_id",nullable=true)
|
@JoinColumn(name="chairman_id",nullable=true)
|
||||||
private User chairman;
|
private User chairman;
|
||||||
@@ -133,11 +138,11 @@ public class Conference implements Serializable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Conference() {
|
public Conference() {
|
||||||
|
this.roles = new ArrayList<Role>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Conference(String titre, String descirption, String infoComplementray, Date dataAbstract, Date dateArticle, Date dateEvaluation, Date dateStart, Date dateEnd) {
|
public Conference(String titre, String descirption, String infoComplementray, Date dataAbstract, Date dateArticle, Date dateEvaluation, Date dateStart, Date dateEnd) {
|
||||||
super();
|
this();
|
||||||
this.id = id;
|
|
||||||
this.titre = titre;
|
this.titre = titre;
|
||||||
this.description = descirption;
|
this.description = descirption;
|
||||||
this.otherInformations = infoComplementray;
|
this.otherInformations = infoComplementray;
|
||||||
@@ -157,4 +162,12 @@ public class Conference implements Serializable{
|
|||||||
public Collection<Article> getArticles() {
|
public Collection<Article> getArticles() {
|
||||||
return articles;
|
return articles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Collection<Role> getRoles() {
|
||||||
|
return roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoles(Collection<Role> roles) {
|
||||||
|
this.roles = roles;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
package org.yacos.core.conferences;
|
package org.yacos.core.conferences;
|
||||||
|
|
||||||
import javax.ejb.Stateless;
|
import java.util.Collection;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.ejb.Stateless;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
|
|
||||||
import org.yacos.core.article.Article;
|
import org.yacos.core.article.Article;
|
||||||
|
import org.yacos.core.users.Role;
|
||||||
|
import org.yacos.core.users.User;
|
||||||
|
|
||||||
@Stateless
|
@Stateless
|
||||||
public class ConferenceManagerBean implements IConferenceManager {
|
public class ConferenceManagerBean implements IConferenceManager {
|
||||||
@@ -25,18 +29,44 @@ public class ConferenceManagerBean implements IConferenceManager {
|
|||||||
return em.find(Conference.class, id);
|
return em.find(Conference.class, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(Integer id) {
|
public void remove(Conference conf) {
|
||||||
Conference conf=this.getConference(id);
|
Conference persistedConf = em.find(Conference.class, conf.getId());
|
||||||
em.remove(conf);
|
em.remove(persistedConf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(Conference newC, Integer id) {
|
public void update(Conference conf) {
|
||||||
this.remove(id);
|
em.merge(conf);
|
||||||
this.addConference(newC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Article> getArticles(Integer conference_id) {
|
public Collection<Article> getArticles(Integer conference_id) {
|
||||||
return new ArrayList<Article>(getConference(conference_id).getArticles());
|
//FIXME cast a verifier lors des tests
|
||||||
|
return getConference(conference_id).getArticles();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addArticle(User user) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addRoleForUser(Role.RoleType roleType, User user, Conference conf) {
|
||||||
|
Role role = new Role(roleType, user, conf);
|
||||||
|
em.persist(role);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getRoles(Role role, User user) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void getRoles(User user, Conference conf) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeRoleForUser(Role role) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,29 @@
|
|||||||
package org.yacos.core.conferences;
|
package org.yacos.core.conferences;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
|
|
||||||
import javax.ejb.Remote;
|
import javax.ejb.Remote;
|
||||||
|
|
||||||
import org.yacos.core.article.Article;
|
import org.yacos.core.article.Article;
|
||||||
|
import org.yacos.core.users.Role;
|
||||||
|
import org.yacos.core.users.User;
|
||||||
|
|
||||||
@Remote
|
@Remote
|
||||||
public interface IConferenceManager {
|
public interface IConferenceManager {
|
||||||
public void addConference(Conference conf);
|
|
||||||
|
//CRUD methodes
|
||||||
|
public void addConference(Conference conf);
|
||||||
public Conference getConference(Integer id);
|
public Conference getConference(Integer id);
|
||||||
public List<Conference> getConferences();
|
public Collection<Conference> getConferences();
|
||||||
public void remove(Integer id);
|
public void remove(Conference conf);
|
||||||
public void update(Conference newC,Integer id);
|
public void update(Conference conf);
|
||||||
public List<Article> getArticles(Integer id);
|
|
||||||
|
//article methodes
|
||||||
|
public void addArticle(User user);
|
||||||
|
public Collection<Article> getArticles(Integer id);
|
||||||
|
|
||||||
|
//role methode
|
||||||
|
public void addRoleForUser(Role.RoleType roleType, User user, Conference conf);
|
||||||
|
public void removeRoleForUser(Role role);
|
||||||
|
public void getRoles(User user, Conference conf);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user