package org.opengroupware.jope.appserver;

import org.opengroupware.jope.foundation.NSObject;

public abstract class WOAction extends NSObject {

  protected WOContext context;
  
  public WOAction(WOContext _ctx) {
    this.context = _ctx;
  }
  
  /* accessors */
  
  public WOContext context() {
    return this.context;
  }
  public WORequest request() {
    return this.context.request();
  }
  
  /* sessions */
  
  public WOSession existingSession() {
    return this.context.hasSession() ? this.context.session() : null;
  }

  public WOSession session() {
    return this.context.session();
  }

  /* pages */
  
  public WOComponent pageWithName(String _pageName) {
    return this.context.application().pageWithName(_pageName, this.context);
  }
  
  /* actions */
  
  public abstract WOActionResults performActionNamed(String _name);
  
}
