Nantes Université

Code dupliqué dans les classes Commande...Idee

public CommandeCreerIdee(final String i, final IIdee id, final CallBack<IIdee> c) {
		super();
		this.identification = i;
		this.idee = id;
		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() throws RemoteException {
		final IIdee ide = this.ideeServiceRemote.getIdeeById(this.idee.getIdentifiantServeur());
		final Utilisateur uti = this.utilisateurServiceRemote.getUtilisateurById(this.idee.getCreateur().getIdentifiantServeur());
		

Constructeurs identiques, execute() peut nécessiter l'utilisation d'un Strategy Pattern.