Browse Source

Unload Job sos_gewichtung #1

etl_0.4_Release
Daniel Quathamer 1 year ago
parent
commit
8bd3b5b7e7
  1. 6
      .classpath
  2. 36
      src-modules/module/etl/schluesseltabellen/etl_step_fuellen.sql
  3. 112
      src/de/superx/etl/bin/SxTransformer.java
  4. BIN
      superx/WEB-INF/lib/superx-etl.jar

6
.classpath

@ -8,5 +8,11 @@
<classpathentry kind="lib" path="/kern/superx/WEB-INF/lib/saxon-he-10.5.jar"/> <classpathentry kind="lib" path="/kern/superx/WEB-INF/lib/saxon-he-10.5.jar"/>
<classpathentry kind="lib" path="/kern/superx/WEB-INF/lib_ext/servlet-api.jar"/> <classpathentry kind="lib" path="/kern/superx/WEB-INF/lib_ext/servlet-api.jar"/>
<classpathentry kind="lib" path="/kern/superx/WEB-INF/lib/jersey-core-1.11.jar"/> <classpathentry kind="lib" path="/kern/superx/WEB-INF/lib/jersey-core-1.11.jar"/>
<classpathentry kind="lib" path="/kern/superx/WEB-INF/lib/fop-2.2.jar"/>
<classpathentry kind="lib" path="/kern/superx/WEB-INF/lib/spring-jdbc-3.0.3.RELEASE.jar"/>
<classpathentry kind="lib" path="/kern/superx/WEB-INF/lib/kettle-core-6.0.0.0-353.jar"/>
<classpathentry kind="lib" path="/kern/superx/WEB-INF/lib/log4j-core-2.16.0.jar"/>
<classpathentry kind="lib" path="/kern/superx/WEB-INF/lib/log4j-1.2-api-2.16.0.jar"/>
<classpathentry kind="lib" path="/kern/superx/WEB-INF/lib/log4j-api-2.16.0.jar"/>
<classpathentry kind="output" path="superx/WEB-INF/classes"/> <classpathentry kind="output" path="superx/WEB-INF/classes"/>
</classpath> </classpath>

36
src-modules/module/etl/schluesseltabellen/etl_step_fuellen.sql

