diff --git a/.classpath b/.classpath index 3b0f67c..fb26529 100644 --- a/.classpath +++ b/.classpath @@ -18,6 +18,6 @@ - + diff --git a/src-modules/module/etl/conf/etl.xml b/src-modules/module/etl/conf/etl.xml index fb11ba2..417f2eb 100644 --- a/src-modules/module/etl/conf/etl.xml +++ b/src-modules/module/etl/conf/etl.xml @@ -381,7 +381,7 @@ parent="Laderoutinen">Abfragen zur Administration - + @@ -419,7 +419,7 @@ version integer - + diff --git a/src-modules/module/etl/conf/includes.txt b/src-modules/module/etl/conf/includes.txt index 290950c..eec7122 100644 --- a/src-modules/module/etl/conf/includes.txt +++ b/src-modules/module/etl/conf/includes.txt @@ -3,4 +3,5 @@ WEB-INF/conf/edustore/db/bin/SQL_ENV_etl.sam WEB-INF/lib/superx-etl.jar images/eye.svg images/downloadblck.svg +images/resultset_up.svg diff --git a/src-modules/module/etl/masken/42000_felderinfo.unl b/src-modules/module/etl/masken/42000_felderinfo.unl index 850a54f..88ca9a8 100644 --- a/src-modules/module/etl/masken/42000_felderinfo.unl +++ b/src-modules/module/etl/masken/42000_felderinfo.unl @@ -20,4 +20,20 @@ select tid,name from qa_project where active=1 order by 2;\ select null::char(1),'Keine Auwahl möglich' from xdummy\ \ \ -/* <> */^ ^^ +/* <> */^hidden^^ +42008^Spaltenlayout^15^0^0^150^80^1^integer^200^0^1^<> --freemarker template\ +\ +\ +select 1 from xdummy where 0 < (select count(*) from db_version where his_system='rpta')\ +union select 0 from xdummy where \ + 0 = (select count(*) from db_version where his_system='rpta');\ +\ +\ +\ +<#if RPTA_installed==1>\ +select tid,caption from rpta_column_layout order by 2;\ +<#else>\ +select null::char(1),'Keine Auwahl möglich' from xdummy\ +\ +\ +/* <> */^hidden^^ diff --git a/src-modules/module/etl/masken/42000_masken_felder_bez.unl b/src-modules/module/etl/masken/42000_masken_felder_bez.unl index cf98a24..1f92673 100644 --- a/src-modules/module/etl/masken/42000_masken_felder_bez.unl +++ b/src-modules/module/etl/masken/42000_masken_felder_bez.unl @@ -6,3 +6,4 @@ 42000^42005^ 42000^42006^ 42000^42007^ +42000^42008^ diff --git a/src-modules/module/etl/schluesseltabellen/create_load_etl_qa_project.sql b/src-modules/module/etl/schluesseltabellen/create_load_etl_qa_project.sql index e1ed224..71f5f7c 100644 --- a/src-modules/module/etl/schluesseltabellen/create_load_etl_qa_project.sql +++ b/src-modules/module/etl/schluesseltabellen/create_load_etl_qa_project.sql @@ -1,6 +1,6 @@ --Freemarker Template ---used in etl-job sx_insert_mask +--used in etl-job qa_project_upload <#if SQLdialect='Postgres'> drop table if exists tmp_etl_qa_project; drop table if exists tmp_etl_sachgeb_sichtarten; diff --git a/src-modules/module/etl/schluesseltabellen/create_load_etl_rpta_column_layout.sql b/src-modules/module/etl/schluesseltabellen/create_load_etl_rpta_column_layout.sql new file mode 100644 index 0000000..68e315a --- /dev/null +++ b/src-modules/module/etl/schluesseltabellen/create_load_etl_rpta_column_layout.sql @@ -0,0 +1,68 @@ +--Freemarker Template + +--used in etl-job qa_project_upload +<#if SQLdialect='Postgres'> +drop table if exists tmp_rpta_resultset; +drop table if exists tmp_etl_rpta_column_layout; +drop table if exists tmp_rpta_column; +drop table if exists tmp_rpta_column2layout; + + + +CREATE TABLE tmp_rpta_resultset ( + tid integer, + caption character varying(255), + uniquename character varying(255), + fieldclause text, + joinclause text, + whereclause text, + systeminfo_id integer, + is_virtual smallint +); + + +CREATE TABLE tmp_etl_rpta_column_layout ( + tid integer, + uniquename character varying(255), + caption character varying(255), + resultset_id integer, + whereclause text, + description text, + userinfo_id integer, + sortnr integer, + sortclause text, + is_virtual smallint, + resultset_uniquename character varying(255) +); + +CREATE TABLE tmp_rpta_column ( + tid integer, + uniquename character varying(255), + caption character varying(255), + srcfieldname character varying(255), + column_type integer, + col_function text, + is_aggregate smallint, + resultset_id integer, + custom integer, + description text, + targetfieldname character varying(255) +); + + +CREATE TABLE tmp_rpta_column2layout ( + tid integer, + column_id integer, + layout_id integer, + sortnr smallint, + is_visible smallint, + visible_size smallint, + targetfieldname character varying(255), + caption character varying(255), + description text, + format_code character varying(255), + format_code_id integer +); + + + diff --git a/src-modules/module/etl/schluesseltabellen/etl_manager_tab.unl b/src-modules/module/etl/schluesseltabellen/etl_manager_tab.unl index 95da8bf..be21f5c 100644 --- a/src-modules/module/etl/schluesseltabellen/etl_manager_tab.unl +++ b/src-modules/module/etl/schluesseltabellen/etl_manager_tab.unl @@ -1,3 +1,4 @@ 1^MASK^Masken^0^sx_select_mask^sx_insert_mask^TID^42000^42006^1^ 2^SICHT^Sichten^0^sichten_unload^sichten_upload^SYSTEMINFO_ID^42000^42004^1^ 3^QA_PROJECT^Testfälle^0^qa_project_unload^qa_project_upload^QA_PROJECT_ID^42000^42007^1^ +4^RPTA_COLUMN_LAYOUT^Spaltenlayouts^0^rpta_column_layout_unload^rpta_column_layout_upload^RPTA_COLUMN_LAYOUT_TID^42000^42008^1^ diff --git a/src-modules/module/etl/schluesseltabellen/etl_step_fuellen.sql b/src-modules/module/etl/schluesseltabellen/etl_step_fuellen.sql index 5cf0f51..0eb01fe 100644 --- a/src-modules/module/etl/schluesseltabellen/etl_step_fuellen.sql +++ b/src-modules/module/etl/schluesseltabellen/etl_step_fuellen.sql @@ -10,7 +10,9 @@ {"uniquename":"sichten_unload", "name":"Sichten entladen", "systeminfo_id":270 ,"logfile":""}, {"uniquename":"sichten_upload", "name":"Sichten hochladen", "systeminfo_id":270 ,"logfile":""}, {"uniquename":"sos_gewichtung_unload", "name":"Gewichtungen entladen", "systeminfo_id":270 ,"logfile":""}, - {"uniquename":"qa_project_unload", "name":"Testfallprojekte entladen", "systeminfo_id":260 ,"logfile":""} + {"uniquename":"qa_project_unload", "name":"Testfallprojekte entladen", "systeminfo_id":260 ,"logfile":""}, + {"uniquename":"rpta_column_layout_unload", "name":"Spaltenlayout entladen", "systeminfo_id":330 ,"logfile":""}, + {"uniquename":"rpta_column_layout_upload", "name":"Spaltenlayout hochladen", "systeminfo_id":330 ,"logfile":""} ] /> @@ -40,6 +42,15 @@ {"etl_job":"qa_project_unload","param_name":"QA_PROJECT_ID", "name":"Testfall-Projekt", "param_default":""}, {"etl_job":"qa_project_unload","param_name":"PATH_TO_OUTPUTFILE", "name":"Ausgabedatei", "param_default":"$SUPERX_DIR/db/masken/qa_project_$QA_PROJECT_ID.xml"}, {"etl_job":"qa_project_unload","param_name":"FORMAT", "name":"Ausgabeformat", "param_default":"XML"}, + + {"etl_job":"rpta_column_layout_unload","param_name":"RPTA_COLUMN_LAYOUT_TID", "name":"Spaltenlayout", "param_default":""}, + {"etl_job":"rpta_column_layout_unload","param_name":"PATH_TO_OUTPUTFILE", "name":"Ausgabedatei", "param_default":"$SUPERX_DIR/db/masken/rpta_column_layout_$RPTA_COLUMN_LAYOUT_UNIQUENAME.xml"}, + {"etl_job":"rpta_column_layout_unload","param_name":"FORMAT", "name":"Ausgabeformat", "param_default":"XML"}, + + {"etl_job":"rpta_column_layout_upload","param_name":"SYSTEMINFO_ID", "name":"Komponente", "param_default":""}, + {"etl_job":"rpta_column_layout_upload","param_name":"RPTA_COLUMN_LAYOUT_TID", "name":"ID", "param_default":""}, + {"etl_job":"rpta_column_layout_upload","param_name":"PATH_TO_INPUTFILE", "name":"Eingabedatei", "param_default":""}, + {"etl_job":"rpta_column_layout_upload","param_name":"FORMAT", "name":"Format", "param_default":"XML"}, {"etl_job":"sos_gewichtung_unload","param_name":"SYSTEMINFO_ID", "name":"Komponente", "param_default":""}, {"etl_job":"sos_gewichtung_unload","param_name":"PATH_TO_OUTPUTFILE", "name":"Ausgabedatei", "param_default":"$SUPERX_DIR/db/db/module/sos/schluesseltabellen/sichten_$SYSTEMINFO_ID.xml"}, @@ -108,8 +119,20 @@ {"etl_job":"qa_project_unload", "uniquename":"unload_qa_dbtest2project_tab", "name":"DB-Test zu Projekt entladen", "type":"UNLOAD", "parent":"qa_project_unload_ges"}, {"etl_job":"qa_project_unload", "uniquename":"unload_qa_mask_execution_tab", "name":"Masken-Tests entladen", "type":"UNLOAD", "parent":"qa_project_unload_ges"}, {"etl_job":"qa_project_unload", "uniquename":"unload_qa_mask_execution_assert_tab", "name":"Masken-Test Erwartungen entladen", "type":"UNLOAD", "parent":"qa_project_unload_ges"}, - {"etl_job":"qa_project_unload", "uniquename":"unload_qa_mask_execution2project_tab", "name":"Masken-Test zu Projekt entladen", "type":"UNLOAD", "parent":"qa_project_unload_ges"} - + {"etl_job":"qa_project_unload", "uniquename":"unload_qa_mask_execution2project_tab", "name":"Masken-Test zu Projekt entladen", "type":"UNLOAD", "parent":"qa_project_unload_ges"}, + + {"etl_job":"rpta_column_layout_unload", "uniquename":"rpta_column_layout_unload_ges", "name":"Spaltenlayout-Projekt entladen", "type":"MSG"}, + {"etl_job":"rpta_column_layout_unload", "uniquename":"unload_rpta_resultset_tab", "name":"Resultset entladen", "type":"UNLOAD", "parent":"rpta_column_layout_unload_ges"}, + {"etl_job":"rpta_column_layout_unload", "uniquename":"unload_rpta_column_layout_tab", "name":"Spaltenlayout entladen", "type":"UNLOAD", "parent":"rpta_column_layout_unload_ges"}, + {"etl_job":"rpta_column_layout_unload", "uniquename":"unload_rpta_column_tab", "name":"Spalten entladen", "type":"UNLOAD", "parent":"rpta_column_layout_unload_ges"}, + {"etl_job":"rpta_column_layout_unload", "uniquename":"unload_rpta_column2layout_tab", "name":"Spalten zu Layout entladen", "type":"UNLOAD", "parent":"rpta_column_layout_unload_ges"}, + + {"etl_job":"rpta_column_layout_upload", "uniquename":"create_tmp_rpta_column_layout", "name":"Tabelle tmp_rpta_column_layout erzeugen", "type":"DOSQL" }, + {"etl_job":"rpta_column_layout_upload", "uniquename":"upload_rpta_resultset_tab", "name":"tmp_rpta_resultset hochladen", "type":"LOAD" }, + {"etl_job":"rpta_column_layout_upload", "uniquename":"upload_rpta_column_layout_tab", "name":"tmp_rpta_column_layout hochladen", "type":"LOAD" }, + {"etl_job":"rpta_column_layout_upload", "uniquename":"upload_rpta_column_tab", "name":"tmp_rpta_column hochladen", "type":"LOAD" }, + {"etl_job":"rpta_column_layout_upload", "uniquename":"upload_rpta_column2layout_tab", "name":"tmp_rpta_column2layout hochladen", "type":"LOAD" }, + {"etl_job":"rpta_column_layout_upload", "uniquename":"trans_rpta_column_layout", "name":"rpta_column_layout füllen", "type":"DOSQL" } ] /> <#assign etl_step_properties = [ @@ -202,14 +225,42 @@ {"etl_step":"unload_sos_gewichtung_ges","prop_name":"msg", "prop_value":"Entlade Gewichtungen Komponente $SYSTEMINFO_ID" }, {"etl_step":"unload_sos_gewichtung","prop_name":"select_stmt", "prop_value":" SELECT art, ch35_ang_abschluss, fach_nr, kz_fach, text, faktor FROM sos_gewichtung where ch35_ang_abschluss in (''B5'',''B6'',''B7'',''B8'',''M3'',''M4'',''M7'',''M8'') and art=''vzae'' order by 1,2,3,4,5 ;" }, - {"etl_step":"unload_qa_project","prop_name":"msg", "prop_value":"Entlade Testfall-Projekt $QA_PROJECT_ID Stammdaten" }, + {"etl_step":"qa_project_unload_ges","prop_name":"msg", "prop_value":"Entlade Testfall-Projekt $QA_PROJECT_ID Stammdaten" }, {"etl_step":"unload_qa_project_tab","prop_name":"select_stmt", "prop_value":"SELECT uniquename, name, systeminfo_id, sachgebiete_id, active, created_from, issue_link FROM qa_project where tid= $QA_PROJECT_ID order by 1;" }, {"etl_step":"unload_qa_resultset_tab","prop_name":"select_stmt", "prop_value":"SELECT R.uniquename, R.name, R.systeminfo_id, R.fromclause, R.fieldclause, R.groupbyclause, R.orderbyclause FROM qa_resultset R where R.tid in (select distinct T.resultset_id from qa_dbtest T, qa_dbtest2project P where P.dbtest_id=T.tid and P.project_id= $QA_PROJECT_ID ) order by 1;" }, {"etl_step":"unload_qa_dbtest_tab","prop_name":"select_stmt", "prop_value":"SELECT T.uniquename,T.name,T.systeminfo_id,R.uniquename as resultset_uniquename,T.whereclause,T.description,T.active from qa_dbtest T,qa_resultset R where R.tid=T.resultset_id and T.tid in (select P.dbtest_id from qa_dbtest2project P where P.project_id= $QA_PROJECT_ID ) order by 1;" }, {"etl_step":"unload_qa_dbtest_assertion_tab","prop_name":"select_stmt", "prop_value":"SELECT T.uniquename as dbtest_uniquename,A.rownr,A.def_col_caption,A.def_col_name,A.def_col_value,A.def_col_function from qa_dbtest T, qa_dbtest_assertion A where A.dbtest_id=T.tid and T.tid in (select P.dbtest_id from qa_dbtest2project P where P.project_id= $QA_PROJECT_ID ) order by 1;" }, {"etl_step":"unload_qa_dbtest2project_tab","prop_name":"select_stmt", "prop_value":"SELECT T.uniquename as dbtest_uniquename,P.uniquename as project_uniquename,DP.issue_id FROM qa_dbtest2project DP, qa_dbtest T, qa_project P where DP.dbtest_id=T.tid and DP.project_id=P.tid and DP.project_id= $QA_PROJECT_ID order by 1;" }, + {"etl_step":"unload_rpta_column_layout_ges","prop_name":"msg", "prop_value":"Entlade Spaltenlayout $RPTA_COLUMN_LAYOUT_TID Stammdaten" }, + {"etl_step":"unload_rpta_resultset_tab","prop_name":"select_stmt", "prop_value":"SELECT R.* from rpta_resultset R where R.tid in (select L.resultset_id from rpta_column_layout L where L.tid= $RPTA_COLUMN_LAYOUT_TID ) order by 1;" }, + {"etl_step":"unload_rpta_column_layout_tab","prop_name":"select_stmt", "prop_value":"SELECT L.*,R.uniquename as resultset_uniquename from rpta_column_layout L, rpta_resultset R where R.tid=L.resultset_id and L.tid= $RPTA_COLUMN_LAYOUT_TID order by 1;" }, + {"etl_step":"unload_rpta_column_tab","prop_name":"select_stmt", "prop_value":"select * from rpta_column where tid in (select column_id from rpta_column2layout L where L.layout_id = $RPTA_COLUMN_LAYOUT_TID ) order by 1;" }, + {"etl_step":"unload_rpta_column2layout_tab","prop_name":"select_stmt", "prop_value":"select * from rpta_column2layout L where L.layout_id = $RPTA_COLUMN_LAYOUT_TID order by 1;" }, + + {"etl_step":"create_tmp_rpta_column_layout","prop_name":"PATH_TO_INPUTFILE", "prop_value":"$SUPERX_DIR/db/module/etl/schluesseltabellen/create_load_etl_rpta_column_layout.sql" }, + {"etl_step":"upload_rpta_resultset_tab","prop_name":"target_table", "prop_value":"tmp_rpta_resultset" }, + {"etl_step":"upload_rpta_resultset_tab","prop_name":"format", "prop_value":"xml" }, + {"etl_step":"upload_rpta_resultset_tab","prop_name":"search_path", "prop_value":"/etlAction/unload [@name=\"unload_rpta_resultset_tab\"]/rs/row" }, + {"etl_step":"upload_rpta_resultset_tab","prop_name":"path_to_inputfile", "prop_value":"$PATH_TO_INPUTFILE" }, + + {"etl_step":"upload_rpta_column_layout_tab","prop_name":"target_table", "prop_value":"tmp_etl_rpta_column_layout" }, + {"etl_step":"upload_rpta_column_layout_tab","prop_name":"format", "prop_value":"xml" }, + {"etl_step":"upload_rpta_column_layout_tab","prop_name":"search_path", "prop_value":"/etlAction/unload [@name=\"unload_rpta_column_layout_tab\"]/rs/row" }, + {"etl_step":"upload_rpta_column_layout_tab","prop_name":"path_to_inputfile", "prop_value":"$PATH_TO_INPUTFILE" }, + + {"etl_step":"upload_rpta_column_tab","prop_name":"target_table", "prop_value":"tmp_rpta_column" }, + {"etl_step":"upload_rpta_column_tab","prop_name":"format", "prop_value":"xml" }, + {"etl_step":"upload_rpta_column_tab","prop_name":"search_path", "prop_value":"/etlAction/unload [@name=\"unload_rpta_column_tab\"]/rs/row" }, + {"etl_step":"upload_rpta_column_tab","prop_name":"path_to_inputfile", "prop_value":"$PATH_TO_INPUTFILE" }, + + {"etl_step":"upload_rpta_column2layout_tab","prop_name":"target_table", "prop_value":"tmp_rpta_column2layout" }, + {"etl_step":"upload_rpta_column2layout_tab","prop_name":"format", "prop_value":"xml" }, + {"etl_step":"upload_rpta_column2layout_tab","prop_name":"search_path", "prop_value":"/etlAction/unload [@name=\"unload_rpta_column2layout_tab\"]/rs/row" }, + {"etl_step":"upload_rpta_column2layout_tab","prop_name":"path_to_inputfile", "prop_value":"$PATH_TO_INPUTFILE" }, + {"etl_step":"trans_rpta_column_layout","prop_name":"PATH_TO_INPUTFILE", "prop_value":"$SUPERX_DIR/db/module/etl/schluesseltabellen/trans_rpta_column_layout.sql" }, + {"etl_step":"unload_qa_mask_execution_tab","prop_name":"select_stmt", "prop_value":"SELECT E.name,E.userinfo_id,E.maskeninfo_id,E.is_active,E.stylesheet_id,E.contenttype,E.output_filename,E.systeminfo_id,E.uniquename FROM qa_mask_execution E where E.tid in (select P.mask_execution_id from qa_mask_execution2project P where P.project_id= $QA_PROJECT_ID ) order by 1;" }, {"etl_step":"unload_qa_mask_execution_assert_tab","prop_name":"select_stmt", "prop_value":"SELECT E.uniquename,A.rownr,A.colnr,A.result_value_min,A.result_value_max,A.is_active,A.caption FROM qa_mask_execution E, qa_mask_execution_assert A where E.tid=A.mask_execution_id and E.tid in (select P.mask_execution_id from qa_mask_execution2project P where P.project_id= $QA_PROJECT_ID ) order by 1;" }, {"etl_step":"unload_qa_mask_execution2project_tab","prop_name":"select_stmt", "prop_value":"SELECT E.uniquename as mask_execution_uniquename,P.uniquename as project_uniquename,DP.issue_id FROM qa_mask_execution2project DP, qa_mask_execution E, qa_project P where DP.mask_execution_id=E.tid and DP.project_id=P.tid and DP.project_id= $QA_PROJECT_ID order by 1;" } diff --git a/src-modules/module/etl/schluesseltabellen/trans_rpta_column_layout.sql b/src-modules/module/etl/schluesseltabellen/trans_rpta_column_layout.sql new file mode 100644 index 0000000..085863f --- /dev/null +++ b/src-modules/module/etl/schluesseltabellen/trans_rpta_column_layout.sql @@ -0,0 +1,40 @@ +--freemarker template +<#include "SQL_lingua_franca"/> +<#include "SuperX_general"/> +<#include "RPTA-Makros"/> + + + +select uniquename, +caption, +resultset_uniquename as rpta_resultset, +whereclause, +description, +sortclause, +is_virtual +from tmp_etl_rpta_column_layout; + + +select C.uniquename, +null::varchar(255) as caption, +C.caption as caption_der_spalte, +L.caption as caption_in_ergebnistabelle, +C.srcfieldname, +C.targetfieldname, +T.uniquename as column_type, +C.col_function, +L.is_visible, +L.visible_size, +C.is_aggregate, +null::varchar(255) as description, +L.format_code, +C.description as description_der_spalte, +L.description as description_in_ergebnistabelle +from tmp_rpta_column C, tmp_rpta_column2layout L, rpta_column_type T +where L.column_id=C.tid +and T.tid=C.column_type + + + + +<@rpta_column_layout_fuellen /> diff --git a/src/de/superx/elt/EtlFmParser.java b/src/de/superx/elt/EtlFmParser.java new file mode 100644 index 0000000..50a1177 --- /dev/null +++ b/src/de/superx/elt/EtlFmParser.java @@ -0,0 +1,137 @@ +package de.superx.elt; +import static de.superx.servlet.SxSQL_Server.DEFAULT_MANDANTEN_ID; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.DatabaseMetaData; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.logging.Level; +import java.util.logging.Logger; + +import de.memtext.db.ConnectionCreator; +import de.memtext.util.DateUtils; +import de.memtext.util.GetOpts; +import de.memtext.util.StringUtils; +import de.superx.common.DBServletException; +import de.superx.common.FieldContainer; +import de.superx.common.Sichten; +import de.superx.common.StandaloneSicht; +import de.superx.common.SuperX_el; +import de.superx.common.SxResultRow; +import de.superx.common.SxResultSet; +import de.superx.common.SxSqlHelper; +import de.superx.common.SxUser; +import de.superx.common.TableFieldExists; +import de.superx.common.TemplateProcessor; +import de.superx.servlet.SuperXManager; +import de.superx.servlet.SxPools; +import de.superx.servlet.SxSQL_Server; +import de.superx.util.PropsReader; +import de.superx.util.SqlStringUtils; + +public class EtlFmParser extends TemplateProcessor { + private String dbprop, infile, outfile; + private Properties props; + + private Statement stm; + private String isSimpleParser; + private static String sqlDialect; + + EtlFmParser(String mandantenID, Connection con) { + super(mandantenID,con); + + } + + + + private void initConAndParser() throws IOException, SQLException, + ClassNotFoundException { + + stm = con.createStatement(); + if(SqlStringUtils.tableExists(con,"fm_templates",DEFAULT_MANDANTEN_ID)) + { + setTemplates(readFromDb("select trim(both from id),content from fm_templates")); + repositoryToMap(readFromDb(REPOSITORY_SELECT), repositoryMap); + } + if(SqlStringUtils.tableExists(con,"konstanten",DEFAULT_MANDANTEN_ID)) + { + SxResultSet rs = readFromDb("select trim(both from beschreibung),apnr from konstanten"); + for (Iterator it = rs.iterator(); it.hasNext();) { + SxResultRow row = (SxResultRow) it.next(); + String beschreibung = (String) row.get(0); + + repositoryMap.put("K_" + beschreibung.trim(), row.get(1)); + } + } + } + + + + protected SxResultSet readFromDb(String sql) throws SQLException { + SuperX_el el = new SuperX_el(); + + SxSqlHelper sh=new SxSqlHelper(); + sh.execute(sql, this.con, el); + + + if (el.getError_String() != null + && !el.getError_String().trim().equals("")) + throw new SQLException("\nProblem bei:" + "\n\n Meldung:" + + el.getError_String() + "\n sql:" + sql); + + return el.getResultSet(); + + + } + + + + + + + + + /* + * Einfacher Parser für Fremddatenbanken, nur sqlDialect wird übergeben wird + * von DOSQL direkt aufgerufen + */ + public String simpleParser( String input) + throws FileNotFoundException, IOException, Exception { + String output = ""; + sqlDialect = "Postgres";// de.superx.util.SqlStringUtils.getSqlDialect(props .getProperty("driverName")); + initConAndParser(); + HashMap map = new HashMap(); + try { + output = "--automatically created by SuperX/Freemarker for " + + sqlDialect + + " (" + + DateUtils.getTodayString() + + " " + + DateUtils.getNowString() + + ")\n" + + process("FM-Parsing ", input, map, + sqlDialect); + + } catch (Exception e) { + System.err.println("Fehler beim FM-Parsen "); + e.printStackTrace(); + System.exit(1); + } + return output; + + } + + } + + // Created on 08.12.2006 at 18:03:46 + + + diff --git a/src/de/superx/elt/SqlExecutor.java b/src/de/superx/elt/SqlExecutor.java index 439d804..370a8d2 100644 --- a/src/de/superx/elt/SqlExecutor.java +++ b/src/de/superx/elt/SqlExecutor.java @@ -252,7 +252,11 @@ public class SqlExecutor { else { //Kommandozeile: TODO hier sind noch keine FM Scripte mit SQLVAR möglich: - sqlScript=FMParser.simpleParser(mySxConnection.getPropfile(), sqlScript); + //FMParser myParser=new FMParser() + Connection con = mySxConnection.getConnection(); + EtlFmParser myParser=new EtlFmParser("default",con); + + sqlScript=myParser.simpleParser(sqlScript); } String keepGenerated=System.getProperty("FreemarkerKeepGenerated"); if(keepGenerated!=null && keepGenerated.equalsIgnoreCase("true")) diff --git a/superx/WEB-INF/lib/superx-etl.jar b/superx/WEB-INF/lib/superx-etl.jar index dffd3b2..9e37524 100644 Binary files a/superx/WEB-INF/lib/superx-etl.jar and b/superx/WEB-INF/lib/superx-etl.jar differ diff --git a/superx/images/resultset_up.svg b/superx/images/resultset_up.svg new file mode 100644 index 0000000..cd63395 --- /dev/null +++ b/superx/images/resultset_up.svg @@ -0,0 +1,63 @@ + + + + + + + + + + image/svg+xml + + + + + + + + +