/**
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 *
 * Copyright (C)
 * <a href="http://www.inab.org">Spanish National Institute of Bioinformatics (INB)</a>
 * <a href="http://www.bsc.es">Barcelona Supercomputing Center (BSC)</a>
 * <a href="http://inb.bsc.es">Computational Node 6</a>
 */

package org.inb.lsae;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

@XmlType(name = "")
@XmlRootElement(name = "state_changed")
public class StateChanged implements Event
{
    public static enum STATE {created, running, completed, terminated_by_request, terminated_by_error};
    
    protected STATE previousState;
    protected STATE newState;

    @XmlAttribute(name = "previous_state")
    public STATE getPreviousState()
    {
        if (previousState == null)
        {
            return STATE.created;
        }
        else
        {
            return previousState;
        }
    }

    public void setPreviousState(STATE previousState)
    {
        this.previousState = previousState;
    }

    @XmlAttribute(name = "new_state")
    public STATE getNewState()
    {
        if (newState == null)
        {
            return STATE.created;
        }
        else
        {
            return newState;
        }
    }

    public void setNewState(STATE newState)
    {
        this.newState = newState;
    }
}