@ -4,9 +4,11 @@
<#assign etl_jobs = [ <#assign etl_jobs = [
{"uniquename":"sx_select_mask", "name":"Maske entladen", "systeminfo_id":9 ,"logfile":""}, {"uniquename":"sx_select_mask", "name":"Maske entladen", "systeminfo_id":270 ,"logfile":""},
{"uniquename":"sx_insert_mask", "name":"Maske hochladen", "systeminfo_id":9 ,"logfile":""}, {"uniquename":"sx_insert_mask", "name":"Maske hochladen", "systeminfo_id":270 ,"logfile":""},
{"uniquename":"kern_konstanten_update", "name":"Konstanten aktualisieren", "systeminfo_id":9 ,"logfile":""} {"uniquename":"kern_konstanten_update", "name":"Konstanten aktualisieren", "systeminfo_id":270 ,"logfile":""},
{"uniquename":"sichten_unload", "name":"Sichten entladen", "systeminfo_id":270 ,"logfile":""},
{"uniquename":"sos_gewichtung_unload", "name":"Gewichtungen entladen", "systeminfo_id":270 ,"logfile":""}
] /> ] />
@ -21,8 +23,15 @@
{"etl_job":"sx_insert_mask","param_name":"FORMAT", "name":"Format", "param_default":"XML"}, {"etl_job":"sx_insert_mask","param_name":"FORMAT", "name":"Format", "param_default":"XML"},
{"etl_job":"kern_konstanten_update","param_name":"SUPERX_DIR", "name":"Superx-Pfad zu WEB-INF/conf/edustore", "param_default":"$WEBAPP/WEB-INF/conf/edustore"}, {"etl_job":"kern_konstanten_update","param_name":"SUPERX_DIR", "name":"Superx-Pfad zu WEB-INF/conf/edustore", "param_default":"$WEBAPP/WEB-INF/conf/edustore"},
{"etl_job":"kern_konstanten_update","param_name":"PATH_TO_INPUTFILE", "name":"Eingabepfad", "param_default":"$SUPERX_DIR/db/install/schluesseltabellen/kern_feste_konstanten_fuellen.sql"} {"etl_job":"kern_konstanten_update","param_name":"PATH_TO_INPUTFILE", "name":"Eingabepfad", "param_default":"$SUPERX_DIR/db/install/schluesseltabellen/kern_feste_konstanten_fuellen.sql"},
{"etl_job":"sichten_unload","param_name":"SYSTEMINFO_ID", "name":"Komponente", "param_default":""},
{"etl_job":"sichten_unload","param_name":"PATH_TO_OUTPUTFILE", "name":"Ausgabedatei", "param_default":"$SUPERX_DIR/db/masken/sichten_$SYSTEMINFO_ID.xml"},
{"etl_job":"sichten_unload","param_name":"FORMAT", "name":"Ausgabeformat", "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"},
{"etl_job":"sos_gewichtung_unload","param_name":"FORMAT", "name":"Ausgabeformat", "param_default":"XML"}
] /> ] />
@ -53,7 +62,15 @@
{"etl_job":"sx_insert_mask", "uniquename":"delete_maske_system_bez", "name":"maske_system_bez löschen", "type":"DOQUERY" }, {"etl_job":"sx_insert_mask", "uniquename":"delete_maske_system_bez", "name":"maske_system_bez löschen", "type":"DOQUERY" },
{"etl_job":"sx_insert_mask", "uniquename":"upload_maske_system_bez", "name":"maske_system_bez hochladen", "type":"LOAD" }, {"etl_job":"sx_insert_mask", "uniquename":"upload_maske_system_bez", "name":"maske_system_bez hochladen", "type":"LOAD" },
{"etl_job":"kern_konstanten_update", "uniquename":"kern_konstanten_update", "name":"Kern Konstanten aktualisieren", "type":"DOSQL" } {"etl_job":"kern_konstanten_update", "uniquename":"kern_konstanten_update", "name":"Kern Konstanten aktualisieren", "type":"DOSQL" },
{"etl_job":"sichten_unload", "uniquename":"unload_sichten_ges", "name":"Sichten entladen", "type":"MSG"},
{"etl_job":"sichten_unload", "uniquename":"unload_sichtentab", "name":"Sichten entladen", "type":"UNLOAD", "parent":"unload_sichten_ges"},
{"etl_job":"sichten_unload", "uniquename":"unload_sichten_sachgeb", "name":"Sachgebiete von Sichtarten entladen", "type":"UNLOAD", "parent":"unload_sichten_ges"},
{"etl_job":"sos_gewichtung_unload", "uniquename":"unload_sos_gewichtung_ges", "name":"Gewichtungen entladen", "type":"MSG"},
{"etl_job":"sos_gewichtung_unload", "uniquename":"unload_sos_gewichtung", "name":"Gewichtungen entladen", "type":"UNLOAD", "parent":"unload_sos_gewichtung_ges"}
] /> ] />
@ -98,7 +115,14 @@
{"etl_step":"upload_maske_system_bez","prop_name":"search_path", "prop_value":"/etlAction/unload [@name=\"unload_maske_system_bez\"]/rs/row" }, {"etl_step":"upload_maske_system_bez","prop_name":"search_path", "prop_value":"/etlAction/unload [@name=\"unload_maske_system_bez\"]/rs/row" },
{"etl_step":"upload_maske_system_bez","prop_name":"path_to_inputfile", "prop_value":"$PATH_TO_INPUTFILE" }, {"etl_step":"upload_maske_system_bez","prop_name":"path_to_inputfile", "prop_value":"$PATH_TO_INPUTFILE" },
{"etl_step":"kern_konstanten_update","prop_name":"path_to_inputfile", "prop_value":"$PATH_TO_INPUTFILE" } {"etl_step":"kern_konstanten_update","prop_name":"path_to_inputfile", "prop_value":"$PATH_TO_INPUTFILE" },
{"etl_step":"unload_sichten_ges","prop_name":"msg", "prop_value":"Entlade Sichten Komponente $SYSTEMINFO_ID" },
{"etl_step":"unload_sichtentab","prop_name":"select_stmt", "prop_value":"SELECT S.systeminfoid,S.art,S.type,S.name_intern,S.name,S.sortnr,S.quelle,S.standbutton FROM sichten S where S.systeminfoid= $SYSTEMINFO_ID and position(''<#'' in quelle) =0 order by art,sortnr ,name;" },
{"etl_step":"unload_sichten_sachgeb","prop_name":"select_stmt", "prop_value":"SELECT A.sichtart,A.sachgebiete_id FROM sachgeb_sichtarten A where A.sichtart in (select distinct S.art from sichten S where S.systeminfoid= $SYSTEMINFO_ID) order by 1,2;" },
{"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 ;" }

