/*
 * Copyright (c) 2003 by Hyperwave AG. All rights reserved.
 */

  /**
   * @author wputz
   */

// <JSClass>
  /**
   * Public constructor, creates an instance of the object value object.
   */
  SearchParamsVO = function(aParam) {
    if ( aParam == "__proto__" )
      return;

    this.pagingSize_          = 0;
    this.iteratorId_          = -1;
    this.freeIterator_        = false;
    this.currentPage_         = 0;
    this.sortCriteriaChanged_ = null
    this.sortCriteria_        = null
  }
  //--------------------------------------------------------------------
  // Inheritance call for JavaScript.
  class$ = doInherit (SearchParamsVO);

  //--------------------------------------------------------------------
  /**
   * Sets the pagingSize.
   *
   * @param aPagingSize: String: the pagingSize
   */
  class$.setPagingSize = function (aPagingSize)
  {
    this.pagingSize_ = aPagingSize;
  }

  //--------------------------------------------------------------------
  /**
   * Gets the pagingSize.
   *
   * @return String: the pagingSize
   */
  class$.getPagingSize = function ()
  {
    return this.pagingSize_;
  }

  //--------------------------------------------------------------------
  /**
   * Sets the iteratorId.
   *
   * @param anIteratorId: String: the iteratorId
   */
  class$.setIteratorId = function (anIteratorId)
  {
    this.iteratorId_ = anIteratorId;
  }

  //--------------------------------------------------------------------
  /**
   * Gets the iteratorId.
   *
   * @return String: the iteratorId
   */
  class$.getIteratorId = function ()
  {
    return this.iteratorId_;
  }

  //--------------------------------------------------------------------
  /**
   * Sets the freeIterator.
   *
   * @param freeIterator: String: the freeIterator
   */
  class$.setFreeIterator = function (freeIterator)
  {
    this.freeIterator_ = freeIterator;
  }

  //--------------------------------------------------------------------
  /**
   * Gets the freeIterator.
   *
   * @return String: the freeIterator
   */
  class$.getFreeIterator = function ()
  {
    return this.freeIterator_;
  }

  //--------------------------------------------------------------------
  /**
   * Sets the currentPage.
   *
   * @param theCurrentPage: String: the currentPage
   */
  class$.setCurrentPage = function (theCurrentPage)
  {
    this.currentPage_ = theCurrentPage;
  }

  //--------------------------------------------------------------------
  /**
   * Gets the currentPage.
   *
   * @return String: the currentPage
   */
  class$.getCurrentPage = function ()
  {
    return this.currentPage_;
  }

  //- <sortCriteria> -------------------------------------------------------------------
  /**
   * Sets the sortCriteria.
   *
   * @param aSortCriteria: String
   */
  class$.setSortCriteria = function (aSortCriteria)
  {
    this.sortCriteria_ = aSortCriteria;
  }

  /**
   * Gets the sortCriteria.
   *
   * @return String
   */
  class$.getSortCriteria = function ()
  {
    return this.sortCriteria_;
  }
  //- </sortCriteria> -------------------------------------------------------------------

  //- <sortCriteriaChanged> -------------------------------------------------------------------
  /**
   * Sets the sortCriteriaChanged.
   *
   * @param isSortCriteriaChanged: String
   */
  class$.setSortCriteriaChanged = function (isSortCriteriaChanged)
  {
    this.sortCriteriaChanged_ = isSortCriteriaChanged;
  }

  /**
   * Gets the sortCriteriaChanged.
   *
   * @return String
   */
  class$.getSortCriteriaChanged = function ()
  {
    return this.sortCriteriaChanged_;
  }
  //- </sortCriteriaChanged> -------------------------------------------------------------------

  //--------------------------------------------------------------------
  /**
   * Serializes the value object
   *
   * @return String: the serialization of the value object
   */
  class$.serialize = function ()
  {
    var ws = new WebSerializer();

    ws.addValue("ps",  this.pagingSize_);
    ws.addValue("ii",  this.iteratorId_);
    ws.addValue("cp",  this.currentPage_);
    ws.addValue("fi",  this.freeIterator_);
    ws.addValue("scc", this.sortCriteriaChanged_);
    ws.addValue("sc",  this.sortCriteria_);

    return ws.getString();
  }

  //--------------------------------------------------------------------
  /**
   * Serializes the value object to a javascript object
   *
   * @return object: object containing the data of the value object
   */
  class$.serializeToObject = function ()
  {
    var ret = {};

    WebSerializer.static_.setProperty(ret, "ps",  this.pagingSize_);
    WebSerializer.static_.setProperty(ret, "ii",  this.iteratorId_);
    WebSerializer.static_.setProperty(ret, "cp",  this.currentPage_);
    WebSerializer.static_.setProperty(ret, "fi",  this.freeIterator_);
    WebSerializer.static_.setProperty(ret, "scc", this.sortCriteriaChanged_);
    WebSerializer.static_.setProperty(ret, "sc",  this.sortCriteria_);

    return ret;
  }

  //--------------------------------------------------------------------
  /**
   * Creates a new SearchParamsVO from a given java script object. The object has to be generated
   * from method <code>serializeToObject()</code>
   *
   * @param theObject: object: the values for the new SearchParamsVO
   * @return SearchParamsVO: the new value object
   */
  class$.static_.createFromObject = function (theObject)
  {
    var vo = new SearchParamsVO();

    if (typeof theObject.ps!="undefined")  vo.pagingSize_          = theObject.ps;
    if (typeof theObject.ii!="undefined")  vo.iteratorId_          = theObject.ii;
    if (typeof theObject.cp!="undefined")  vo.currentPage_         = theObject.cp;
    if (typeof theObject.fi!="undefined")  vo.freeIterator_        = theObject.fi;
    if (typeof theObject.scc!="undefined") vo.sortCriteriaChanged_ = theObject.scc;
    if (typeof theObject.sc!="undefined") 
      vo.sortCriteria_ = SortCriteriaVO.static_.createFromObject( theObject.sc );

    return vo;
  }

  //--------------------------------------------------------------------
  /**
   * Deserializes the value object
   *
   * @return SearchParamsVO: the deserialized value object
   */
  class$.static_.deserialize = function (theString)
  {
    // build a new instance of the value object
    var vo = new SearchParamsVO();

    var ws = new WebSerializer(theString);

    vo.pagingSize_          = ws.getValue("ps",  "string");
    vo.iteratorId_          = ws.getValue("ii",  "string");
    vo.currentPage_         = ws.getValue("cp",  "number");
    vo.freeIterator_        = ws.getValue("fi",  "string");
    vo.sortCriteriaChanged_ = ws.getValue("scc", "string");
    vo.sortCriteria_        = ws.getValue("sc", SortCriteriaVO);

    // return the newly created value object
    return vo;
  }

// </JSClass>

