Package org.salamanca.commands.vale

Source Code of org.salamanca.commands.vale.UtilizarVale

package org.salamanca.commands.vale;

import org.salamanca.domain.Vale;
import org.salamanca.broker.BrokerServer;
import javax.jdo.PersistenceManager;
import org.salamanca.commands.MessageException;
import java.util.Date;
import org.salamanca.commands.ICommand;

/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class UtilizarVale implements ICommand{

  Vale vale;


    public UtilizarVale(Vale vale) {
    this.vale = vale;


}


/**
* execute
*/
public void execute() throws MessageException {






    PersistenceManager pm = BrokerServer.instance().getPMF().
                            getPersistenceManager();

    pm.currentTransaction().begin();

    Vale valePM = (Vale) pm.getObjectById(javax.jdo.JDOHelper.
            getObjectId(
                    vale), true);



    valePM.setFechaUtilizacion(new Date());

    pm.currentTransaction().commit();

}

/**
* getCommandName
*
* @return String
*/
public String getCommandName() {
    return this.getClass().getName();
}

/**
* getBarDelimitedParameters
*
* @return String
*/
public String getBarDelimitedParameters() {
    return vale.getPersona().getNombre() + "|" + vale.getImporte() + "|" +
            vale.getFechaEmision();
}



}
TOP

Related Classes of org.salamanca.commands.vale.UtilizarVale

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.