Package com.adaptrex.core.view.tapestry.components

Source Code of com.adaptrex.core.view.tapestry.components.Store

/*
* Copyright 2012 Adaptrex, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.adaptrex.core.view.tapestry.components;

import javax.servlet.http.HttpServletRequest;

import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.RequestGlobals;

import com.adaptrex.core.view.StoreComponent;

public class Store {

  @Inject  private RequestGlobals requestGlobals;
 
  @Parameter @Property private String ns;
  @Parameter @Property private String namespace;
 
  @Parameter @Property private String factory;
  @Parameter @Property private String table;
  @Parameter @Property private String modelname;
  @Parameter @Property private Boolean clearonpageload;
  @Parameter @Property private Boolean clearremovedonload;
  @Parameter @Property private Boolean autosync;
  @Parameter @Property private Boolean autoload;
  @Parameter @Property private Boolean remotegroup;
  @Parameter @Property private Boolean remotesort;
  @Parameter @Property private Boolean remotefilter;
  @Parameter @Property private Boolean sortonfilter;
  @Parameter @Property private Boolean buffered;
  @Parameter @Property private Integer trailingbufferone;
  @Parameter @Property private Integer leadingbufferzone;
  @Parameter @Property private Integer purgepagecount;
  @Parameter @Property private Boolean inline;
  @Parameter @Property private String where;
  @Parameter @Property private String params;
  @Parameter @Property private String filter;
  @Parameter @Property private String group;
  @Parameter @Property private String sort;
  @Parameter @Property private Integer start;
  @Parameter @Property private Integer pagesize;
  @Parameter @Property private Object rest;
  @Parameter @Property private String include;
  @Parameter @Property private String exclude;
  @Parameter @Property private String associations;
 
  public String getBody() throws Exception {
    HttpServletRequest request = requestGlobals.getHTTPServletRequest();

    StoreComponent storeComponent = new StoreComponent(
        request,
        table,
        factory,
        namespace != null ? namespace : ns
      );
    storeComponent
    .applyModelName(modelname)
   
    .applyInline(inline)
    .applyRest(rest)
    .applyAutoLoad(autoload)
   
    .applyStart(start)
    .applyPageSize(pagesize)
   
    .applyInclude(include)
    .applyExclude(exclude)
    .applyAssociations(associations)
   
    .applyWhere(where)
    .applyParams(params)
    .applyFilters(filter)
   
    .applySorters(sort)
    .applyGroupers(group)
   
    .applyBuffered(buffered)
    .applyTrailingBufferZone(trailingbufferone)
    .applyLeadingBufferZone(leadingbufferzone)
    .applyPurgePageCount(purgepagecount)
   
    .applyClearOnPageLoad(clearonpageload)
    .applyClearRemovedOnLoad(clearremovedonload)
    .applyAutoSync(autosync)
    .applyRemoteGroup(remotegroup)
    .applyRemoteSort(remotesort)
    .applyRemoteFilter(remotefilter)
    .applySortOnFilter(sortonfilter)
    ;

   
    return storeComponent.getJavaScript();
  }
}
TOP

Related Classes of com.adaptrex.core.view.tapestry.components.Store

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.