package net.ihe.xcpd.init.action; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.ejb.Remove; import javax.ejb.Stateful; import javax.faces.model.SelectItem; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Destroy; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.core.ResourceBundle; /** * @author aboufahj */ @Stateful @Name("messageSwitch") @Scope(ScopeType.SESSION) public class MessageSwitch implements Serializable, MessageSwitchLocal { /** * */ private static final long serialVersionUID = 1L; public static final String GUI = "GUI"; public static final String Gazelle = "Gazelle"; private String selectedMessageOrigin = GUI; private boolean fromGUI = true; private boolean fromGazelle = false; public String getSelectedMessageOrigin() { return selectedMessageOrigin; } public void setSelectedMessageOrigin(String selectedMessageOrigin) { this.selectedMessageOrigin = selectedMessageOrigin; } public boolean isFromGUI() { return fromGUI; } public void setFromGUI(boolean fromGUI) { this.fromGUI = fromGUI; } public boolean isFromGazelle() { return fromGazelle; } public void setFromGazelle(boolean fromGazelle) { this.fromGazelle = fromGazelle; } @Remove @Destroy public void destroy() { } public List getMessagePossibleOrigins() { List items = new ArrayList(); items.add(new SelectItem(GUI, ResourceBundle.instance().getString("xcpd.WebApplication"))); items.add(new SelectItem(Gazelle, ResourceBundle.instance().getString("xcpd.GazelleDriven"))); return items; } public void selectMessageOrigin() { if (selectedMessageOrigin.equals(GUI)) { fromGUI = true; fromGazelle = false; } else { fromGUI = false; fromGazelle = true; } } }