Package er.jquerymobile.exampleapp.businessLogic

Source Code of er.jquerymobile.exampleapp.businessLogic.SampleComponentBase

package er.jquerymobile.exampleapp.businessLogic;

import webobjectsexamples.businesslogic.eo.Movie;
import webobjectsexamples.businesslogic.eo.Talent;

import com.webobjects.appserver.WOActionResults;
import com.webobjects.appserver.WOContext;
import com.webobjects.foundation.NSArray;
import com.webobjects.foundation.NSRange;

import er.extensions.components.ERXComponent;
import er.extensions.eof.ERXEC;
import er.jquerymobile.exampleapp.components.SampleOneMovie;

@SuppressWarnings("serial")
public class SampleComponentBase extends ERXComponent {

  //********************************************************************
  //  Constructor
  //********************************************************************

  public SampleComponentBase(WOContext aContext) {
    super(aContext);
  }

  //********************************************************************
  //  Demo Methods
  //********************************************************************

  public NSArray<Talent> talents() {
    return Talent.fetchAllTalents(ERXEC.newEditingContext(), Talent.FIRST_NAME.asc().array());
  }

  public void setOneTalent(Talent oneTalent) {
    _oneTalent = oneTalent;
  }
  public Talent oneTalent() {
    return _oneTalent;
  }
  private Talent _oneTalent;

  public NSArray<Movie> movies() {
    return Movie.fetchAllMovies(ERXEC.newEditingContext(), Movie.TITLE.asc().array());
  }

  public NSArray<Movie> onlyFiveMovies() {
    NSRange range = new NSRange(0, 5);
    return movies().subarrayWithRange(range);
  }

  public void setOneMovie(Movie oneMovie) {
    _oneMovie = oneMovie;
  }
  public Movie oneMovie() {
    return _oneMovie;
  }
  private Movie _oneMovie;

  //********************************************************************
  //  Action
  //********************************************************************

  public WOActionResults doShowOneMovieAction() {
    SampleOneMovie nextPage = pageWithName(SampleOneMovie.class);
    nextPage.setOneMovie(oneMovie());
    return nextPage;
  }

  public WOActionResults doShowOneTalentAction() {
    SampleOneMovie nextPage = pageWithName(SampleOneMovie.class);
    nextPage.setOneTalent(oneTalent());
    return nextPage;
  }

}
TOP

Related Classes of er.jquerymobile.exampleapp.businessLogic.SampleComponentBase

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.