Browse Source

Bugfix ExecuteMask, inc-Dateien Prepared Statements

userinfo_gueltigkeit
Daniel Quathamer 1 year ago
parent
commit
1d77fc5a52
  1. 183
      src/de/memtext/util/GetOpts.java
  2. 141
      src/de/superx/bin/ExecuteMask.java
  3. 11
      src/de/superx/bin/SxValidate.java
  4. 35
      src/de/superx/etl/EtlUtils.java
  5. 2
      src/de/superx/servlet/SxPool.java
  6. 335
      src/de/superx/util/PathAndFileUtils.java
  7. 8
      superx/WEB-INF/conf/edustore/db/bin/SQL_ENV.sam
  8. 168
      superx/WEB-INF/conf/edustore/db/bin/sx_auto_insert_mask
  9. 2
      superx/WEB-INF/conf/edustore/db/install/conf/builddatum.txt
  10. 2
      superx/WEB-INF/conf/edustore/db/install/conf/kern.rtf
  11. 5
      superx/WEB-INF/conf/obsoletfiles.txt
  12. BIN
      superx/WEB-INF/lib/superx5.0.jar
  13. 10
      superx/edit/check_authentication.inc
  14. 19
      superx/edit/kern/show_html_content.jsp
  15. 2
      superx/edit/kern/webapp_manager.jsp

183
src/de/memtext/util/GetOpts.java

