Policy failures:
Code warning - failed on resource Conference.java. Reason: The import javax.persistence.JoinColumn is never used, line 12 - failed on resource Conference.java. Reason: The import javax.persistence.OneToOne is never used, line 14 - failed on resource Conference.java. Reason: The import org.yacos.core.users.User is never used, line 20 - failed on resource ConferenceManagerBean.java. Reason: Type safety: The expression of type List needs unchecked conversion to conform to List<Role>, line 6 Override reason: ds
This commit is contained in:
@@ -9,12 +9,15 @@ 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.Role;
|
import org.yacos.core.users.Role;
|
||||||
|
import org.yacos.core.users.User;
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@@ -45,17 +48,18 @@ public class Conference implements Serializable{
|
|||||||
@OneToMany(targetEntity=Role.class,mappedBy="conference")
|
@OneToMany(targetEntity=Role.class,mappedBy="conference")
|
||||||
private Collection<Role> roles;
|
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;
|
||||||
*/
|
*/
|
||||||
@OneToMany(targetEntity=Article.class,mappedBy="conference")
|
@OneToMany(targetEntity=Article.class,mappedBy="conference")
|
||||||
private Collection<Article> articles;
|
private Collection<Article> articles;
|
||||||
|
/*
|
||||||
/**
|
/**
|
||||||
* @return the chairman
|
* @return the chairman
|
||||||
*/
|
*/
|
||||||
/*@OneToOne(targetEntity=User.class,optional=true)
|
/*
|
||||||
|
@OneToOne(targetEntity=User.class,optional=true)
|
||||||
@JoinColumn(name="chairman_id",nullable=true)
|
@JoinColumn(name="chairman_id",nullable=true)
|
||||||
public User getChairman() {
|
public User getChairman() {
|
||||||
return chairman;
|
return chairman;
|
||||||
@@ -64,13 +68,13 @@ public class Conference implements Serializable{
|
|||||||
/**
|
/**
|
||||||
* @param chairman the chairman to set
|
* @param chairman the chairman to set
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
@OneToOne(targetEntity=User.class,optional=true)
|
@OneToOne(targetEntity=User.class,optional=true)
|
||||||
@JoinColumn(name="chairman_id",nullable=true)
|
@JoinColumn(name="chairman_id",nullable=true)
|
||||||
public void setChairman(User chairman) {
|
public void setChairman(User chairman) {
|
||||||
this.chairman = chairman;
|
this.chairman = chairman;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@Temporal(TemporalType.DATE)
|
@Temporal(TemporalType.DATE)
|
||||||
public Date getDataAbstract() {
|
public Date getDataAbstract() {
|
||||||
return dateAbstract;
|
return dateAbstract;
|
||||||
@@ -163,10 +167,12 @@ public class Conference implements Serializable{
|
|||||||
return articles;
|
return articles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OneToMany(targetEntity=Role.class,mappedBy="conference")
|
||||||
public Collection<Role> getRoles() {
|
public Collection<Role> getRoles() {
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OneToMany(targetEntity=Role.class,mappedBy="conference")
|
||||||
public void setRoles(Collection<Role> roles) {
|
public void setRoles(Collection<Role> roles) {
|
||||||
this.roles = roles;
|
this.roles = roles;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package org.yacos.core.conferences;
|
package org.yacos.core.conferences;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
|
import javax.persistence.Query;
|
||||||
|
|
||||||
import org.yacos.core.article.Article;
|
import org.yacos.core.article.Article;
|
||||||
import org.yacos.core.users.Role;
|
import org.yacos.core.users.Role;
|
||||||
@@ -16,8 +18,10 @@ public class ConferenceManagerBean implements IConferenceManager {
|
|||||||
@PersistenceContext
|
@PersistenceContext
|
||||||
EntityManager em;
|
EntityManager em;
|
||||||
|
|
||||||
public void addConference(Conference conf) {
|
public Conference addConference(String titre, String descirption, String infoComplementray, Date dataAbstract, Date dateArticle, Date dateEvaluation, Date dateStart, Date dateEnd) {
|
||||||
|
Conference conf = new Conference(titre, descirption, infoComplementray, dataAbstract, dateArticle, dateEvaluation, dateStart, dateEnd);
|
||||||
em.persist(conf);
|
em.persist(conf);
|
||||||
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@@ -53,17 +57,16 @@ public class ConferenceManagerBean implements IConferenceManager {
|
|||||||
em.persist(role);
|
em.persist(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getRoles(Role role, User user) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
|
public List<Role> getRoles(User user, Conference conf) {
|
||||||
|
Query query = em.createQuery("from Role role where conference = ? and user = ?");
|
||||||
|
query.setParameter(0, conf);
|
||||||
|
query.setParameter(1, user);
|
||||||
|
|
||||||
|
return query.getResultList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void getRoles(User user, Conference conf) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeRoleForUser(Role role) {
|
public void removeRoleForUser(Role role) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package org.yacos.core.conferences;
|
package org.yacos.core.conferences;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ejb.Remote;
|
import javax.ejb.Remote;
|
||||||
|
|
||||||
@@ -12,18 +14,20 @@ import org.yacos.core.users.User;
|
|||||||
public interface IConferenceManager {
|
public interface IConferenceManager {
|
||||||
|
|
||||||
//CRUD methodes
|
//CRUD methodes
|
||||||
public void addConference(Conference conf);
|
public Conference addConference(String titre, String descirption, String infoComplementray, Date dataAbstract, Date dateArticle, Date dateEvaluation, Date dateStart, Date dateEnd);
|
||||||
public Conference getConference(Integer id);
|
public Conference getConference(Integer id);
|
||||||
public Collection<Conference> getConferences();
|
public Collection<Conference> getConferences();
|
||||||
public void remove(Conference conf);
|
public void remove(Conference conf);
|
||||||
public void update(Conference conf);
|
public void update(Conference conf);
|
||||||
|
|
||||||
//article methodes
|
//article methodes
|
||||||
public void addArticle(User user);
|
//FIXME
|
||||||
|
//methode a gicler ?
|
||||||
|
//public void addArticle(User user);
|
||||||
public Collection<Article> getArticles(Integer id);
|
public Collection<Article> getArticles(Integer id);
|
||||||
|
|
||||||
//role methode
|
//role methode
|
||||||
public void addRoleForUser(Role.RoleType roleType, User user, Conference conf);
|
public void addRoleForUser(Role.RoleType roleType, User user, Conference conf);
|
||||||
public void removeRoleForUser(Role role);
|
public void removeRoleForUser(Role role);
|
||||||
public void getRoles(User user, Conference conf);
|
public List<Role> getRoles(User user, Conference conf);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user