/*
* 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.jsp;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.tagext.TagSupport;
import com.adaptrex.core.view.StoreComponent;
@SuppressWarnings("serial")
public class JSPStoreComponent extends TagSupport {
@Override
public int doStartTag() {
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
StoreComponent storeComponent = new StoreComponent(
request,
this.table,
this.factory,
this.namespace != null ? this.namespace : this.ns
);
storeComponent
.applyModelName(this.modelname)
.applyInline(this.inline)
.applyRest(this.rest)
.applyAutoLoad(this.autoload)
.applyStart(this.start)
.applyPageSize(this.pagesize)
.applyInclude(this.include)
.applyExclude(this.exclude)
.applyAssociations(this.associations)
.applyWhere(this.where)
.applyParams(this.params)
.applyFilters(this.filter)
.applySorters(this.sort)
.applyGroupers(this.group)
.applyBuffered(this.buffered)
.applyTrailingBufferZone(this.trailingbufferzone)
.applyLeadingBufferZone(this.leadingbufferzone)
.applyPurgePageCount(this.purgepagecount)
.applyClearOnPageLoad(this.clearonpageload)
.applyClearRemovedOnLoad(this.clearremovedonload)
.applyAutoSync(this.autosync)
.applyRemoteGroup(this.remotegroup)
.applyRemoteSort(this.remotesort)
.applyRemoteFilter(this.remotefilter)
.applySortOnFilter(this.sortonfilter)
;
try {
pageContext.getOut().write(storeComponent.getJavaScript());
} catch (Exception e) {
throw new RuntimeException(e);
}
return SKIP_BODY;
}
private String ns;
public void setNs(String val) {
this.ns = val;
}
private String namespace;
public void setNamespace(String val) {
this.namespace = val;
}
private String factory;
public void setFactory(String val) {
this.factory = val;
}
private String table;
public void setTable(String val) {
this.table = val;
}
private String modelname;
public void setModelname(String val) {
this.modelname = val;
}
private String include;
public void setInclude(String val) {
this.include = val;
}
private String exclude;
public void setExclude(String val) {
this.exclude = val;
}
private String associations;
public void setAssociations(String val) {
this.associations = val;
}
private Boolean clearonpageload;
public void setClearonpageload(Boolean val) {
this.clearonpageload = val;
}
private Boolean clearremovedonload;
public void setClearremovedonload(Boolean val) {
this.clearremovedonload = val;
}
private Boolean autosync;
public void setAutosync(Boolean val) {
this.autosync = val;
}
private Boolean autoload;
public void setAutoload(Boolean val) {
this.autoload = val;
}
private Boolean remotegroup;
public void setRemotegroup(Boolean val) {
this.remotegroup = val;
}
private Boolean remotesort;
public void setRemotesort(Boolean val) {
this.remotesort = val;
}
private Boolean remotefilter;
public void setRemotefilter(Boolean val) {
this.remotefilter = val;
}
private Boolean sortonfilter;
public void setSortonfilter(Boolean val) {
this.sortonfilter = val;
}
private Boolean buffered;
public void setBuffered(Boolean val) {
this.buffered = val;
}
private Integer trailingbufferzone;
public void setTrailingbufferzone(Integer val) {
this.trailingbufferzone = val;
}
private Integer leadingbufferzone;
public void setLeadingbufferzone(Integer val) {
this.leadingbufferzone = val;
}
private Integer purgepagecount;
public void setPurgepagecount(Integer val) {
this.purgepagecount = val;
}
private Integer start;
public void setStart(Integer val) {
this.start = val;
}
private Integer pagesize;
public void setPagesize(Integer val) {
this.pagesize = val;
}
private String where;
public void setWhere(String val) {
this.where = val;
}
private String params;
public void setParams(String val) {
this.params = val;
}
private String filter;
public void setFilter(String val) {
this.filter = val;
}
private String group;
public void setGroup(String val) {
this.group = val;
}
private String sort;
public void setSort(String val) {
this.sort = val;
}
private Boolean inline;
public void setInline(Boolean val) {
this.inline = val;
}
private String rest;
public void setRest(String val) {
this.rest = val;
}
}