@ -6,8 +6,76 @@ import java.util.StringTokenizer;
* Method to analyse * Method to analyse
*/ */
public class GetOpts { public class GetOpts {
private static String[] arguments = null; public enum Options{
opt_logger("-logger"),
opt_dbprops("-dbproperties"),
opt_table("-table"),
opt_outFormat("-outFormat"),
opt_outFile("-outfile"),
opt_outfileAttribute("-outfileattribute"),
opt_cancel("-cancel"),
opt_sql("-sqlfile"),
opt_sqlAttribute("-sqlattribute"),
opt_delim("-delim"),
opt_header("-header"),
opt_params("-params"),
opt_param("-param"),
opt_in("-in"),
opt_inFormat("-informat"),
opt_out("-out"),
opt_xsl("-xsl"),
opt_xslPfad("-xslpfad"),
opt_fopxconf("-fopxconf"),
opt_user("-user"),
opt_tid("-tid"),
opt_mandID("-mandantenid"),
opt_locale("-locale"),
opt_simpPars("-simpleParser"),
opt_webinf("-web_inf_pfad"),
opt_module("-module_pfad"),
opt_jobUniqueName("-job_uniquename"),
opt_uploadpath("-path_to_uploadfile"),
opt_method("-method"),
opt_xml("-xml"),
opt_xmlconfig("-xmlconfig"),
opt_db("-database"),
opt_version("-version"),
opt_unl("-unl"),
opt_unlParams("-unload_params"),
opt_jrxml("-jrxml"),
opt_jasper("-jasper"),
opt_jrPrint("-jrprint"),
opt_ignorePagination("-ignore_pagination"),
opt_idescr("-i_descr"),
opt_odescr("-o_descr"),
opt_element("-element"),
opt_function("-function"),
opt_mode("-mode"),
opt_inserts("-inserts"),
opt_encoding("-encoding"),
opt_hsnr("-hsnr"),
opt_noDelete("-nodelete"),
opt_pause("-pause"),
opt_jahr("-jahr"),
opt_datentyp("-datentyp"),
opt_runs("-runs"),
opt_checkval("-checkval"),
opt_url("-url"),
opt_setname("-setname"),
opt_kernTabellenFreischalten("-kern_tabellen_freischalten"),
opt_noguiVar0("-nogui"), opt_noguiVar1("-no-gui"), opt_noguiVar2("--no-gui"),
opt_job("-job");
private String value;
private Options(String value) {
this.value = value;
}
public String stringValue() {
return value;
}
}
private static String[] arguments = null;
//don't instantiate //don't instantiate
private GetOpts() { private GetOpts() {
@ -23,6 +91,20 @@ public class GetOpts {
public static void setOpts(String args[]) { public static void setOpts(String args[]) {
arguments = args; arguments = args;
} }
/**
* checks if the arguments passed before by setOpts contain the given option
*
* @param Options
* option
* @return true if arguments contain the option, i.e. one String which
* starts with the option-String
*/
public static boolean isPresent(Options option){
if(arguments == null){
throw new IllegalStateException("must either call setOpts() before or call the long version of this method");
}
return isPresent(arguments, option);
}
/** /**
* checks if the arguments passed before by setOpts contain the given option * checks if the arguments passed before by setOpts contain the given option
@ -55,6 +137,26 @@ public class GetOpts {
result = true; result = true;
return result; return result;
} }
/**
* checks if the arguments contain the given option
*
* @param args
* @param Options
* option
* @return true if arguments contain the option, i.e. one String which
* starts with the option-String
*/
public static boolean isPresent(String args[], Options option){
boolean result = false;
for(int i = 0; i < args.length; i++){
if (args[i] != null && args[i].toLowerCase().startsWith(option.stringValue())){
result = true;
}
}
return result;
}
/** /**
* Gets a named option from the arguments passed before with setOps. E.g. * Gets a named option from the arguments passed before with setOps. E.g.
@ -90,7 +192,37 @@ public class GetOpts {
throw new RuntimeException("Option " + option + " not found!"); throw new RuntimeException("Option " + option + " not found!");
return result; return result;
} }
/**
* Gets a named option from the arguments passed before with setOps. E.g.
* getOpt("--log") would return the "--log:true" in the arguments
*
* @param Options
* option
* @return String option and value
*/
public static String getOpt(Options option){
if (arguments == null){
throw new IllegalStateException("must either call setOpts() before or call the long version of this method");
}
return getOpt(arguments, option);
}
/**
* Gets a named option from the arguments. E.g. getOpt("--log") would return
* the "--log:true" in the arguments
*
* @param Options
* option
* @return String option and value
*/
public static String getOpt(String args[], Options option){
String result = null;
for(int i=0; i < args.length; i++){
if(args[i].toLowerCase().startsWith(option.stringValue())){
result = args[i];
}
}
return result;
}
/** /**
* Gets the value of an option from the arguments passed before with setOpts * Gets the value of an option from the arguments passed before with setOpts
* if for example, you ask getValue("--log:") and the arguments passed * if for example, you ask getValue("--log:") and the arguments passed
@ -125,7 +257,40 @@ public class GetOpts {
result = raw.substring(pos, raw.length()); result = raw.substring(pos, raw.length());
return result; return result;
} }
/**
* Gets the value of an option from the arguments passed before with setOpts
* if for example, you ask getValue("--log:") and the arguments passed
* before with setOpts contain a String "--log:true") "true" is returned
*
* @param Options
* option
* @return String value of the option
*/
public static String getValue(Options option){
if (arguments == null){
throw new IllegalStateException("must either call setOpts() before or call the long version of this method");
}
return getValue(arguments, option);
}
/**
* Gets the value of an option, if for example, you ask getValue("--log:")
* and the arguments passed before with setOpts contain a String
* "--log:true") "true" is returned
*
* @param Options
* option
* @return String value of the option
*/
public static String getValue(String args[], Options option) {
String value = null, temp = getOpt(args, option);
int pos = option.stringValue().length();
if(temp.charAt(pos) == ':') {
pos++;
}
value = temp.substring(pos);
return value;
}
/** /**
* Prüft, ob alle notwendigen Optionen angegeben sind, z.B. String * Prüft, ob alle notwendigen Optionen angegeben sind, z.B. String
* "-loggingProperties:,-dbProperties" übergeben, die beiden müssen dabei * "-loggingProperties:,-dbProperties" übergeben, die beiden müssen dabei
@ -149,4 +314,18 @@ public class GetOpts {
} }
return result; return result;
} }
public static String isAllRequiredOptionsPresent(Options[] opts){
String missingOpts = null;
for (Options o : opts){
if(!isPresent(o)){
if(missingOpts == null){
missingOpts = o.stringValue()+", ";
}else{
missingOpts += o.stringValue()+", ";
}
}
}
return missingOpts;
}
} }

141
src/de/superx/bin/ExecuteMask.java

@ -1,18 +1,25 @@
package de.superx.bin; package de.superx.bin;
import static de.superx.servlet.SxSQL_Server.DEFAULT_MANDANTEN_ID;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import java.sql.Connection;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.logging.ConsoleHandler; import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.LogManager; import java.util.logging.LogManager;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -28,12 +35,13 @@ import de.memtext.util.ServletHelper;
import de.memtext.util.StringUtils; import de.memtext.util.StringUtils;
import de.memtext.util.TimeUtils; import de.memtext.util.TimeUtils;
import de.memtext.util.TransletUtils; import de.memtext.util.TransletUtils;
import de.superx.common.FieldContainer; import de.memtext.util.GetOpts.Options;
import de.superx.common.Maske; import de.superx.common.Maske;
import de.superx.common.SxResultRow; import de.superx.common.SxResultRow;
import de.superx.common.SxResultSet; import de.superx.common.SxResultSet;
import de.superx.common.SxUser; import de.superx.common.SxUser;
import de.superx.sec.InputCheckRegistry; import de.superx.sec.InputCheckRegistry;
import de.superx.servlet.RequestParameter;
import de.superx.servlet.ServletUtils; import de.superx.servlet.ServletUtils;
import de.superx.servlet.SuperXManager; import de.superx.servlet.SuperXManager;
import de.superx.servlet.SxPools; import de.superx.servlet.SxPools;
@ -43,6 +51,8 @@ import net.sf.jasperreports.engine.JRException;
public class ExecuteMask { public class ExecuteMask {
//Ausgabe als PDF nicht möglich? -> Korrupte Datei 30/10/2020 Jan Malte Hientzsch
/** /**
* Kommandozeilen-Interface für Ausführung von Masken und Export des Ergebnis * Kommandozeilen-Interface für Ausführung von Masken und Export des Ergebnis
* als Datei * als Datei
@ -57,7 +67,6 @@ public class ExecuteMask {
* @param -params:Parameter für die Maske, jeweils mit "&" getrennt in * @param -params:Parameter für die Maske, jeweils mit "&" getrennt in
* einem String * einem String
* *
* Sollte im Arbeitsverzeichnis webapps/superx/WEB-INF laufen
* *
* Beispiele: HTML Druckversion (Default): java * Beispiele: HTML Druckversion (Default): java
* de.superx.bin.ExecuteMask -tid:16000 -out:test.htm -user:admin * de.superx.bin.ExecuteMask -tid:16000 -out:test.htm -user:admin
@ -72,7 +81,7 @@ public class ExecuteMask {
* ?=1=1&Stichtag=1&stylesheet=tabelle_xls.xsl&contenttype=application/vnd.ms-excel" * ?=1=1&Stichtag=1&stylesheet=tabelle_xls.xsl&contenttype=application/vnd.ms-excel"
* -logger:/home/superx/git/superx/superx/WEB-INF/conf/edustore/db/conf/logging.properties * -logger:/home/superx/git/superx/superx/WEB-INF/conf/edustore/db/conf/logging.properties
*/ */
private static String mandantenID = "default"; private static String mandantenID;
private static TimeUtils tutil = new TimeUtils(); private static TimeUtils tutil = new TimeUtils();
@ -84,8 +93,6 @@ public class ExecuteMask {
private static Integer userid; private static Integer userid;
private static FieldContainer myFieldContainer;
private static String myWEBINFFilePath = System.getProperty("user.dir"); private static String myWEBINFFilePath = System.getProperty("user.dir");
private static Logger log; private static Logger log;
@ -102,9 +109,8 @@ public class ExecuteMask {
+ " java de.superx.bin.ExecuteMask -tid:16000 -out:test.pdf -user:admin \"-params:Köpfe oder Fälle ?=1=1&Stichtag=1&stylesheet=tabelle_fo_pdf.xsl&contenttype=application/pdf\" -logger:/home/superx/git/superx/superx/WEB-INF/conf/edustore/db/conf/logging.properties\n" + " java de.superx.bin.ExecuteMask -tid:16000 -out:test.pdf -user:admin \"-params:Köpfe oder Fälle ?=1=1&Stichtag=1&stylesheet=tabelle_fo_pdf.xsl&contenttype=application/pdf\" -logger:/home/superx/git/superx/superx/WEB-INF/conf/edustore/db/conf/logging.properties\n"
+ " Excel-Datei\n" + " Excel-Datei\n"
+ " java de.superx.bin.ExecuteMask -tid:16000 -out:test.xls -user:admin \"-params:Köpfe oder Fälle ?=1=1&Stichtag=1&stylesheet=tabelle_xls.xsl&contenttype=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\" -logger:/home/superx/git/superx/superx/WEB-INF/conf/edustore/db/conf/logging.properties\n" + " java de.superx.bin.ExecuteMask -tid:16000 -out:test.xls -user:admin \"-params:Köpfe oder Fälle ?=1=1&Stichtag=1&stylesheet=tabelle_xls.xsl&contenttype=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\" -logger:/home/superx/git/superx/superx/WEB-INF/conf/edustore/db/conf/logging.properties\n"
+ " java de.superx.bin.ExecuteMask -tid:16000 -out:test.xls -user:admin \"-params:Köpfe oder Fälle ?=1=1&Stichtag=1&stylesheet=tabelle_xls.xsl&contenttype=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\" -logger:/home/superx/git/superx/superx/WEB-INF/conf/edustore/db/conf/logging.properties\n"
+ " CSV-Datei\n" + " CSV-Datei\n"
+ " java de.superx.bin.ExecuteMask -tid:16000 -out:test.csv -user:admin \"-params:Köpfe oder Fälle ?=1=1&Stichtag=1&contenttype=test/csv\" -logger:/home/superx/git/superx/superx/WEB-INF/conf/edustore/db/conf/logging.properties\n" + " java de.superx.bin.ExecuteMask -tid:16000 -out:test.csv -user:admin \"-params:Köpfe oder Fälle ?=1=1&Stichtag=1&contenttype=text/csv\" -logger:/home/superx/git/superx/superx/WEB-INF/conf/edustore/db/conf/logging.properties\n"
+ " -fopxconf (Pfad dazu - optional)"; + " -fopxconf (Pfad dazu - optional)";
static MockHttpServletRequest mock ; static MockHttpServletRequest mock ;
@ -116,29 +122,57 @@ public class ExecuteMask {
static SxUser user; static SxUser user;
private static File fopxconfFile = null; private static File fopxconfFile = null;
public static void main(String[] args) throws IllegalArgumentException, SecurityException { public static void main(String[] args) {
SuperXManager.initKettleEnv(); try {
execute(args);
} catch (Exception e) {
log.log(Level.SEVERE, "Error in ExecuteMask", e);
System.exit(1);
}
System.exit(0);
}
public static void execute(String[] args) throws Exception {
// mock muss neu intialisiert werden, sonst Fehlschläge bei mehreren Aufrufen // mock muss neu intialisiert werden, sonst Fehlschläge bei mehreren Aufrufen
// von ExecuteMaske in JUnitTest Batterie mittels ant // von ExecuteMaske in JUnitTest Batterie mittels ant
mock = new MockHttpServletRequest(); mock = new MockHttpServletRequest();
GetOpts.setOpts(args); GetOpts.setOpts(args);
String isdrin = GetOpts.isAllRequiredOptionsPresent("-logger,-tid,-out,-user"); String isdrin = GetOpts.isAllRequiredOptionsPresent(new Options[]{Options.opt_logger,
Options.opt_tid,
Options.opt_out,
Options.opt_user});
if (isdrin != null) { if (isdrin != null) {
System.err.println(usage); System.err.println(usage);
System.exit(1); return;
} }
String userName = GetOpts.getValue("-user"); String userName = GetOpts.getValue(Options.opt_user);
String loggingProperties = GetOpts.getValue("-logger"); String loggingProperties = GetOpts.getValue(Options.opt_logger);
if (GetOpts.isPresent("-fopxconf")) { try {
fopxconfFile = new File(GetOpts.getOpt("-fopxconf").replaceAll("-fopxconf:", "")); myWEBINFFilePath= de.superx.util.PathAndFileUtils.getWebinfDirectory();
} catch (URISyntaxException e1) {
// Default ist user.dir:
myWEBINFFilePath=getMyWEBINFFilePath();
} //
if (GetOpts.isPresent(Options.opt_fopxconf)) {
fopxconfFile = new File(GetOpts.getOpt(Options.opt_fopxconf).replaceAll(Options.opt_fopxconf.stringValue()+":", ""));
} else { } else {
fopxconfFile = null; fopxconfFile = new File(myWEBINFFilePath+ File.separator + "conf"+ File.separator +"fop.xconf");
} }
try { List<String> mandantenNamen = new LinkedList<String>();
FileInputStream ins; if (GetOpts.isPresent(Options.opt_mandID)) {
ins = new FileInputStream(loggingProperties); String mid = GetOpts.getValue(Options.opt_mandID);
System.out.println("Opt -mandantenID present: " + mid);
mandantenID = mid;
} else if (mandantenID == null){
System.out.println("No opt -mandantenID present. Set to " + DEFAULT_MANDANTEN_ID);
mandantenID = DEFAULT_MANDANTEN_ID;
} else {
System.out.println("No opt -mandantenID present. mandantenID was already set to " + mandantenID);
}
mandantenNamen.add(mandantenID);
try ( FileInputStream ins = new FileInputStream(loggingProperties) ) {
LogManager MyLogManager = java.util.logging.LogManager.getLogManager(); LogManager MyLogManager = java.util.logging.LogManager.getLogManager();
MyLogManager.readConfiguration(ins); MyLogManager.readConfiguration(ins);
log = Logger.getLogger(ExecuteMask.class.getName()); log = Logger.getLogger(ExecuteMask.class.getName());
@ -146,10 +180,10 @@ public class ExecuteMask {
System.out.println("Using Loggging-Level " + log.getLevel()); System.out.println("Using Loggging-Level " + log.getLevel());
} catch (FileNotFoundException e2) { } catch (FileNotFoundException e2) {
System.err.println("Datei " + loggingProperties + " nicht gefunden:" + e2.toString()); System.err.println("Datei " + loggingProperties + " nicht gefunden:" + e2.toString());
System.exit(1); return;
} catch (IOException e) { } catch (IOException e) {
System.err.println("Datei " + loggingProperties + " kann nicht gelesen werden:" + e.toString()); System.err.println("Datei " + loggingProperties + " kann nicht gelesen werden:" + e.toString());
System.exit(1); return;
} }
tutil.start(); tutil.start();
try { try {
@ -160,28 +194,33 @@ public class ExecuteMask {
SxPools.resetAllPools(); SxPools.resetAllPools();
userid = getUserID(userName, mandantenID); userid = getUserID(userName, mandantenID);
adminUser = getUserAdmin(userName, mandantenID); adminUser = getUserAdmin(userName, mandantenID);
//UserInitializer ui=new UserInitializer(mandantenID, userName, userid, adminUser);
user = UserInitializer.initUser(mandantenID, userName, userid, adminUser); user = UserInitializer.initUser(mandantenID, userName, userid, adminUser);
Connection con=SxPools.get(mandantenID).getConnection();
//ui.initUser(con,null);
//user=ui.getUser();
//user.setMandantenID(mandantenID);
con.close();
} catch (Exception e) { } catch (Exception e) {
log.severe("Fehler beim Aufbau der Connection: " + e.toString()); log.severe("Fehler beim Aufbau der Connection: " + e.toString());
System.exit(1); e.printStackTrace();
return;
} }
String tidString = GetOpts.getValue("-tid"); String tidString = GetOpts.getValue(Options.opt_tid);
String outfile = GetOpts.getValue("-out"); String outfile = GetOpts.getValue(Options.opt_out);
if (GetOpts.isPresent("-locale")) if (GetOpts.isPresent(Options.opt_locale))
myLocale = GetOpts.getValue("-locale"); myLocale = GetOpts.getValue(Options.opt_locale);
else else
myLocale = de.superx.util.SqlStringUtils.getEncoding(); myLocale = de.superx.util.SqlStringUtils.getEncoding();
if (GetOpts.isPresent("-params")) if (GetOpts.isPresent(Options.opt_params))
myParams = GetOpts.getValue("-params"); myParams = GetOpts.getValue(Options.opt_params);
Locale desiredLocale = new Locale(myLocale); Locale desiredLocale = new Locale(myLocale);
SuperXManager.maxRows = 1000000; SuperXManager.maxRows = 1000000;
Maske maske = null; Maske maske = null;
InputCheckRegistry.registerDefaultChecks(); InputCheckRegistry.registerDefaultChecks();
try { try {
maske = new Maske(mandantenID, user, new Integer(tidString), desiredLocale); maske = new Maske(mandantenID, user, Integer.valueOf(tidString), desiredLocale);
NamedIdObjectList fields = maske.readFelderFromDb(user); NamedIdObjectList fields = maske.readFelderFromDb(user);
myFieldContainer = maske.getIndividualFields();
myFieldContainer.addAll(fields);
setParams(mock, myParams); setParams(mock, myParams);
maske.setFieldDefaults(user, mock, true); maske.setFieldDefaults(user, mock, true);
exportTable(mock, mockResponse, maske, user, outfile, desiredLocale); exportTable(mock, mockResponse, maske, user, outfile, desiredLocale);
@ -190,9 +229,8 @@ public class ExecuteMask {
e.printStackTrace(); e.printStackTrace();
log.severe("Fehler beim Ausführen der Maske " + tidString + ": " + e.toString()); log.severe("Fehler beim Ausführen der Maske " + tidString + ": " + e.toString());
System.exit(1); throw e;
} }
System.exit(0);
} }
public static HttpServletResponse getHttpResponse() { public static HttpServletResponse getHttpResponse() {
@ -223,7 +261,7 @@ public class ExecuteMask {
} }
if (userID == null) { if (userID == null) {
System.err.println("User " + userName + "unbekannt"); System.err.println("User " + userName + "unbekannt");
System.exit(1); return Integer.valueOf(-1);
} }
return userID; return userID;
} }
@ -273,7 +311,6 @@ public class ExecuteMask {
String paramName = paramString.substring(0, paramString.indexOf("=")); String paramName = paramString.substring(0, paramString.indexOf("="));
String paramVal = paramString.substring(paramString.indexOf("=") + 1); String paramVal = paramString.substring(paramString.indexOf("=") + 1);
mock.addParameter(paramName, paramVal); mock.addParameter(paramName, paramVal);
//System.out.println(paramName+"-"+paramVal);
} }
} }
@ -292,25 +329,25 @@ public class ExecuteMask {
Maske maske, SxUser user_par, String outfile, Locale desiredLocale) { Maske maske, SxUser user_par, String outfile, Locale desiredLocale) {
String currentXml_local = null; String currentXml_local = null;
String method = "html"; String method = "html";
String stylesheet = ServletHelper.getParameter(mock_par, "stylesheet"); String stylesheet = ServletHelper.getParameter(mock_par, RequestParameter.stylesheet);
// Default ist html Druckversion: // Default ist html Druckversion:
if (stylesheet == null || stylesheet.equals("")) if (stylesheet == null || stylesheet.equals(""))
stylesheet = "tabelle_html_p.xsl"; stylesheet = "tabelle_html_p.xsl";
log.info("Stylesheet " + stylesheet + " wird genutzt"); log.info("Stylesheet " + stylesheet + " wird genutzt");
String contenttype = ServletHelper.getParameter(mock_par, "contenttype"); String contenttype = ServletHelper.getParameter(mock_par, RequestParameter.contenttype);
// Default ist html: // Default ist html:
if (contenttype == null || contenttype.equals("")) if (contenttype == null || contenttype.equals("")) {
contenttype = "text/html"; contenttype = "text/html";
if (contenttype.indexOf("pdf") > -1) }
if (contenttype.indexOf("pdf") > -1) {
method = "pdf"; method = "pdf";
if (contenttype.indexOf("xml") > -1) }
if (contenttype.indexOf("xml") > -1) {
method = "xml"; method = "xml";
if (contenttype.indexOf("excel") > -1) }
if (contenttype.indexOf("spreadsheetml") > -1) {
method = "xls"; method = "xls";
// if }
// (contenttype.indexOf("vnd.openxmlformats-officedocument.spreadsheetml.sheet")
// > -1) method = "xlsx";
log.info("Contenttype " + contenttype + " wird erzeugt"); log.info("Contenttype " + contenttype + " wird erzeugt");
maske.setMaxOffset(10000000); maske.setMaxOffset(10000000);
maske.setReuseResult(false); maske.setReuseResult(false);
@ -325,12 +362,13 @@ public class ExecuteMask {
currentXml_local = SxPools.get(mandantenID).localize(currentXml_local, desiredLocale); currentXml_local = SxPools.get(mandantenID).localize(currentXml_local, desiredLocale);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
log.severe("Fehler beim Erstellen des XML für Maske " + e.toString()); log.severe("Fehler beim Erstellen des XML für Maske " + e.toString());
} }
String ausgabedatei = ""; String ausgabedatei = "";
if (stylesheet.equals("tabelle_xml.xsl")) if (stylesheet.equals("tabelle_xml.xsl")) {
ausgabedatei = writeTextFile(currentXml_local, outfile); ausgabedatei = writeTextFile(currentXml_local, outfile);
}
else if (contenttype.equals("text/csv")) else if (contenttype.equals("text/csv"))
try { try {
ausgabedatei = writeTextFile(maske.getCSV(mandantenID).toString(), outfile); ausgabedatei = writeTextFile(maske.getCSV(mandantenID).toString(), outfile);
@ -339,7 +377,7 @@ public class ExecuteMask {
e.printStackTrace(); e.printStackTrace();
} }
else { else {
ausgabedatei = writeTextFile(currentXml_local, null); ausgabedatei = writeTextFile(currentXml_local, outfile + ".xml");
if (stylesheet.endsWith(".jrxml")) if (stylesheet.endsWith(".jrxml"))
exportJR(mock_par, mockResponse_par, maske, user_par, outfile, stylesheet, contenttype, mandantenID, exportJR(mock_par, mockResponse_par, maske, user_par, outfile, stylesheet, contenttype, mandantenID,
myWEBINFFilePath + "/reports/", currentXml_local); myWEBINFFilePath + "/reports/", currentXml_local);
@ -398,7 +436,7 @@ public class ExecuteMask {
if (filename != null) { if (filename != null) {
Path destPath = Paths.get(filename); Path destPath = Paths.get(filename);
Path resultPath = Files.move(tmpPath, destPath, StandardCopyOption.REPLACE_EXISTING); Path resultPath = Files.move(tmpPath, destPath, StandardCopyOption.REPLACE_EXISTING);
targetfilename = resultPath.toString(); // dest.getAbsolutePath(); targetfilename = resultPath.toString();
} }
} catch (IOException e) { } catch (IOException e) {
log.severe("Fehler beim Erstellen der Datei " + filename + " " + e.toString()); log.severe("Fehler beim Erstellen der Datei " + filename + " " + e.toString());
@ -421,7 +459,7 @@ public class ExecuteMask {
private static void transformFile(Maske maske, String xmlfile, String stylesheet, String contenttype, private static void transformFile(Maske maske, String xmlfile, String stylesheet, String contenttype,
String filename, MockHttpServletResponse mockResponse_par, String method) { String filename, MockHttpServletResponse mockResponse_par, String method) {
TransletUtils.initFactory("net.sf.saxon.TransformerFactoryImpl", null); TransletUtils.initFactory("net.sf.saxon.TransformerFactoryImpl", null);
String stylesheetPath = getMyWEBINFFilePath() + File.separator + ".." + File.separator + "xml" + File.separator String stylesheetPath = myWEBINFFilePath + File.separator + ".." + File.separator + "xml" + File.separator
+ stylesheet; + stylesheet;
if (method.equals("xls")) { if (method.equals("xls")) {
try { try {
@ -430,7 +468,7 @@ public class ExecuteMask {
xt.setMandantenID(mandantenID); xt.setMandantenID(mandantenID);
xt.setMaske(maske); xt.setMaske(maske);
String xml = StringUtils.readFile(new File(xmlfile)); String xml = StringUtils.readFile(new File(xmlfile));
if (contenttype.indexOf("excel") > -1) { if (contenttype.indexOf("spreadsheetml") > -1) {
if (maske.isNewExcelExport()) { if (maske.isNewExcelExport()) {
xml = XmlTransformer.stripXml(xml); xml = XmlTransformer.stripXml(xml);
} }
@ -448,6 +486,7 @@ public class ExecuteMask {
myTransformer.quellstring = xmlfile; myTransformer.quellstring = xmlfile;
myTransformer.stylesheet = stylesheetPath; myTransformer.stylesheet = stylesheetPath;
myTransformer.outfile = filename; myTransformer.outfile = filename;
//myTransformer.mandantenID=mandantenID;
if (fopxconfFile != null) if (fopxconfFile != null)
myTransformer.setFopxconfFile(fopxconfFile); myTransformer.setFopxconfFile(fopxconfFile);
myTransformer.transformFile(method); myTransformer.transformFile(method);

11
src/de/superx/bin/SxValidate.java

@ -59,7 +59,7 @@ public class SxValidate
if (args.length == 0 || args.length > 2) if (args.length == 0 || args.length > 2)
{ {
System.out.println("\nGeben Sie 'sx_validate.x -help' für Information über SxValidate"); System.out.println("\nGeben Sie 'sx_validate.x -help' für Information über SxValidate");
return; System.exit(1);
} }
if (args[0].toLowerCase().equals("-help")) if (args[0].toLowerCase().equals("-help"))
{ {
@ -76,15 +76,17 @@ public class SxValidate
{ {
SxValidate v = new SxValidate(); SxValidate v = new SxValidate();
v.validate(args); v.validate(args);
System.exit(0);
} }
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
System.exit(1);
} }
} }
void validate(String[] args) void validate(String[] args)
throws FileNotFoundException, IOException, ParserConfigurationException, SAXException throws Exception
{ {
File dir = new File(args[0]); File dir = new File(args[0]);
@ -115,7 +117,7 @@ public class SxValidate
else // Command-line argument is no good! else // Command-line argument is no good!
{ {
System.out.println(args[0] + " not found!"); System.out.println(args[0] + " not found!");
return; System.exit(1);
} }
// Provide user with a summary. // Provide user with a summary.
buff.append("================SUMMARY=============================\n"); buff.append("================SUMMARY=============================\n");
@ -144,7 +146,7 @@ public class SxValidate
// Parse each XML file. // Parse each XML file.
void parse(String dir, String filename,boolean useSchema) void parse(String dir, String filename,boolean useSchema)
throws FileNotFoundException, IOException, ParserConfigurationException, SAXException throws Exception
{ {
try try
{ {
@ -204,6 +206,7 @@ public class SxValidate
{ {
buff.append("NOT WELL-FORMED " + filename + ". " + e.getMessage() + "\n"); buff.append("NOT WELL-FORMED " + filename + ". " + e.getMessage() + "\n");
numMalformedFiles++; numMalformedFiles++;
throw new Exception(e);
} }
finally finally
{ {

35
src/de/superx/etl/EtlUtils.java

@ -53,7 +53,7 @@ public static String MODUL_ROHDATEN_SUBPFAD=PATHSEP+"rohdaten"+PATHSEP;
public static void main(String args[]) { public static void main(String args[]) {
try { try {
String webinfdir=getWebinfDirectory();; String webinfdir=de.superx.util.PathAndFileUtils.getWebinfDirectory();
System.out.println(webinfdir); System.out.println(webinfdir);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
@ -134,7 +134,7 @@ public static void initJobEnvironment()
if(initVar==null || initVar.equals(".")) if(initVar==null || initVar.equals("."))
{ {
//ermittle webinfdir //ermittle webinfdir
initVar=getWebinfDirectory(); initVar=de.superx.util.PathAndFileUtils.getWebinfDirectory();
} }
} catch (Exception e) { } catch (Exception e) {
@ -167,38 +167,7 @@ private static boolean runningFromJar()
return jarName.contains(".jar"); return jarName.contains(".jar");
} }
public static String getWebinfDirectory() throws URISyntaxException
{
if (runningFromJar())
{
return getWebinfDirectoryFromJar();
} else
{
return getWebinfDirectoryFromClass();
}
}
private static String getWebinfDirectoryFromClass()
{
File f= new File(EtlUtils.class.getProtectionDomain()
.getCodeSource()
.getLocation()
.getPath()+PATHSEP+"..");
String class_path=f.getAbsolutePath();
return class_path;
}
private static String getWebinfDirectoryFromJar() throws URISyntaxException
{
File f1=new File(EtlUtils.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
//now we're got superx.jar, go up one level
File f2=new File(f1.getParent());
//now we've got WEB-INF/lib, return WEB-INF:
return f2.getParent();
}
/* die folgenden 2 Methoden /* die folgenden 2 Methoden
* getFileContentsWithEncoding * getFileContentsWithEncoding
* saveFileContentsWithEncoding * saveFileContentsWithEncoding

2
src/de/superx/servlet/SxPool.java

@ -346,7 +346,7 @@ public class SxPool extends GenericObjectPool implements NamedObjectI {
//bei Kommandozerilenaufrufen ist WEB-INF nicht aus dem Servlet Manager ermittelbar: //bei Kommandozerilenaufrufen ist WEB-INF nicht aus dem Servlet Manager ermittelbar:
if(myWEBINFFilePath==null || myWEBINFFilePath.equals(".")) if(myWEBINFFilePath==null || myWEBINFFilePath.equals("."))
try { try {
myWEBINFFilePath= de.superx.etl.EtlUtils.getWebinfDirectory(); myWEBINFFilePath= de.superx.util.PathAndFileUtils.getWebinfDirectory();
} catch (URISyntaxException e1) { } catch (URISyntaxException e1) {
// Default ist user.dir: // Default ist user.dir:
myWEBINFFilePath=System.getProperty("user.dir"); myWEBINFFilePath=System.getProperty("user.dir");

335
src/de/superx/util/PathAndFileUtils.java

@ -0,0 +1,335 @@
package de.superx.util;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import de.superx.servlet.SuperXManager;
public abstract class PathAndFileUtils {
public static String MODULE_PATH = String.join(File.separator,
new String[] {"conf","edustore","db","module"});
public static final String PATHSEP=File.separator;
static Logger logger = LoggerFactory.getLogger(PathAndFileUtils.class);
private static final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
.newInstance();
public static String getModulePath(String componentAbbreviation) {
String modulePath = "kern".equals(componentAbbreviation) || "superx".equals(componentAbbreviation)?
String.join(File.separator, new String[]
{getWebinfPath(), "conf", "edustore", "db", "install"})
:
String.join(File.separator, new String[]
{getWebinfPath(), MODULE_PATH, componentAbbreviation});
return modulePath;
}
public static File getDbFormsTemplateFile(String componentAbbreviation, String database) {
return new File(getWebinfPath() + File.separator + componentAbbreviation + "_dbforms-config_" + database + ".xml");
}
public static File getDbFormsConfigFile() {
return new File(getWebinfPath() + File.separator + "dbforms-config.xml");
}
public static File getXmlFile(String componentAbbreviation) {
String xmlFilePath = String.join(File.separator, new String[]
{getModulePath(componentAbbreviation), "conf", componentAbbreviation + ".xml"});
logger.info("XML File Path: " + xmlFilePath);
return new File(xmlFilePath);
}
public static File getUnloadXmlFile(String componentAbbreviation) {
String xmlFilePath = String.join(File.separator, new String[]
{getModulePath(componentAbbreviation), "rohdaten", componentAbbreviation + "_unload.xml"});
logger.info("Unload XML File Path: " + xmlFilePath);
return new File(xmlFilePath);
}
public static String getUnloadPath(String componentAbbreviation) {
String unloadPath = String.join(File.separator, new String[]
{getModulePath(componentAbbreviation), "rohdaten"});
logger.info("Unload Path: " + unloadPath);
return unloadPath;
}
public static String getDbtJsonPath(String path) {
return substituteParamStrings(path);
}
/*doesnt compile in Java 8:
public static String getReportGeneratorDir(String project) {
Path dbtProjectDir = Path.of(SuperXManager.getWEB_INFPfad(), "..", "dbt", "projects", project, "report_generator");
return dbtProjectDir.toAbsolutePath().toString();
}
public static String getSourcesYML(String project) {
Path yml = Path.of(SuperXManager.getWEB_INFPfad(), "..", "dbt", "projects", project, "transform", "models", "sources.yml");
return yml.toAbsolutePath().toString();
}*/
public static String buildUnlFile(String compAbbr, String table) {
return "$" + compAbbr.toUpperCase() + "_LOAD_PFAD/" + "unl/" + table + ".unl";
}
public static File getUnlFile(String path) {
if (path == null || path.isEmpty()) {
return null;
}
int cutIndex = path.indexOf('_');
int fileIndex = path.lastIndexOf('/');
String componentAbbreviation = path.substring(1, cutIndex).toLowerCase();
String unlFile = path.substring(fileIndex + 1);
String unloadPath = String.join(File.separator, new String[]
{getModulePath(componentAbbreviation), "rohdaten", "unl", unlFile});
return new File(unloadPath);
}
public static File getScriptFile(String path) {
int cutIndex = path.indexOf('_');
String componentAbbreviation = path.substring(1, cutIndex).toLowerCase();
int fileIndex = path.indexOf('/') + ("superx".equals(componentAbbreviation) ? 11 : 0);
String[] scriptFilePathComponents = path.substring(fileIndex + 1).split("//");
String scriptFilePath = String.join(File.separator, scriptFilePathComponents);
String scriptPath = String.join(File.separator, new String[]
{getModulePath(componentAbbreviation), scriptFilePath});
return new File(scriptPath);
}
public static File getDbiFileForManualEtlStep(String componentAbbreviation, String etlStepId, String dbmAbbreviation) {
String xmlFilePath = String.join(File.separator, new String[]
{getModulePath(componentAbbreviation), "conf", "his1", "edustore_update",
"edustore_" +componentAbbreviation +"_man_" + etlStepId + "_" + dbmAbbreviation + ".xml"});
logger.info("XML File Path: " + xmlFilePath);
return new File(xmlFilePath);
}
public static String getWebinfPath() {
String result = SuperXManager.getWEB_INFPfad();
if (result.equals(".")) {
// for unit tests
if (runningFromJar())
{
try {
return getWebinfDirectoryFromJar();
} catch (URISyntaxException e) {
return "superx/WEB-INF";
}
} else
{
return getWebinfDirectoryFromClass();
}
}
else
{
return result;
}
}
public static File getXslFile(String fileName) {
String path = String.join(File.separator, new String[] {
getWebinfPath(), "conf", "edustore", "db", "conf", fileName
});
return new File(path);
}
public static String substituteParamStrings(String path) {
if (!path.startsWith("$")) {
return path;
}
int firstPathSep = path.indexOf('/');
String result = path.substring(firstPathSep + 1);
String param = path.substring(1, firstPathSep);
String[] filePathComponents = result.split("//");
String filePath = String.join(File.separator, filePathComponents);
if (param.endsWith("_LOAD_PFAD") || param.endsWith("_LOAD_PATH")) {
String componentAbbreviation = param.replaceFirst("_LOAD_PFAD", "").toLowerCase();
if (param.endsWith("_LOAD_PATH")) {
componentAbbreviation = param.replaceFirst("_LOAD_PATH", "").toLowerCase();
}
result = String.join(File.separator, new String[]
{getUnloadPath(componentAbbreviation), filePath});
} else if (param.endsWith("_PFAD") || param.endsWith("_PATH")) {
String componentAbbreviation = param.substring(0, param.lastIndexOf('_')).toLowerCase();
result = String.join(File.separator, new String[]
{getModulePath(componentAbbreviation), filePath});
} else if ("SUPERX_DIR".equals(param)) {
result = String.join(File.separator, new String[]
{getWebinfPath(), "conf", "edustore", filePath});
}
return result;
}
public static Document readXmlFile(File xmlFile) throws IOException {
Document document = null;
try {
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
document = documentBuilder.parse(xmlFile);
} catch (Exception e) {
logger.error("Couldn't read xml file " + xmlFile, e);
throw new IOException();
}
return document;
}
public static String getComponentName(String abbreviation) throws IOException {
File xmlFile = getXmlFile(abbreviation);
Document document = PathAndFileUtils.readXmlFile(xmlFile);
Node module = document.getElementsByTagName("module").item(0);
return getAttribute(module.getAttributes(), "thema");
}
public static String getModuleVersion(String abbreviation) throws IOException {
File moduleXml = getXmlFile(abbreviation);
Document xml = readXmlFile(moduleXml);
NodeList nodes = xml.getElementsByTagName("module");
Node root = nodes.item(0);
return getAttribute(root.getAttributes(), "version");
}
public static String getAttribute(NamedNodeMap attributes, String attributeName) {
Node attribute = attributes != null ? attributes.getNamedItem(attributeName) : null;
return attribute != null ? attribute.getNodeValue() : "";
}
public static String getModuleMd5(String abbreviation) throws IOException {
String moduleDir = getModulePath(abbreviation);
String result = "";
File md5File = new File(moduleDir + File.separator + "md5");
if (md5File.canRead()) {
result = StringUtils.chomp(FileUtils.readFileToString(md5File));
}
return result;
}
public static String getSystemInfoId(String abbreviation) throws IOException {
File moduleXml = getXmlFile(abbreviation);
Document xml = readXmlFile(moduleXml);
NodeList nodes = xml.getElementsByTagName("module");
Node root = nodes.item(0);
return getAttribute(root.getAttributes(), "systeminfo_id");
}
/**
* determine filename of superx-build (jar-file)
*
* @return Path
*/
private static String getJarName()
{
return new File(PathAndFileUtils.class.getProtectionDomain()
.getCodeSource()
.getLocation()
.getPath())
.getName();
}
/**
* determine if superx-build is jar or WEB-INF/classes
*
* @return boolean true if it's a jar-File
*/
private static boolean runningFromJar()
{
String jarName = getJarName();
return jarName.contains(".jar");
}
/**
* determine Path where superx-build lies (jar or WEB-INF/classes)
* in HISinOne-BI it's WEB-INF/classes, in SuperX it's a jar-File
* @return Path to the directory WEB-INF
* @throws URISyntaxException
*/
public static String getWebinfDirectory() throws URISyntaxException
{
if (runningFromJar())
{
return getWebinfDirectoryFromJar();
} else
{
return getWebinfDirectoryFromClass();
}
}
/**
* determine Path where superx-build lies (WEB-INF/classes)
*
* @return Path
*/
private static String getWebinfDirectoryFromClass()
{
File f= new File(PathAndFileUtils.class.getProtectionDomain()
.getCodeSource()
.getLocation()
.getPath()+PATHSEP+"..");
String class_path=f.getAbsolutePath();
return class_path;
}
/**
* determine Path where superx-build lies (jar)
*
* @return Path
* @throws URISyntaxException
*/
private static String getWebinfDirectoryFromJar() throws URISyntaxException
{
File f1=new File(PathAndFileUtils.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
//now we're got superx.jar, go up one level
File f2=new File(f1.getParent());
//now we've got WEB-INF/lib, return WEB-INF:
return f2.getParent();
}
public static List<String> getSourceSystems(Document unloadXml) {
List<String> result = new ArrayList<>();
NodeList sourcesystems = unloadXml.getElementsByTagName("sourcesystem");
int count = sourcesystems.getLength();
for (int i = 0; i < count; i++) {
Node sourcesystem = sourcesystems.item(i);
result.add(getAttribute(sourcesystem.getAttributes(), "name"));
}
return result;
}
// lese alle sourcesystem tags aus der unload.xml in eine Liste
public static List<String> findSourceSystems(String componentAbbreviation) {
File xmlFile = getUnloadXmlFile(componentAbbreviation);
List<String> sourceSystems = new ArrayList<>();
if (xmlFile.exists()) {
Document unloadXml = null;
try {
unloadXml = readXmlFile(xmlFile);
} catch (IOException e) {
logger.error("Couldn't read unload xml file for " + componentAbbreviation, e);
}
sourceSystems = getSourceSystems(unloadXml);
}
return sourceSystems;
}
}

8
superx/WEB-INF/conf/edustore/db/bin/SQL_ENV.sam

@ -31,11 +31,9 @@ JAVA_HOME=/usr/lib/java
#JAVA_HOME=/cygdrive/c/j2sdk1.4.1_01 #JAVA_HOME=/cygdrive/c/j2sdk1.4.1_01
export JAVA_HOME export JAVA_HOME
SUPERX_VERSION=4.2
export SUPERX_VERSION
#Mehr Speicher und awt Einstellung weil kein X11 Server eingerichtet #Mehr Speicher und awt Einstellung weil kein X11 Server eingerichtet
JAVA_OPTS="-Xmx200M -Djava.awt.headless=true" JAVA_OPTS="-Xmx1200M -Djava.awt.headless=true"
export JAVA_OPTS export JAVA_OPTS
#Bei grossen Datenmengen kann man wie folgt statt 32 MB 200 MB RAM zuweisen: #Bei grossen Datenmengen kann man wie folgt statt 32 MB 200 MB RAM zuweisen:
#JAVA_OPTS="-Xmx200M" #JAVA_OPTS="-Xmx200M"
@ -184,9 +182,7 @@ LIB_PATH=$WEBAPP/WEB-INF/lib
#LIB_PATH=$SUPERX_DIR/../../lib #LIB_PATH=$SUPERX_DIR/../../lib
#Pfad zu den allgemeinen Java-Libraries für Tomcat #Pfad zu den allgemeinen Java-Libraries für Tomcat
#Der JDBC_CLASSPATH enthält alles, was der jdbc-Client in superx für den Datenbankzugriff braucht. #Der JDBC_CLASSPATH enthält alles, was der jdbc-Client in superx für den Datenbankzugriff braucht.
JDBC_CLASSPATH="$LIB_PATH/ant.jar" ; for i in `ls $LIB_PATH/*.jar` ; do JDBC_CLASSPATH=$JDBC_CLASSPATH:$i ; done ; XML_CLASSPATH=$JDBC_CLASSPATH JDBC_CLASSPATH="$WEBAPP/WEB-INF/lib_ext/servlet-api.jar" ; for i in `ls $LIB_PATH/*.jar` ; do JDBC_CLASSPATH=$JDBC_CLASSPATH:$i ; done ; XML_CLASSPATH=$JDBC_CLASSPATH
#JDBC_CLASSPATH=$LIB_PATH/pg74.214.jdbc3.jar:$LIB_PATH/ifxjdbc.jar:$LIB_PATH/superx4.0.jar:$LIB_PATH/hsqldb17.jar:$LIB_PATH/commons-lang-2.0.jar:$LIB_PATH/xalan2-6-0.jar:$LIB_PATH/jfor-0.7.2rc1.jar:$LIB_PATH/httpunit.jar:$LIB_PATH/nekohtml.jar:$LIB_PATH/freemarker.jar
#JDBC_CLASSPATH=$TOMCAT_LIB/postgresql-8.1-412.jdbc3.jar:$TOMCAT_LIB/ifxjdbc.jar:$LIB_PATH/superx4.1.jar:$LIB_PATH/hsqldb17.jar:$LIB_PATH/commons-lang-2.0.jar:$LIB_PATH/xalan2-6-0.jar:$LIB_PATH/jfor-0.7.2rc1.jar:$LIB_PATH/httpunit.jar:$LIB_PATH/nekohtml.jar:$LIB_PATH/freemarker.jar
export JDBC_CLASSPATH export JDBC_CLASSPATH
DBFORMS_CLASSPATH=$XML_CLASSPATH:$LIB_PATH/dbforms2.5.jar DBFORMS_CLASSPATH=$XML_CLASSPATH:$LIB_PATH/dbforms2.5.jar
export DBFORMS_CLASSPATH export DBFORMS_CLASSPATH

168
superx/WEB-INF/conf/edustore/db/bin/sx_auto_insert_mask

@ -1,30 +1,37 @@
#!/bin/bash #!/bin/bash
#. $SUPERX_DIR/bin/SQL_ENV #. $SUPERX_DIR/bin/SQL_ENV
#--------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# Shell-Kommando "sx_auto_insert_mask" # Shell-Kommando "sx_auto_insert_mask"
# #
# Erstellt von abakus am 31.10.1994 # Erstellt von abakus am 31.10.1994
#--------------------------------------------------------------------- #--------------------------------------------------------------------------------------------------
# APF Korrektur nach Idee von Daniel, sx_auto_insert_mask ruft jetzt sx_insert_mask auf
##WEITER sicherheitshalber zurücksetzen # APF 12.06.2023 Korrektur wenn auto als erster Prameter übergeben wird, wir der Verzeichnisname
WEITER="" # als 1. Parameter in die Masken-Nr umgewandelt.
#--------------------------------------------------------------------------------------------------
case "$1" in
if [ "$1" = "" ] "" )
then echo "Aufruf: sx_auto_insert_mask <alte TID> [<neue TID>]" echo "Aufruf: sx_auto_insert_mask (<alte TID>|auto) [<neue TID>]"
echo " " echo " "
echo "Aktion: sx_auto_insert_mask laedt mittels sx_select_mask entladene SuperX-Metadaten" echo "Aktion: sx_auto_insert_mask laedt mittels sx_select_mask entladene SuperX-Metadaten"
echo " in die SuperX-Datenbank." echo " in die SuperX-Datenbank."
echo " <alte TID> kennzeichnet die Entladedateien." echo " <alte TID> kennzeichnet die Entladedateien."
echo " Falls <neue TID> nicht angegeben wird, werden die." echo " Falls <neue TID> nicht angegeben wird, werden die."
echo " Metadaten wieder mit der alten TID in die SuperX-DB" echo " Metadaten wieder mit der alten TID in die SuperX-DB"
echo " eingespielt (=Update)." echo " eingespielt (=Update)."
echo " Falls <neue TID> angegeben wird, werden die." echo " Falls <neue TID> angegeben wird, werden die."
echo " Metadaten mit der neuen TID in die SuperX-DB" echo " Metadaten mit der neuen TID in die SuperX-DB"
echo " eingespielt (=Insert)." echo " eingespielt (=Insert)."
echo " " echo " bei dem ersten Parameter auto wird das aktuelle Verzeichnis als <alte TID> verwendet"
exit 0 echo " "
fi exit 0;;
auto)
erste_TID=` expr "$PWD" : ".*/\(.*\)"`
echo "--auto=$erste_TID";;
*)
erste_TID=$1
echo "$1=$erste_TID";;
esac
zweite_TID="$2" zweite_TID="$2"
@ -32,120 +39,9 @@ if [ "$1" = "$2" ]
then zweite_TID="" then zweite_TID=""
fi fi
########################################################################################################
# sx_auto_insert_mask ruft jetzt sx_insert_mask damit die funtionalistät zentral gepflegt wird
#------------------------------------------------------------------- echo J|sx_insert_mask $erste_TID $zweite_TID
#-- Metadaten laden
#-------------------------------------------------------------------
alte_TID=$1
if [ "$zweite_TID" = "" ]
then NTID=$alte_TID
else
NTID=$zweite_TID
# maskeninfo.unl
# Nur 1. Zeile: 1. Feld -> NTID
head -1 $alte_TID"_maskeninfo.unl" | \
awk 'BEGIN {FS="'$DBDELIMITER'"; OFS="'$DBDELIMITER'";i=0;}
{ if (i==0) {$1="'$NTID'"; print $0; i=i+1; exit;}
}' >$NTID"_maskeninfo.unl";
## tail +2 $alte_TID"_maskeninfo.unl" >> $NTID"_maskeninfo.unl"
tail -n +3 $alte_TID"_maskeninfo.unl" >> $NTID"_maskeninfo.unl"
# Der obige Trick ist erforderlich, da die TEXT-Felder der Maskeninfo
# mit einer binaere Null x00 beendet werden. Bei der ersten binaeren
# Null bricht awk ab !
# felderinfo.unl
# Alle Zeilen: 1. Feld -> NTID + lfd. Nr.
awk 'BEGIN {FS="'$DBDELIMITER'"; OFS="'$DBDELIMITER'";i=0;}
{ $1="'$NTID'"+i; print $0; i=i+1;
}' $alte_TID"_felderinfo.unl" >$NTID"_felderinfo.unl";
# masken_felder_bez.unl
# Alle Zeilen: 1. Feld -> NTID, 2. Feld -> NTID + lfd. Nr.
awk 'BEGIN {FS="'$DBDELIMITER'"; OFS="'$DBDELIMITER'";i=0;}
{ $1="'$NTID'"; $2="'$NTID'"+i; print $0; i=i+1;
}' $alte_TID"_masken_felder_bez.unl" >$NTID"_masken_felder_bez.unl";
# sachgeb_maske_bez.unl
# Alle Zeilen: 2. Feld -> NTID
awk 'BEGIN {FS="'$DBDELIMITER'"; OFS="'$DBDELIMITER'";}
{ $2="'$NTID'"; print $0; next;
}' $alte_TID"_sachgeb_maske_bez.unl" >$NTID"_sachgeb_maske_bez.unl";
# maske_system_bez.unl
# Alle Zeilen: 1. Feld -> NTID
awk 'BEGIN {FS="'$DBDELIMITER'"; OFS="'$DBDELIMITER'";}
{ $1="'$NTID'"; print $0; next;
}' $alte_TID"_maske_system_bez.unl" >$NTID"_maske_system_bez.unl";
fi
LINE=`grep -n "^-- START_SQL" $0 | awk 'BEGIN {FS=":"} {print $1; exit;}'`
##es kann sein, dass die folgende Zeile freigegeben (und die darunter auskommm.
##werden muss) - abhängig von sed!!
#tail +$LINE $0 | sed -e "s/\<\<NTID\>\>/$NTID/g" > tmp$MANDANTENID.sql
#MB 10.2009 -n ergänzt, nötig für Scientifc Linux
tail -n +$LINE $0 | sed -e "s/<<NTID>>/$NTID/g" > tmp$MANDANTENID.sql
if [ $SX_CLIENT = "dbaccess" ]
then
echo "load from "$NTID"_maskeninfo.unl insert into maskeninfo;" >>tmp$MANDANTENID.sql
echo "load from "$NTID"_felderinfo.unl insert into felderinfo;" >>tmp$MANDANTENID.sql
echo "load from "$NTID"_masken_felder_bez.unl insert into masken_felder_bez;" >>tmp$MANDANTENID.sql
echo "load from "$NTID"_sachgeb_maske_bez.unl insert into sachgeb_maske_bez;" >>tmp$MANDANTENID.sql
echo "load from "$NTID"_maske_system_bez.unl insert into maske_system_bez;" >>tmp$MANDANTENID.sql
$INFORMIXDIR/bin/dbaccess $DBNAME tmp$MANDANTENID.sql
else
DOSQL tmp$MANDANTENID.sql
datei=$NTID"_maskeninfo.unl"
sx_upload_records.x maskeninfo $datei
datei=$NTID"_felderinfo.unl"
sx_upload_records.x felderinfo $datei
datei=$NTID"_masken_felder_bez.unl"
sx_upload_records.x masken_felder_bez $datei
datei=$NTID"_sachgeb_maske_bez.unl"
sx_upload_records.x sachgeb_maske_bez $datei
datei=$NTID"_maske_system_bez.unl"
sx_upload_records.x maske_system_bez $datei
fi
rm tmp$MANDANTENID.sql
exit 0
#-------------------------------------------------------------------
# Nachfolgend sind die SQL-Statements aufgefuehrt
# - Sie werden mittels "tail -24 $0" gelesen.
# - awk ersetzt dann die alte durch die neue TID in den vier
# *.unl Dateien.
# - Der "sed" ersetzt dann <<NTID>> durch die eingegebene NTID.
# - psql fuehrt sie dann aus.
# - "exit 0" sorgt dafuer, dass die SQL-Statements nicht vom
# Shell-Scripts interpretiert werden.
# - -- START_SQL kennzeichnet den Start der SQL-Statements.
#-------------------------------------------------------------------
-- START_SQL
------------------------------------------------------------
-- Laden der Metadaten zu einer Maske
------------------------------------------------------------
delete from maskeninfo where tid = <<NTID>>;
delete from felderinfo where tid in
(select felderinfo_id from masken_felder_bez where maskeninfo_id = <<NTID>>);
delete from masken_felder_bez where maskeninfo_id = <<NTID>>;
delete from sachgeb_maske_bez where maskeninfo_id = <<NTID>>;
delete from maske_system_bez where maskeninfo_id = <<NTID>>;

2
superx/WEB-INF/conf/edustore/db/install/conf/builddatum.txt

@ -1 +1 @@
16.08.2023 26.08.2023

2
superx/WEB-INF/conf/edustore/db/install/conf/kern.rtf

File diff suppressed because one or more lines are too long

5
superx/WEB-INF/conf/obsoletfiles.txt

@ -60,6 +60,8 @@ WEB-INF/lib/jasperreports-javaflow-6.4.1.jar
WEB-INF/lib/jasperreports-chart-customizers-6.4.1.jar WEB-INF/lib/jasperreports-chart-customizers-6.4.1.jar
WEB-INF/lib/jasperreports-chart-themes-6.4.1.jar WEB-INF/lib/jasperreports-chart-themes-6.4.1.jar
WEB-INF/lib/hsqldb-1.8.0.10.jar WEB-INF/lib/hsqldb-1.8.0.10.jar
#WEB-INF/lib/kettle-core-6.0.0.0-353.jar
#WEB-INF/lib/kettle-engine-6.0.0.0-353.jar
WEB-INF/lib/commons-collections-2.1.1.jar WEB-INF/lib/commons-collections-2.1.1.jar
WEB-INF/lib/commons-dbcp-1.2.1.jar WEB-INF/lib/commons-dbcp-1.2.1.jar
WEB-INF/lib/commons-httpclient-2.0.jar WEB-INF/lib/commons-httpclient-2.0.jar
@ -1931,6 +1933,9 @@ xml/his1/images/tree/tree_plus_rect.gif
xml/his1/images/tree/tree_s.gif xml/his1/images/tree/tree_s.gif
xml/his1/images/tree/tree_t.gif xml/his1/images/tree/tree_t.gif
xml/his1/images/tree/tree_v.gif xml/his1/images/tree/tree_v.gif
upgradeMandantendir.x
copytoMandantendir.x
default/custom/custom_pdf.xsl.sam
#xml/kalendar_icon.gif #xml/kalendar_icon.gif
#xml/leer.gif #xml/leer.gif
#xml/spacer.gif #xml/spacer.gif

BIN
superx/WEB-INF/lib/superx5.0.jar

Binary file not shown.

10
superx/edit/check_authentication.inc

@ -1,10 +1,10 @@
<%@ page import ="org.dbforms.config.DbFormsConfigRegistry, <%@ page import ="org.dbforms.config.DbFormsConfigRegistry,
java.sql.Connection, java.sql.Connection,
java.sql.Statement, java.sql.PreparedStatement,
java.sql.ResultSet" %> java.sql.ResultSet" %>
<% <%
Connection conDbforms; Connection conDbforms;
Statement st; PreparedStatement st;
ResultSet l_rset; ResultSet l_rset;
conDbforms=null; conDbforms=null;
@ -15,8 +15,10 @@ conDbforms = DbFormsConfigRegistry.instance().lookup().getConnection(mandantenid
System.out.println("Error getting dbforms connection:" System.out.println("Error getting dbforms connection:"
+ e.getMessage()); + e.getMessage());
} }
st=conDbforms.createStatement(); st=conDbforms.prepareStatement("select sp_get_dbform_right(?,?) from xdummy");
l_rset = st.executeQuery("select sp_get_dbform_right('"+db_form_name+"',"+userid+") from xdummy"); st.setString(1,db_form_name);
st.setInt(2,Integer.parseInt(userid));
l_rset = st.executeQuery();
if(l_rset.next()==true) if(l_rset.next()==true)
{ {
erlaubt=l_rset.getString(1); erlaubt=l_rset.getString(1);

19
superx/edit/kern/show_html_content.jsp

@ -1,5 +1,5 @@
<%@page pageEncoding="UTF-8" contentType="text/html" %> <%@page pageEncoding="UTF-8" contentType="text/html" %>
<%@ page import ="org.dbforms.config.DbFormsConfigRegistry,java.sql.Connection,java.sql.Statement,java.sql.ResultSet" %> <%@ page import ="org.dbforms.config.DbFormsConfigRegistry,java.sql.Connection,java.sql.PreparedStatement,java.sql.Statement,java.sql.ResultSet" %>
<%if (request.getParameter("logoff") != null&&request.getSession()!=null) { <%if (request.getParameter("logoff") != null&&request.getSession()!=null) {
request.getSession().invalidate(); request.getSession().invalidate();
}; };
@ -65,11 +65,12 @@ conmm = DbFormsConfigRegistry.instance().lookup().getConnection(mandantenid);
//Ausgabe holen: //Ausgabe holen:
Statement st_output; PreparedStatement st_output;
ResultSet rs_output; ResultSet rs_output;
st_output=conmm.createStatement(); st_output=conmm.prepareStatement("select trim(content) from sx_repository where id=? and today() between gueltig_seit and gueltig_bis and aktiv=1");
String sql_output = "select trim(content) from sx_repository where id='" + IdOutput + "' and today() between gueltig_seit and gueltig_bis and aktiv=1"; st_output.setString(1,IdOutput);
rs_output = st_output.executeQuery(sql_output); System.out.println("here we are again2");
rs_output = st_output.executeQuery();
String sb_output=""; String sb_output="";
while (rs_output.next()) while (rs_output.next())
{ if(rs_output.getObject(1) !=null) { if(rs_output.getObject(1) !=null)
@ -82,11 +83,11 @@ if(sb_output==null || sb_output.equals(""))
//Ende Ausgabe holen //Ende Ausgabe holen
//Titel holen: //Titel holen:
Statement st_titel; PreparedStatement st_titel;
ResultSet rs_titel; ResultSet rs_titel;
st_titel=conmm.createStatement(); st_titel=conmm.prepareStatement("select trim(caption) from sx_repository where id=? and today() between gueltig_seit and gueltig_bis and aktiv=1");
String sql_titel = "select trim(caption) from sx_repository where id='" + IdOutput + "' and today() between gueltig_seit and gueltig_bis and aktiv=1"; st_titel.setString(1,IdOutput);
rs_titel = st_titel.executeQuery(sql_titel); rs_titel = st_titel.executeQuery();
String sb_titel=""; String sb_titel="";
while (rs_titel.next()) while (rs_titel.next())
{ if(rs_titel.getObject(1) !=null) { if(rs_titel.getObject(1) !=null)

2
superx/edit/kern/webapp_manager.jsp

@ -415,7 +415,7 @@ if(tab.equals("log"))
<h2 class="subtitle"> <h2 class="subtitle">
<div id="MaskSubHeader">Logtyp</div> <div id="MaskSubHeader">Logtyp</div>
</h2> </h2>
<div> (max. <input type="text" size="5" maxlength="5" name="loglines" value="100" /> Zeilen) <div> (max. letzte <input type="text" size="5" maxlength="5" name="loglines" value="100" /> Zeilen)
<textarea id="Inhalt" name="Inhalt" class="textarea" placeholder="Inhalt..." rows="20"></textarea> <textarea id="Inhalt" name="Inhalt" class="textarea" placeholder="Inhalt..." rows="20"></textarea>

Loading…
Cancel
Save