Commit da8cc7b4 authored by sunye's avatar sunye
Browse files

Simplify command behavior for Tag creation

parent 1a750cbb
package fr.alma.gtd.server.main.commande;
import fr.alma.gtd.server.main.donnees.Tag;
import fr.alma.gtd.server.persistence.data.Utilisateur;
import fr.alma.gtd.server.persistence.sessions.ITagServiceRemote;
import fr.alma.gtd.server.persistence.sessions.IUtilisateurServiceRemote;
......@@ -54,23 +55,11 @@ public final class CommandeCreerTag implements Commande {
this.identification = i;
this.tag = t;
this.callback = c;
final Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
try {
final Context context = new InitialContext(env);
this.tagServiceRemote = (ITagServiceRemote) context.lookup("TagService/local");
this.utilisateurServiceRemote = (IUtilisateurServiceRemote) context.lookup("UtilisateurService/local");
} catch (NamingException e) {
e.printStackTrace();
}
}
@Override
public void execute() {
Tag newTag = new Tag(tag);
}
}
......@@ -63,23 +63,11 @@ public final class CommandeEnvoyerContexte implements Commande {
this.contexte = c;
this.mode = m;
this.callback = ca;
final Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
try {
final Context context = new InitialContext(env);
this.contexteServiceRemote = (IContexteServiceRemote) context.lookup("ContexteService/local");
this.utilisateurServiceRemote = (IUtilisateurServiceRemote) context.lookup("UtilisateurService/local");
} catch (NamingException e) {
e.printStackTrace();
}
}
@Override
public void execute() {
// TODO
}
}
......@@ -63,24 +63,12 @@ public final class CommandeEnvoyerIdee implements Commande {
this.idee = i;
this.mode = m;
this.callback = c;
final Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
try {
final Context context = new InitialContext(env);
this.ideeServiceRemote = (IIdeeServiceRemote) context.lookup("IdeeService/local");
this.utilisateurServiceRemote = (IUtilisateurServiceRemote) context.lookup("UtilisateurService/local");
} catch (NamingException e) {
e.printStackTrace();
}
}
@Override
public void execute() {
// TODO
}
}
......@@ -63,23 +63,12 @@ public final class CommandeEnvoyerProjet implements Commande {
this.projet = p;
this.mode = m;
this.callback = c;
final Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
try {
final Context context = new InitialContext(env);
this.projetServiceRemote = (IProjetServiceRemote) context.lookup("ProjetService/local");
this.utilisateurServiceRemote = (IUtilisateurServiceRemote) context.lookup("UtilisateurService/local");
} catch (NamingException e) {
e.printStackTrace();
}
}
@Override
public void execute() {
// TODO
}
......
......@@ -63,23 +63,12 @@ public final class CommandeEnvoyerTache implements Commande {
this.tache = t;
this.mode = m;
this.callback = c;
final Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
try {
final Context context = new InitialContext(env);
this.tacheServiceRemote = (ITacheServiceRemote) context.lookup("TacheService/local");
this.utilisateurServiceRemote = (IUtilisateurServiceRemote) context.lookup("UtilisateurService/local");
} catch (NamingException e) {
e.printStackTrace();
}
}
@Override
public void execute() {
// TODO
}
......
......@@ -62,23 +62,12 @@ public final class CommandeEnvoyerTag implements Commande {
this.tag = t;
this.mode = m;
this.callback = c;
final Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
try {
final Context context = new InitialContext(env);
this.tagServiceRemote = (ITagServiceRemote) context.lookup("TagService/local");
this.utilisateurServiceRemote = (IUtilisateurServiceRemote) context.lookup("UtilisateurService/local");
} catch (NamingException e) {
e.printStackTrace();
}
}
@Override
public void execute() {
// TODO
}
......
......@@ -8,7 +8,8 @@ public class CommandeSupprimerCompte implements Commande {
@Override
public void execute() {
// TODO
}
}
......@@ -56,22 +56,12 @@ public final class CommandeSupprimerContexte implements Commande {
this.contexte = c;
this.callback = ca;
final Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
try {
final Context context = new InitialContext(env);
this.contexteServiceRemote = (IContexteServiceRemote) context.lookup("ContexteService/local");
this.utilisateurServiceRemote = (IUtilisateurServiceRemote) context.lookup("UtilisateurService/local");
} catch (NamingException e) {
e.printStackTrace();
}
}
@Override
public void execute() {
// TODO
}
}
......@@ -56,23 +56,12 @@ public final class CommandeSupprimerIdee implements Commande {
this.identification = ii;
this.idee = i;
this.callback = c;
final Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
try {
final Context context = new InitialContext(env);
this.ideeServiceRemote = (IIdeeServiceRemote) context.lookup("IdeeService/local");
this.utilisateurServiceRemote = (IUtilisateurServiceRemote) context.lookup("UtilisateurService/local");
} catch (NamingException e) {
e.printStackTrace();
}
}
@Override
public void execute() {
// TODO
}
......
......@@ -54,23 +54,12 @@ public final class CommandeSupprimerProjet implements Commande {
this.identification = i;
this.projet = p;
this.callback = c;
final Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
try {
final Context context = new InitialContext(env);
this.projetServiceRemote = (IProjetServiceRemote) context.lookup("ProjetService/local");
this.utilisateurServiceRemote = (IUtilisateurServiceRemote) context.lookup("UtilisateurService/local");
} catch (NamingException e) {
e.printStackTrace();
}
}
@Override
public void execute() {
// TODO
}
......
......@@ -55,22 +55,12 @@ public final class CommandeSupprimerTache implements Commande {
this.tache = t;
this.callback = c;
final Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
try {
final Context context = new InitialContext(env);
this.tacheServiceRemote = (ITacheServiceRemote) context.lookup("TacheService/local");
this.utilisateurServiceRemote = (IUtilisateurServiceRemote) context.lookup("UtilisateurService/local");
} catch (NamingException e) {
e.printStackTrace();
}
}
@Override
public void execute() {
// TODO
}
......
......@@ -56,22 +56,12 @@ public final class CommandeSupprimerTag implements Commande {
this.tag = t;
this.callback = c;
final Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
try {
final Context context = new InitialContext(env);
this.tagServiceRemote = (ITagServiceRemote) context.lookup("TagService/local");
this.utilisateurServiceRemote = (IUtilisateurServiceRemote) context.lookup("UtilisateurService/local");
} catch (NamingException e) {
e.printStackTrace();
}
}
@Override
public void execute() {
// TODO
}
......
......@@ -18,7 +18,8 @@ public class CommandeTelechargeArchive implements Commande {
@Override
public void execute() {
// TODO
}
}
......@@ -18,7 +18,8 @@ public class CommandeTelechargeCalendrier implements Commande {
@Override
public void execute() {
// TODO
}
}
......@@ -70,6 +70,7 @@ public final class CommandeTelechargeContextes implements Commande {
@Override
public void execute() {
// TODO
}
......
......@@ -16,7 +16,8 @@ public class CommandeTelechargeIdees implements Commande {
@Override
public void execute() {
// TODO
}
}
......@@ -17,7 +17,8 @@ public class CommandeTelechargeInbox implements Commande {
@Override
public void execute() {
// TODO
}
}
......@@ -19,7 +19,8 @@ public class CommandeTelechargeLog implements Commande {
@Override
public void execute() {
// TODO
}
}
package fr.alma.gtd.server.main.donnees;
import fr.alma.gtd.server.core.IParticipant;
import fr.alma.gtd.server.core.ITag;
import java.util.Date;
public class Tag implements ITag {
private String id;
private char[] nom;
public Tag() {}
public Tag(ITag autre) {
id = autre.getIdentifiantServeur();
nom = autre.getNom().toCharArray();
}
@Override
public String getIdentifiantServeur() {
return id;
}
@Override
public void setIdentifiantServeur(String idServeur) {
id = idServeur;
}
@Override
public Date getDateDeDerniereModification() {
return null;
}
@Override
public void setDateDeDerniereModification(Date dateDerniereModification) {
}
@Override
public String getNom() {
return String.valueOf(nom);
}
@Override
public void setNom(String n) {
nom = n.toCharArray();
}
@Override
public IParticipant getCreateur() {
return null;
}
@Override
public void setCreateur(IParticipant c) {
}
}
package fr.alma.gtd.server.main.donnees;
import junit.framework.TestCase;
public class TagTest extends TestCase {
public void testGetNom() {
Tag tag = new Tag();
tag.setNom("Un nom");
assert "Un nom".equals(tag.getNom());
}
}
\ No newline at end of file
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