112
src/de/superx/etl/bin/SxTransformer.java

@ -35,13 +35,6 @@ import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamSource;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopConfParser;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.FopFactoryBuilder;
import org.apache.fop.apps.MimeConstants;
import org.jfor.jfor.converter.Converter;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import de.superx.bin.SxDBUtils; import de.superx.bin.SxDBUtils;
@ -371,114 +364,9 @@ public class SxTransformer {
} }
} }
if (methode.equals("pdf")) { //Sichern um zurücksetzen zu können.
Level logLevel = myLogger.getParent().getLevel();
myLogger.getParent().setLevel(Level.SEVERE);
// configure fopFactory as desired
//akt. Pfad muss WEB-INF sein oder vorher als -fopxconf Param übergeben worden sein
FopFactory fopFactory ;
FOUserAgent foUserAgent;
// in fop.xconf fopFactory.setSourceResolution(96); // =96dpi (dots/pixels per Inch)
if (fopxconfFile==null)
fopxconfFile=new File ("conf" + File.separator + "fop.xconf");
if (!fopxconfFile.exists())
{
String msg=fopxconfFile.getAbsolutePath()+" nicht gefunden";
System.out.println(msg);
throw new IllegalStateException(msg);
}
FopConfParser parser = new FopConfParser(fopxconfFile); //parsing configuration
FopFactoryBuilder builder = parser.getFopFactoryBuilder(); //building the factory with the user options
String fa=fopxconfFile.getCanonicalPath();
URI uri=new File(fa).getParentFile().getParentFile().toURI();
// System.out.println(uri);
builder.setBaseURI(uri);
builder.setStrictFOValidation(false);
fopFactory = builder.build();
foUserAgent = fopFactory.newFOUserAgent();
try {
myOutputStream = new java.io.FileOutputStream(outfile);
} catch (FileNotFoundException e) {
myLogger.severe("Ausgabedatei " + outfile + " kann nicht erzeugt werden:" + e.toString());
System.exit(-1);
}
try {
// Construct fop with desired output format
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, myOutputStream);
// Setup input for XSLT transformation
Source src = new StreamSource(quellstring);
// Resulting SAX events (the generated FO) must be piped through to FOP
Result res = new SAXResult(fop.getDefaultHandler());
// Start XSLT transformation and FOP processing
try {
transformer.transform(src, res);
System.out.println("Success!");
} catch (TransformerException ex) {
throw new Exception(ex);
}
} catch (Exception e) {
e.printStackTrace(System.err);
myLogger.severe("FOP-Transformation Fehler: " + e.toString());
} finally {
myOutputStream.close();
myLogger.getParent().setLevel(logLevel);
}
} else {
if (methode.equals("rtf")) {
String zielstring = "";
myLogger.info("Ausgabedatei " + outfile + " vorbereiten");
Writer myWriter = null;
try {
myWriter = new BufferedWriter(new FileWriter(outfile));
} catch (IOException e) {
e.printStackTrace();
}
try {
myLogger.info("Transformiere nach fo ");
transformer.transform(new javax.xml.transform.stream.StreamSource(quellstring), new StreamResult("tmp.fo"));
myLogger.info("Transformiere nach rtf ");
new Converter(new InputSource("tmp.fo"), myWriter, Converter.createConverterOption());
} catch (Exception e1) {
e1.printStackTrace();
}
} else {
if (methode.equals("xls")) {
} else {
//Normal xml Transformation, not fop or rtf
try {
FileWriter myFile = new FileWriter(outfile);
myOutwriter = new PrintWriter(myFile);
transformer.transform(new javax.xml.transform.stream.StreamSource(quellstring), new javax.xml.transform.stream.StreamResult(myOutwriter));
} catch (IOException e) {
myLogger.severe("Datei " + outfile + " kann nicht erzeugt werden: " + e.toString());
} catch (TransformerException e) {
myLogger.severe("Datei " + outfile + " kann nicht transformiert werden: " + e.toString());
}
//new javax.xml.transform.stream.StreamResult( myOutwriter));
}
}
}
} }
public void outputString() { public void outputString() {

BIN
superx/WEB-INF/lib/superx-etl.jar

Binary file not shown.
Loading…
Cancel
Save