35edff546a3fc5c3060bbe5a01161dee857437d4.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. package com.sysmodel.listmodel.xmlmodel.impl;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import com.sysmodel.listmodel.xmlmodel.able.ActionButton;
  5. import com.sysmodel.listmodel.xmlmodel.able.FormList;
  6. import com.sysmodel.listmodel.xmlmodel.able.ListHead;
  7. import com.sysmodel.listmodel.xmlmodel.able.PramField;
  8. import com.sysmodel.listmodel.xmlmodel.able.QueryList;
  9. public class FormListImpl implements FormList, Cloneable{
  10. /*
  11. * 列表id
  12. */
  13. private String listid = "";
  14. /*
  15. * 列表的宽度
  16. */
  17. private String listWidth = "";
  18. /*
  19. * 列表页自动刷新时间,单位是分钟,如果为空值则不会自动刷新
  20. */
  21. private String refreshTime = "";
  22. /**
  23. * 引入页面的CSS,JS等
  24. */
  25. private String include = "";
  26. /**
  27. * 从URL里传过来的URL参数
  28. */
  29. private String excurl = "";
  30. /**
  31. * 从URL里传过来的URL参数
  32. */
  33. private String script = "";
  34. /*
  35. * 列表表头
  36. */
  37. private ListHead listHead = null;
  38. /*
  39. * 列表的提交操作按钮
  40. */
  41. private ArrayList<ActionButtonImpl> listAction = new ArrayList<ActionButtonImpl>();
  42. /*
  43. * 列表查询条件,由condtionEntity对象集合构成
  44. */
  45. private ArrayList<String> queryConditions = new ArrayList<String>();
  46. /*
  47. * 列表查询表
  48. */
  49. private ArrayList<String> queryTables = new ArrayList<String>();
  50. /*
  51. * 列表的查询字段
  52. */
  53. private ArrayList<QueryFieldImpl> queryFields = new ArrayList<QueryFieldImpl>();
  54. /*
  55. * 列表参数设置 由PramField对象集合构成
  56. */
  57. private ArrayList<PramFieldImpl> listPramField = new ArrayList<PramFieldImpl>();
  58. /*
  59. * 列表的列表字段
  60. */
  61. private QueryList queryList = null;
  62. /*
  63. * 所属模块
  64. */
  65. private String type;
  66. /*
  67. * 描述信息
  68. */
  69. private String description;
  70. public String getDescription() {
  71. return description;
  72. }
  73. public void setDescription(String description) {
  74. this.description = description;
  75. }
  76. public String getType() {
  77. return type;
  78. }
  79. public void setType(String type) {
  80. this.type = type;
  81. }
  82. public ArrayList<ActionButtonImpl> getListAction() {
  83. return listAction;
  84. }
  85. public void setListAction(ArrayList<ActionButtonImpl> listAction) {
  86. this.listAction = listAction;
  87. }
  88. public void addActionButton(ActionButton actionButton) {
  89. this.listAction.add((ActionButtonImpl) actionButton);
  90. }
  91. public ListHead getListHead() {
  92. return listHead;
  93. }
  94. public void setListHead(ListHead listHead) {
  95. this.listHead = listHead;
  96. }
  97. public String getListid() {
  98. return listid;
  99. }
  100. public void setListid(String listid) {
  101. this.listid = listid;
  102. }
  103. public String getListWidth() {
  104. return listWidth;
  105. }
  106. public void setListWidth(String listWidth) {
  107. this.listWidth = listWidth;
  108. }
  109. public ArrayList<QueryFieldImpl> getQueryFields() {
  110. return queryFields;
  111. }
  112. public void setQueryFields(ArrayList<QueryFieldImpl> queryFields) {
  113. this.queryFields = queryFields;
  114. }
  115. public ArrayList<PramFieldImpl> getlistPramField() {
  116. return listPramField;
  117. }
  118. public void setlistPramField(ArrayList<PramFieldImpl> listPramField) {
  119. this.listPramField = listPramField;
  120. }
  121. public String getRefreshTime() {
  122. return refreshTime;
  123. }
  124. public void setRefreshTime(String refreshTime) {
  125. this.refreshTime = refreshTime;
  126. }
  127. public QueryList getQueryList() {
  128. return queryList;
  129. }
  130. public void setQueryList(QueryList queryList) {
  131. this.queryList = queryList;
  132. }
  133. public String getColSorting() {
  134. // SysModel sysmodel = ModelFactory.getSysmodel();
  135. // List listEntitys = this.getQueryList().getListEntitys();
  136. StringBuffer sb = new StringBuffer();
  137. // for (int i = 0; i < listEntitys.size(); i++) {
  138. // ListEntity entity = (ListEntity)listEntitys.get(i);
  139. // MdpClass mdpClass =
  140. // sysmodel.getMdpClassByClassID(entity.getClassid());
  141. // List listFields = entity.getListFields();
  142. //
  143. // for (int j = 0; j < listFields.size(); j++) {
  144. //
  145. // ListField field = (ListField)listFields.get(j);
  146. //
  147. // if(field.getShowType().equals("0")){
  148. //
  149. // mdpClass = sysmodel.getMdpClassByClassID(field.getClassid());
  150. // MdpAttribute attribute =
  151. // mdpClass.getMdpAttributeByName(field.getDataName());
  152. // if(attribute.getDataType().equals(TypeUtil.DATE)){
  153. // sb.append("date,");
  154. // }else if(attribute.getDataType().equals(TypeUtil.NUMBER)){
  155. // sb.append("int,");
  156. // } else {
  157. // sb.append("str,");
  158. // }
  159. //
  160. // }else{
  161. // sb.append("str,");
  162. // }
  163. // }
  164. //
  165. // }
  166. sb.reverse();
  167. sb.deleteCharAt(0);
  168. sb.reverse();
  169. return sb.toString();
  170. }
  171. public String getColAlign() {
  172. StringBuffer listHeadBuffer = new StringBuffer();
  173. // QueryList queryList = this.getQueryList();
  174. // List listEntitys = queryList.getListEntitys();
  175. // for (int i = 0; i < listEntitys.size(); i++) {
  176. // ListEntity entity = (ListEntity)listEntitys.get(i);
  177. // List listFields = entity.getListFields();
  178. // for (int j = 0; j < listFields.size(); j++) {
  179. // ListField field = (ListField)listFields.get(j);
  180. // listHeadBuffer.append("right,");
  181. // }
  182. // }
  183. listHeadBuffer = listHeadBuffer.reverse().deleteCharAt(0);
  184. listHeadBuffer = listHeadBuffer.reverse();
  185. return listHeadBuffer.toString();
  186. }
  187. public String getInitWidths() {
  188. StringBuffer listHeadBuffer = new StringBuffer();
  189. // QueryList queryList = this.getQueryList();
  190. // List listEntitys = queryList.getListEntitys();
  191. // for (int i = 0; i < listEntitys.size(); i++) {
  192. // ListEntity entity = (ListEntity)listEntitys.get(i);
  193. // List listFields = entity.getListFields();
  194. // for (int j = 0; j < listFields.size(); j++) {
  195. // ListField field = (ListField)listFields.get(j);
  196. // listHeadBuffer.append(field.getWidth() + ",");
  197. // }
  198. // }
  199. listHeadBuffer = listHeadBuffer.reverse().deleteCharAt(0);
  200. listHeadBuffer = listHeadBuffer.reverse();
  201. return listHeadBuffer.toString();
  202. }
  203. public String getHeader() {
  204. StringBuffer listHeadBuffer = new StringBuffer();
  205. // QueryList queryList = this.getQueryList();
  206. // List listEntitys = queryList.getListEntitys();
  207. // for (int i = 0; i < listEntitys.size(); i++) {
  208. // ListEntity entity = (ListEntity)listEntitys.get(i);
  209. // List listFields = entity.getListFields();
  210. // for (int j = 0; j < listFields.size(); j++) {
  211. // ListField field = (ListField)listFields.get(j);
  212. // listHeadBuffer.append(field.getLabel() + ",");
  213. // }
  214. // }
  215. listHeadBuffer = listHeadBuffer.reverse().deleteCharAt(0);
  216. listHeadBuffer = listHeadBuffer.reverse();
  217. return listHeadBuffer.toString();
  218. }
  219. public String getColTypes() {
  220. StringBuffer listHeadBuffer = new StringBuffer();
  221. // QueryList queryList = this.getQueryList();
  222. // / List listEntitys = queryList.getListEntitys();
  223. // for (int i = 0; i < listEntitys.size(); i++) {
  224. // ListEntity entity = (ListEntity)listEntitys.get(i);
  225. // List listFields = entity.getListFields();
  226. // for (int j = 0; j < listFields.size(); j++) {
  227. // ListField field = (ListField)listFields.get(j);
  228. // if(field.getUrl()!="")
  229. // listHeadBuffer.append("link,");
  230. //
  231. // else
  232. // listHeadBuffer.append("ro,");
  233. // }
  234. // }
  235. listHeadBuffer = listHeadBuffer.reverse().deleteCharAt(0);
  236. listHeadBuffer = listHeadBuffer.reverse();
  237. return listHeadBuffer.toString();
  238. }
  239. public StringBuffer getSearchSql() {
  240. // SysModel sysmodel = ModelFactory.getSysmodel();
  241. StringBuffer sbObjectID = new StringBuffer();
  242. StringBuffer sbOther = new StringBuffer();
  243. StringBuffer sbPram = new StringBuffer();
  244. // List listEntitys = this.getQueryList().getListEntitys();
  245. // for (int i = 0; i < listEntitys.size(); i++) {
  246. // ListEntity entity = (ListEntity)listEntitys.get(i);
  247. // MdpClass mdpClass =
  248. // sysmodel.getMdpClassByClassID(entity.getClassid());
  249. // if(i==0)
  250. // sbObjectID.append(mdpClass.getName()+".FD_OBJECTID "+"FD_ID"+mdpClass.getClassid());
  251. // else
  252. // sbObjectID.append(","+mdpClass.getName()+".FD_OBJECTID "+"FD_ID"+mdpClass.getClassid());
  253. // List listFields = entity.getListFields();
  254. // for (int j = 0; j < listFields.size(); j++) {
  255. // ListField field = (ListField)listFields.get(j);
  256. // if(field.getShowType().equals("0")){
  257. // String afield = field.getDataName()+ mdpClass.getClassid();
  258. // sbOther.append(","+mdpClass.getName()+"."+
  259. // field.getDataName()+" "+afield);
  260. // }
  261. // }
  262. // }
  263. List<PramFieldImpl> listPramField = this.getlistPramField();
  264. if (listPramField != null) {
  265. for (int j = 0; j < listPramField.size(); j++) {
  266. PramField field = listPramField.get(j);
  267. sbPram.append("," + field.getValuefrom() + " pram" + j);
  268. }
  269. }
  270. StringBuffer sbSelect = new StringBuffer("select ");
  271. sbSelect.append(sbObjectID).append(sbOther).append(sbPram);
  272. sbSelect.append(" from " + this.getQueryList().getTableList());
  273. return sbSelect;
  274. }
  275. public ArrayList<String> getQueryConditions() {
  276. return queryConditions;
  277. }
  278. public void setQueryConditions(ArrayList<String> queryConditions) {
  279. this.queryConditions = queryConditions;
  280. }
  281. public ArrayList<String> getQueryTables() {
  282. return queryTables;
  283. }
  284. public void setQueryTables(ArrayList<String> queryTables) {
  285. this.queryTables = queryTables;
  286. }
  287. public Object clone() {
  288. FormListImpl o = null;
  289. ArrayList<ActionButtonImpl> tListAction = new ArrayList<ActionButtonImpl>();
  290. ArrayList<String> tQueryConditions = new ArrayList<String>();
  291. ArrayList<String> tQueryTables = new ArrayList<String>();
  292. ArrayList<QueryFieldImpl> tQueryFields = new ArrayList<QueryFieldImpl>();
  293. ArrayList<PramFieldImpl> tListPramField = new ArrayList<PramFieldImpl>();
  294. try {
  295. o = (FormListImpl) super.clone();
  296. } catch (CloneNotSupportedException e) {
  297. e.printStackTrace();
  298. }
  299. for (int i = 0; i < listAction.size(); i++) {
  300. ActionButtonImpl temp1 = (ActionButtonImpl) listAction.get(i);
  301. ActionButtonImpl temp2 = (ActionButtonImpl) temp1.clone();
  302. tListAction.add(temp2);
  303. }
  304. o.listAction = tListAction;
  305. for (int i = 0; i < queryConditions.size(); i++) {
  306. String temp1 = (String) queryConditions.get(i);
  307. tQueryConditions.add(temp1);
  308. }
  309. o.queryConditions = tQueryConditions;
  310. for (int i = 0; i < queryTables.size(); i++) {
  311. String temp1 = (String) queryTables.get(i);
  312. tQueryTables.add(temp1);
  313. }
  314. o.queryTables = tQueryTables;
  315. for (int i = 0; i < queryFields.size(); i++) {
  316. QueryFieldImpl temp1 = (QueryFieldImpl) queryFields.get(i);
  317. QueryFieldImpl temp2 = (QueryFieldImpl) temp1.clone();
  318. tQueryFields.add(temp2);
  319. }
  320. o.queryFields = tQueryFields;
  321. for (int i = 0; i < listPramField.size(); i++) {
  322. PramFieldImpl temp1 = (PramFieldImpl) listPramField.get(i);
  323. PramFieldImpl temp2 = (PramFieldImpl) temp1.clone();
  324. tListPramField.add(temp2);
  325. }
  326. o.listPramField = tListPramField;
  327. if (queryList != null)
  328. o.queryList = (QueryList) queryList.clone();
  329. return o;
  330. }
  331. public String getScript() {
  332. return script;
  333. }
  334. public void setScript(String script) {
  335. this.script = script;
  336. }
  337. public String getExcurl() {
  338. return excurl;
  339. }
  340. public void setExcurl(String excurl) {
  341. this.excurl = excurl;
  342. }
  343. public String getInclude() {
  344. return include;
  345. }
  346. public void setInclude(String include) {
  347. this.include = include;
  348. }
  349. }