123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411 |
- package com.sysmodel.listmodel.xmlmodel.impl;
- import java.util.ArrayList;
- import java.util.List;
- import com.sysmodel.listmodel.xmlmodel.able.ActionButton;
- import com.sysmodel.listmodel.xmlmodel.able.FormList;
- import com.sysmodel.listmodel.xmlmodel.able.ListHead;
- import com.sysmodel.listmodel.xmlmodel.able.PramField;
- import com.sysmodel.listmodel.xmlmodel.able.QueryList;
- public class FormListImpl implements FormList, Cloneable{
- /*
- * 列表id
- */
- private String listid = "";
- /*
- * 列表的宽度
- */
- private String listWidth = "";
- /*
- * 列表页自动刷新时间,单位是分钟,如果为空值则不会自动刷新
- */
- private String refreshTime = "";
- /**
- * 引入页面的CSS,JS等
- */
- private String include = "";
- /**
- * 从URL里传过来的URL参数
- */
- private String excurl = "";
- /**
- * 从URL里传过来的URL参数
- */
- private String script = "";
- /*
- * 列表表头
- */
- private ListHead listHead = null;
- /*
- * 列表的提交操作按钮
- */
- private ArrayList<ActionButtonImpl> listAction = new ArrayList<ActionButtonImpl>();
- /*
- * 列表查询条件,由condtionEntity对象集合构成
- */
- private ArrayList<String> queryConditions = new ArrayList<String>();
- /*
- * 列表查询表
- */
- private ArrayList<String> queryTables = new ArrayList<String>();
- /*
- * 列表的查询字段
- */
- private ArrayList<QueryFieldImpl> queryFields = new ArrayList<QueryFieldImpl>();
- /*
- * 列表参数设置 由PramField对象集合构成
- */
- private ArrayList<PramFieldImpl> listPramField = new ArrayList<PramFieldImpl>();
- /*
- * 列表的列表字段
- */
- private QueryList queryList = null;
- /*
- * 所属模块
- */
- private String type;
- /*
- * 描述信息
- */
- private String description;
- public String getDescription() {
- return description;
- }
- public void setDescription(String description) {
- this.description = description;
- }
- public String getType() {
- return type;
- }
- public void setType(String type) {
- this.type = type;
- }
- public ArrayList<ActionButtonImpl> getListAction() {
- return listAction;
- }
- public void setListAction(ArrayList<ActionButtonImpl> listAction) {
- this.listAction = listAction;
- }
- public void addActionButton(ActionButton actionButton) {
- this.listAction.add((ActionButtonImpl) actionButton);
- }
- public ListHead getListHead() {
- return listHead;
- }
- public void setListHead(ListHead listHead) {
- this.listHead = listHead;
- }
- public String getListid() {
- return listid;
- }
- public void setListid(String listid) {
- this.listid = listid;
- }
- public String getListWidth() {
- return listWidth;
- }
- public void setListWidth(String listWidth) {
- this.listWidth = listWidth;
- }
- public ArrayList<QueryFieldImpl> getQueryFields() {
- return queryFields;
- }
- public void setQueryFields(ArrayList<QueryFieldImpl> queryFields) {
- this.queryFields = queryFields;
- }
- public ArrayList<PramFieldImpl> getlistPramField() {
- return listPramField;
- }
- public void setlistPramField(ArrayList<PramFieldImpl> listPramField) {
- this.listPramField = listPramField;
- }
- public String getRefreshTime() {
- return refreshTime;
- }
- public void setRefreshTime(String refreshTime) {
- this.refreshTime = refreshTime;
- }
- public QueryList getQueryList() {
- return queryList;
- }
- public void setQueryList(QueryList queryList) {
- this.queryList = queryList;
- }
- public String getColSorting() {
- // SysModel sysmodel = ModelFactory.getSysmodel();
- // List listEntitys = this.getQueryList().getListEntitys();
- StringBuffer sb = new StringBuffer();
- // for (int i = 0; i < listEntitys.size(); i++) {
- // ListEntity entity = (ListEntity)listEntitys.get(i);
- // MdpClass mdpClass =
- // sysmodel.getMdpClassByClassID(entity.getClassid());
- // List listFields = entity.getListFields();
- //
- // for (int j = 0; j < listFields.size(); j++) {
- //
- // ListField field = (ListField)listFields.get(j);
- //
- // if(field.getShowType().equals("0")){
- //
- // mdpClass = sysmodel.getMdpClassByClassID(field.getClassid());
- // MdpAttribute attribute =
- // mdpClass.getMdpAttributeByName(field.getDataName());
- // if(attribute.getDataType().equals(TypeUtil.DATE)){
- // sb.append("date,");
- // }else if(attribute.getDataType().equals(TypeUtil.NUMBER)){
- // sb.append("int,");
- // } else {
- // sb.append("str,");
- // }
- //
- // }else{
- // sb.append("str,");
- // }
- // }
- //
- // }
- sb.reverse();
- sb.deleteCharAt(0);
- sb.reverse();
- return sb.toString();
- }
- public String getColAlign() {
- StringBuffer listHeadBuffer = new StringBuffer();
- // QueryList queryList = this.getQueryList();
- // List listEntitys = queryList.getListEntitys();
- // for (int i = 0; i < listEntitys.size(); i++) {
- // ListEntity entity = (ListEntity)listEntitys.get(i);
- // List listFields = entity.getListFields();
- // for (int j = 0; j < listFields.size(); j++) {
- // ListField field = (ListField)listFields.get(j);
- // listHeadBuffer.append("right,");
- // }
- // }
- listHeadBuffer = listHeadBuffer.reverse().deleteCharAt(0);
- listHeadBuffer = listHeadBuffer.reverse();
- return listHeadBuffer.toString();
- }
- public String getInitWidths() {
- StringBuffer listHeadBuffer = new StringBuffer();
- // QueryList queryList = this.getQueryList();
- // List listEntitys = queryList.getListEntitys();
- // for (int i = 0; i < listEntitys.size(); i++) {
- // ListEntity entity = (ListEntity)listEntitys.get(i);
- // List listFields = entity.getListFields();
- // for (int j = 0; j < listFields.size(); j++) {
- // ListField field = (ListField)listFields.get(j);
- // listHeadBuffer.append(field.getWidth() + ",");
- // }
- // }
- listHeadBuffer = listHeadBuffer.reverse().deleteCharAt(0);
- listHeadBuffer = listHeadBuffer.reverse();
- return listHeadBuffer.toString();
- }
- public String getHeader() {
- StringBuffer listHeadBuffer = new StringBuffer();
- // QueryList queryList = this.getQueryList();
- // List listEntitys = queryList.getListEntitys();
- // for (int i = 0; i < listEntitys.size(); i++) {
- // ListEntity entity = (ListEntity)listEntitys.get(i);
- // List listFields = entity.getListFields();
- // for (int j = 0; j < listFields.size(); j++) {
- // ListField field = (ListField)listFields.get(j);
- // listHeadBuffer.append(field.getLabel() + ",");
- // }
- // }
- listHeadBuffer = listHeadBuffer.reverse().deleteCharAt(0);
- listHeadBuffer = listHeadBuffer.reverse();
- return listHeadBuffer.toString();
- }
- public String getColTypes() {
- StringBuffer listHeadBuffer = new StringBuffer();
- // QueryList queryList = this.getQueryList();
- // / List listEntitys = queryList.getListEntitys();
- // for (int i = 0; i < listEntitys.size(); i++) {
- // ListEntity entity = (ListEntity)listEntitys.get(i);
- // List listFields = entity.getListFields();
- // for (int j = 0; j < listFields.size(); j++) {
- // ListField field = (ListField)listFields.get(j);
- // if(field.getUrl()!="")
- // listHeadBuffer.append("link,");
- //
- // else
- // listHeadBuffer.append("ro,");
- // }
- // }
- listHeadBuffer = listHeadBuffer.reverse().deleteCharAt(0);
- listHeadBuffer = listHeadBuffer.reverse();
- return listHeadBuffer.toString();
- }
- public StringBuffer getSearchSql() {
- // SysModel sysmodel = ModelFactory.getSysmodel();
- StringBuffer sbObjectID = new StringBuffer();
- StringBuffer sbOther = new StringBuffer();
- StringBuffer sbPram = new StringBuffer();
- // List listEntitys = this.getQueryList().getListEntitys();
- // for (int i = 0; i < listEntitys.size(); i++) {
- // ListEntity entity = (ListEntity)listEntitys.get(i);
- // MdpClass mdpClass =
- // sysmodel.getMdpClassByClassID(entity.getClassid());
- // if(i==0)
- // sbObjectID.append(mdpClass.getName()+".FD_OBJECTID "+"FD_ID"+mdpClass.getClassid());
- // else
- // sbObjectID.append(","+mdpClass.getName()+".FD_OBJECTID "+"FD_ID"+mdpClass.getClassid());
- // List listFields = entity.getListFields();
- // for (int j = 0; j < listFields.size(); j++) {
- // ListField field = (ListField)listFields.get(j);
- // if(field.getShowType().equals("0")){
- // String afield = field.getDataName()+ mdpClass.getClassid();
- // sbOther.append(","+mdpClass.getName()+"."+
- // field.getDataName()+" "+afield);
- // }
- // }
- // }
- List<PramFieldImpl> listPramField = this.getlistPramField();
- if (listPramField != null) {
- for (int j = 0; j < listPramField.size(); j++) {
- PramField field = listPramField.get(j);
- sbPram.append("," + field.getValuefrom() + " pram" + j);
- }
- }
- StringBuffer sbSelect = new StringBuffer("select ");
- sbSelect.append(sbObjectID).append(sbOther).append(sbPram);
- sbSelect.append(" from " + this.getQueryList().getTableList());
- return sbSelect;
- }
- public ArrayList<String> getQueryConditions() {
- return queryConditions;
- }
- public void setQueryConditions(ArrayList<String> queryConditions) {
- this.queryConditions = queryConditions;
- }
- public ArrayList<String> getQueryTables() {
- return queryTables;
- }
- public void setQueryTables(ArrayList<String> queryTables) {
- this.queryTables = queryTables;
- }
- public Object clone() {
- FormListImpl o = null;
- ArrayList<ActionButtonImpl> tListAction = new ArrayList<ActionButtonImpl>();
- ArrayList<String> tQueryConditions = new ArrayList<String>();
- ArrayList<String> tQueryTables = new ArrayList<String>();
- ArrayList<QueryFieldImpl> tQueryFields = new ArrayList<QueryFieldImpl>();
- ArrayList<PramFieldImpl> tListPramField = new ArrayList<PramFieldImpl>();
- try {
- o = (FormListImpl) super.clone();
- } catch (CloneNotSupportedException e) {
- e.printStackTrace();
- }
- for (int i = 0; i < listAction.size(); i++) {
- ActionButtonImpl temp1 = (ActionButtonImpl) listAction.get(i);
- ActionButtonImpl temp2 = (ActionButtonImpl) temp1.clone();
- tListAction.add(temp2);
- }
- o.listAction = tListAction;
- for (int i = 0; i < queryConditions.size(); i++) {
- String temp1 = (String) queryConditions.get(i);
- tQueryConditions.add(temp1);
- }
- o.queryConditions = tQueryConditions;
- for (int i = 0; i < queryTables.size(); i++) {
- String temp1 = (String) queryTables.get(i);
- tQueryTables.add(temp1);
- }
- o.queryTables = tQueryTables;
- for (int i = 0; i < queryFields.size(); i++) {
- QueryFieldImpl temp1 = (QueryFieldImpl) queryFields.get(i);
- QueryFieldImpl temp2 = (QueryFieldImpl) temp1.clone();
- tQueryFields.add(temp2);
- }
- o.queryFields = tQueryFields;
- for (int i = 0; i < listPramField.size(); i++) {
- PramFieldImpl temp1 = (PramFieldImpl) listPramField.get(i);
- PramFieldImpl temp2 = (PramFieldImpl) temp1.clone();
- tListPramField.add(temp2);
- }
- o.listPramField = tListPramField;
- if (queryList != null)
- o.queryList = (QueryList) queryList.clone();
- return o;
- }
- public String getScript() {
- return script;
- }
- public void setScript(String script) {
- this.script = script;
- }
- public String getExcurl() {
- return excurl;
- }
- public void setExcurl(String excurl) {
- this.excurl = excurl;
- }
- public String getInclude() {
- return include;
- }
- public void setInclude(String include) {
- this.include = include;
- }
- }
|