package haipham.webnntp.ejb.message;

import java.rmi.*;
import javax.ejb.*;
import haipham.webnntp.ejb.folder.*;

public class MessageEJB extends MessageModel implements EntityBean{
    public String ejbCreate(String id, Folder folder, 
                        String subject, String from, String body)
        throws CreateException{

        // for now, give user an option to create a message will null folder
        if ( id == null || id.equals("") 
                || subject == null || subject.equals("")
                || body == null || body.equals("")){
                //|| folder == null ){
            throw new CreateException("Invalid input");
        }

        this.messageId = id;
        this.subject = subject;
        this.from = from;
        this.plainBody = body;
        this.folder = folder;

        return null;
    }

    public void setEntityContext(EntityContext context){
        m_context = context;
    }

    public void unsetEntityContext(){
        m_context = null;
    }

    public void ejbPostCreate(String messageId, Folder folder, 
                            String subject, String from, String body){} 
                                                            
    public void ejbLoad(){}
    public void ejbStore(){}
    public void ejbRemove(){}


    public void ejbActivate(){
    }

    public void ejbPassivate(){
    }
}


