# HG changeset patch # User Torsten Irländer # Date 1374664183 -7200 # Node ID 58e1ed2ddbbd6c4b6e4b878fcbf5110946b9ed9d # Parent df168246a4d20fd30f31ebc493cdde90f0653577 Restructured the Dummy Query configuration to make it more feel like the EXT configuration. diff -r df168246a4d2 -r 58e1ed2ddbbd src/main/java/de/intevation/lada/rest/QueryService.java --- a/src/main/java/de/intevation/lada/rest/QueryService.java Wed Jul 24 12:08:52 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/QueryService.java Wed Jul 24 13:09:43 2013 +0200 @@ -18,56 +18,86 @@ import de.intevation.lada.model.LOrt; class ResultConfig { - String field; - String label; - String type; + String dataIndex; + String header; + Integer flex; + Integer width; - public ResultConfig(String field, String label, String type) { - this.field = field; - this.label = label; - this.type = type; + public ResultConfig(String dataIndex, String header, Integer flex, Integer width) { + this.dataIndex= dataIndex; + this.header= header; + this.flex = flex; + this.width = width; } - /** - * @return the field - */ - public String getField() { - return field; + public ResultConfig(String dataIndex, String header, Integer flex) { + this.dataIndex= dataIndex; + this.header= header; + this.flex = flex; + this.width = null; } - /** - * @param field the field to set - */ - public void setField(String field) { - this.field = field; + public ResultConfig(String dataIndex, String header) { + this.dataIndex= dataIndex; + this.header= header; + this.flex = 0; + this.width = null; } /** - * @return the label + * @return the dataIndex */ - public String getLabel() { - return label; + public String getDataIndex() { + return dataIndex; } /** - * @param label the label to set + * @param dataIndex the dataIndex to set */ - public void setLabel(String label) { - this.label = label; + public void setDataIndex(String dataIndex) { + this.dataIndex = dataIndex; } /** - * @return the type + * @return the header */ - public String getType() { - return type; + public String getHeader() { + return header; } /** - * @param type the type to set + * @param header the header to set */ - public void setType(String type) { - this.type = type; + public void setHeader(String header) { + this.header = header; + } + + /** + * @return the width + */ + public Integer getWidth() { + return width; + } + + /** + * @param width the width to set + */ + public void setWidth(Integer width) { + this.width = width; + } + + /** + * @return the flex + */ + public Integer getFlex() { + return flex; + } + + /** + * @param flex the flex to set + */ + public void setFlex(Integer flex) { + this.flex = flex; } } @@ -204,7 +234,7 @@ if (!authentication.isAuthorizedUser(headers)) { return new Response(false, 699, new ArrayList()); } - QueryConfig queries = this.loadQueryConfig(); + List queries = this.loadQueryConfig(); Response response = new Response(true, 200, queries); return response; } @@ -213,19 +243,57 @@ } } - private QueryConfig loadQueryConfig() { - QueryConfig queryConfig = new QueryConfig(); + private List loadQueryConfig() { + List configs = new ArrayList(); + + /* Typicall available fields + {header: 'Datenbasis', dataIndex: 'datenbasisId', width: 70}, + {header: 'MPL', dataIndex: 'mplId', width: 50}, + {header: 'UWB', dataIndex: 'umwId', width: 50}, + {header: 'MMT', dataIndex: 'messmethode'}, + {header: 'HPNR', dataIndex: 'hauptprobenNr'}, + {header: 'NPNR', dataIndex: 'nebenprobenNr'}, + {header: 'E.Gemeinde', dataIndex: 'bezeichnung', flex: 1}, + {header: 'Ursprungsgemeinde', dataIndex: 'kreis', flex: 1}, + {header: 'ProbeID', dataIndex: 'probeId'}, + {header: 'MST', dataIndex: 'mstId', width: 50} + */ + /* Query 1 */ - queryConfig.setId(1); - queryConfig.setName("MST, UWB"); - queryConfig.setDescription("Das ist die Beschreibung von Abfrage 1"); - queryConfig.setSql("Select * from l_probe"); + QueryConfig qc1 = new QueryConfig(); + qc1.setId(1); + qc1.setName("MST, UWB"); + qc1.setDescription("Das ist die Beschreibung von Abfrage 1"); + qc1.setSql("Select * from l_probe"); List filters = new ArrayList(); filters.add("mst"); - queryConfig.setFilter(filters); + qc1.setFilter(filters); List results = new ArrayList(); - results.add(new ResultConfig("mst","Messstelle","string")); - queryConfig.setResults(results); - return queryConfig; + results.add(new ResultConfig("datenbasisId","Datenbases")); + results.add(new ResultConfig("mplId","MPL")); + results.add(new ResultConfig("umwId","UWB")); + results.add(new ResultConfig("messmethode","MMT")); + results.add(new ResultConfig("hauptprobenNr","HPNR")); + results.add(new ResultConfig("nebenprobenNr","NPNR")); + results.add(new ResultConfig("bezeichnung","E.Gemeinde")); + results.add(new ResultConfig("kreis","Ursprungsgemeinde")); + results.add(new ResultConfig("probeId","ProbeID")); + results.add(new ResultConfig("mstId","MS")); + qc1.setResults(results); + configs.add(qc1); + /* Query 2 */ + QueryConfig qc2 = new QueryConfig(); + qc2.setId(2); + qc2.setName("Test"); + qc2.setDescription("Das ist die Beschreibung von Abfrage 2"); + qc2.setSql("Select * from l_probe"); + List qcf2= new ArrayList(); + qcf2.add("mst"); + qc2.setFilter(qcf2); + List qcr2= new ArrayList(); + qcr2.add(new ResultConfig("mst","Messstelle")); + qc2.setResults(qcr2); + configs.add(qc2); + return configs; } }