Commit 8cfacb84 authored by Mathieu Gicquel's avatar Mathieu Gicquel
Browse files

Write association between task and user - Fix #14

parent 0eb51c3d
package fr.alma.gtd.server.main.donnees;
import fr.alma.gtd.server.core.IParticipant;
import fr.alma.gtd.server.core.SingleReference;
public class ReferenceToUser implements SingleReference<IParticipant> {
IParticipant p;
@Override
public void set(IParticipant newValue) {
this.basicSet(newValue);
}
@Override
public IParticipant get() {
return this.p;
}
@Override
public void unset() {
this.basicUnSet();
}
@Override
public boolean isSet() {
return this.p!=null;
}
@Override
public void basicSet(IParticipant newValue) {
this.p=newValue;
}
@Override
public void basicUnSet() {
this.p=null;
}
}
......@@ -2,6 +2,7 @@ package fr.alma.gtd.server.main.donnees;
import fr.alma.gtd.server.core.*;
import javax.xml.registry.infomodel.User;
import java.util.Date;
import java.util.List;
......@@ -17,11 +18,13 @@ public class Task implements ITask {
private ReferenceToTags tags;
private SingleReference<IContext> context;
private ReferenceTaskToProject project;
private SingleReference<IParticipant> creator;
public Task() {
tags = new ReferenceToTags();
context = new ReferenceTaskToContext(this);
project = new ReferenceTaskToProject(this);
creator = new ReferenceToUser();
}
public Task(ITask autre) {
......@@ -158,12 +161,12 @@ public class Task implements ITask {
@Override
public IParticipant getCreator() {
return null;
return this.creator.get();
}
@Override
public void setCreator(IParticipant c) {
this.creator.set(c);
}
@Override
......
package fr.alma.gtd.server.persistence.data;
import java.util.Date;
import java.util.Set;
import javax.persistence.Basic;
......@@ -10,6 +11,7 @@ import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import fr.alma.gtd.server.core.IParticipant;
import org.hibernate.annotations.GenericGenerator;
......@@ -21,7 +23,7 @@ import org.hibernate.annotations.GenericGenerator;
@Entity
@Table(name = "UTILISATEUR")
public final class Utilisateur {
public final class Utilisateur implements IParticipant {
/**
* Identifiant de serialisation.
......@@ -62,12 +64,15 @@ public final class Utilisateur {
* Sete des projets crees par l'utilisateur (stockee dans le but d'optimiser les requetes).
*/
private Set<Project> projetsAssocies;
private Date lastModificationDate;
/**
* Le constructeur par defaut.
*/
public Utilisateur() {
super();
this.lastModificationDate = new Date();
}
/**
......@@ -210,5 +215,33 @@ public final class Utilisateur {
}
@Override
public String getPseudonym() {
return this.login;
}
@Override
public void setPseudonym(String pseudo) {
this.login = pseudo;
}
@Override
public String getServerIdentifier() {
return this.identifiantServeur;
}
@Override
public void setServerIdentifier(String idServer) {
this.identifiantServeur = idServer;
}
@Override
public Date getLastModificationDate() {
return this.lastModificationDate;
}
@Override
public void setLastModificationDate(Date lastModificationDate) {
this.lastModificationDate = lastModificationDate;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment