package org.salamanca.commands.user;
import org.salamanca.commands.ICommand;
import org.salamanca.domain.User;
import org.salamanca.broker.BrokerServer;
import javax.jdo.PersistenceManager;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class EliminarUsuario implements ICommand{
User user;
/**
* InsertarUsuario
*
* @param user User
*/
public EliminarUsuario(User user) {
this.user=user;
}
/**
* getCommandName
*
* @return String
*/
public String getCommandName() {
return this.getClass().getName();
}
/**
* getBarDelimitedParameters
*
* @return String
*/
public String getBarDelimitedParameters() {
return user.getName();
}
/**
* execute
*/
public void execute() {
PersistenceManager pm = BrokerServer.instance().getPMF().
getPersistenceManager();
pm.currentTransaction().begin();
User userPM= (User)pm.getObjectById(javax.jdo.JDOHelper.getObjectId(user),true);
pm.deletePersistent(userPM);
pm.currentTransaction().commit();
}
}