Policy failures:
Code warning - failed on resource ConferenceManagerBean.java. Reason: The import java.util.HashMap is never used, line 3 - failed on resource Conference.java. Reason: The import javax.persistence.Entity is never used, line 6 - failed on resource Conference.java. Reason: The import javax.persistence.FetchType is never used, line 7 - failed on resource Conference.java. Reason: The import javax.persistence.GeneratedValue is never used, line 8 - failed on resource Conference.java. Reason: The import javax.persistence.GenerationType is never used, line 9 ... and more. Override reason: f
This commit is contained in:
@@ -17,37 +17,37 @@ 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.User;
|
||||||
|
|
||||||
@Entity
|
//@Entity
|
||||||
public class Conference {
|
public class Conference {
|
||||||
@Id
|
//@Id
|
||||||
@GeneratedValue(strategy=GenerationType.AUTO)
|
//@GeneratedValue(strategy=GenerationType.AUTO)
|
||||||
private String id;
|
private Integer id;
|
||||||
private String titre;
|
private String titre;
|
||||||
private String description;
|
private String description;
|
||||||
private String otherInformations;
|
private String otherInformations;
|
||||||
@Temporal(TemporalType.DATE)
|
//@Temporal(TemporalType.DATE)
|
||||||
private Date dateAbstract;
|
private Date dateAbstract;
|
||||||
@Temporal(TemporalType.DATE)
|
//@Temporal(TemporalType.DATE)
|
||||||
private Date dateArticle;
|
private Date dateArticle;
|
||||||
@Temporal(TemporalType.DATE)
|
//@Temporal(TemporalType.DATE)
|
||||||
private Date dateEvaluation;
|
private Date dateEvaluation;
|
||||||
@Temporal(TemporalType.DATE)
|
//@Temporal(TemporalType.DATE)
|
||||||
private Date dateStart;
|
private Date dateStart;
|
||||||
@Temporal(TemporalType.DATE)
|
//@Temporal(TemporalType.DATE)
|
||||||
private Date dateEnd;
|
private Date dateEnd;
|
||||||
|
|
||||||
@OneToOne(targetEntity=User.class,optional=false)
|
//@OneToOne(targetEntity=User.class,optional=false)
|
||||||
@JoinColumn(name="chairman_id",nullable=false)
|
//@JoinColumn(name="chairman_id",nullable=false)
|
||||||
private User chairman;
|
private User chairman;
|
||||||
|
|
||||||
@OneToMany(targetEntity=Article.class,mappedBy="articles")
|
//@OneToMany(targetEntity=Article.class,mappedBy="articles")
|
||||||
private ArrayList<Article> articles;
|
private ArrayList<Article> articles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the chairman
|
* @return the chairman
|
||||||
*/
|
*/
|
||||||
@OneToOne(targetEntity=User.class,optional=false)
|
//@OneToOne(targetEntity=User.class,optional=false)
|
||||||
@JoinColumn(name="chairman_id",nullable=false)
|
//@JoinColumn(name="chairman_id",nullable=false)
|
||||||
public User getChairman() {
|
public User getChairman() {
|
||||||
return chairman;
|
return chairman;
|
||||||
}
|
}
|
||||||
@@ -55,50 +55,50 @@ public class Conference {
|
|||||||
/**
|
/**
|
||||||
* @param chairman the chairman to set
|
* @param chairman the chairman to set
|
||||||
*/
|
*/
|
||||||
@OneToOne(targetEntity=User.class,optional=false)
|
//@OneToOne(targetEntity=User.class,optional=false)
|
||||||
@JoinColumn(name="chairman_id",nullable=false)
|
//@JoinColumn(name="chairman_id",nullable=false)
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Temporal(TemporalType.DATE)
|
//@Temporal(TemporalType.DATE)
|
||||||
public void setDataAbstract(Date dataAbstract) {
|
public void setDataAbstract(Date dataAbstract) {
|
||||||
this.dateAbstract = dataAbstract;
|
this.dateAbstract = dataAbstract;
|
||||||
}
|
}
|
||||||
@Temporal(TemporalType.DATE)
|
//@Temporal(TemporalType.DATE)
|
||||||
public Date getDateArticle() {
|
public Date getDateArticle() {
|
||||||
return dateArticle;
|
return dateArticle;
|
||||||
}
|
}
|
||||||
@Temporal(TemporalType.DATE)
|
//@Temporal(TemporalType.DATE)
|
||||||
public void setDateArticle(Date dateArticle) {
|
public void setDateArticle(Date dateArticle) {
|
||||||
this.dateArticle = dateArticle;
|
this.dateArticle = dateArticle;
|
||||||
}
|
}
|
||||||
@Temporal(TemporalType.DATE)
|
//@Temporal(TemporalType.DATE)
|
||||||
public Date getDateEnd() {
|
public Date getDateEnd() {
|
||||||
return dateEnd;
|
return dateEnd;
|
||||||
}
|
}
|
||||||
@Temporal(TemporalType.DATE)
|
//@Temporal(TemporalType.DATE)
|
||||||
public void setDateEnd(Date dateEnd) {
|
public void setDateEnd(Date dateEnd) {
|
||||||
this.dateEnd = dateEnd;
|
this.dateEnd = dateEnd;
|
||||||
}
|
}
|
||||||
@Temporal(TemporalType.DATE)
|
//@Temporal(TemporalType.DATE)
|
||||||
public Date getDateEvaluation() {
|
public Date getDateEvaluation() {
|
||||||
return dateEvaluation;
|
return dateEvaluation;
|
||||||
}
|
}
|
||||||
@Temporal(TemporalType.DATE)
|
//@Temporal(TemporalType.DATE)
|
||||||
public void setDateEvaluation(Date dateEvaluation) {
|
public void setDateEvaluation(Date dateEvaluation) {
|
||||||
this.dateEvaluation = dateEvaluation;
|
this.dateEvaluation = dateEvaluation;
|
||||||
}
|
}
|
||||||
@Temporal(TemporalType.DATE)
|
//@Temporal(TemporalType.DATE)
|
||||||
public Date getDateStart() {
|
public Date getDateStart() {
|
||||||
return dateStart;
|
return dateStart;
|
||||||
}
|
}
|
||||||
@Temporal(TemporalType.DATE)
|
//@Temporal(TemporalType.DATE)
|
||||||
public void setDateStart(Date dateStart) {
|
public void setDateStart(Date dateStart) {
|
||||||
this.dateStart = dateStart;
|
this.dateStart = dateStart;
|
||||||
}
|
}
|
||||||
@@ -120,17 +120,17 @@ public class Conference {
|
|||||||
public void setTitre(String titre) {
|
public void setTitre(String titre) {
|
||||||
this.titre = titre;
|
this.titre = titre;
|
||||||
}
|
}
|
||||||
public String getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
public void setId(String id) {
|
public void setId(Integer id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Conference() {
|
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();
|
super();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.titre = titre;
|
this.titre = titre;
|
||||||
@@ -143,7 +143,7 @@ public class Conference {
|
|||||||
this.dateEnd = dateEnd;
|
this.dateEnd = dateEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OneToMany(targetEntity=Article.class,mappedBy="articles")
|
//@OneToMany(targetEntity=Article.class,mappedBy="articles")
|
||||||
public List<Article> getArticles() {
|
public List<Article> getArticles() {
|
||||||
return articles;
|
return articles;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +1,45 @@
|
|||||||
package org.yacos.core.conferences;
|
package org.yacos.core.conferences;
|
||||||
|
|
||||||
import javax.ejb.Stateless;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
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.article.ArticleManagerBean;
|
|
||||||
|
|
||||||
@Stateless
|
@Stateless
|
||||||
public class ConferenceManagerBean implements IConferenceManager {
|
public class ConferenceManagerBean implements IConferenceManager {
|
||||||
@PersistenceContext
|
@PersistenceContext
|
||||||
EntityManager em;
|
EntityManager em;
|
||||||
|
|
||||||
|
private List<Conference> conferences;
|
||||||
|
|
||||||
public void addConference(Conference conf) {
|
public void addConference(Conference conf) {
|
||||||
em.persist(conf);
|
//em.persist(conf);
|
||||||
|
conferences.add(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Conference> getConferences() {
|
public List<Conference> getConferences() {
|
||||||
return em.createQuery("from Conference conf ORDER BY conf.id").getResultList();
|
//return em.createQuery("from Conference conf ORDER BY conf.id").getResultList();
|
||||||
|
return conferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Conference getConference(Integer id) {
|
public Conference getConference(Integer id) {
|
||||||
return em.find(Conference.class, id);
|
//return em.find(Conference.class, id);
|
||||||
|
for (Conference c : conferences) {
|
||||||
|
if(c.getId()== id){
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(Integer id) {
|
public void remove(Integer id) {
|
||||||
Conference conf=this.getConference(id);
|
Conference conf=this.getConference(id);
|
||||||
em.remove(conf);
|
//em.remove(conf);
|
||||||
|
conferences.remove(conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(Conference newC, Integer id) {
|
public void update(Conference newC, Integer id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user