169 lines
4.8 KiB
Groovy
169 lines
4.8 KiB
Groovy
import com.dvelop.d3.server.Document
|
|
import com.dvelop.d3.server.core.D3Interface
|
|
import com.dvelop.d3.server.exceptions.SQLException
|
|
import com.dvelop.d3.server.exceptions.D3Exception
|
|
import groovy.transform.Field
|
|
|
|
D3Interface d3 = getProperty("d3");
|
|
|
|
@Field prg = "migration_notizen.groovy";
|
|
@Field version = "0.1";
|
|
@Field kunde = "Dr. Kleeberg & Partner GmbH";
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
// debug = 0 => es finden Änderungen am Datenbestand statt
|
|
// debug = 1 => es finden keine Änderungen am Datenbestand statt
|
|
@Field debug = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
def debugtext;
|
|
|
|
switch (debug)
|
|
{
|
|
case 0:
|
|
debugtext = "ausgeschaltet";
|
|
break;
|
|
default:
|
|
debugtext = "eingeschaltet (keine Aenderungen am Datenbestand)";
|
|
break;
|
|
}
|
|
|
|
|
|
|
|
xlog( d3, 4, "************************************************" );
|
|
xlog( d3, 4, "* Programm : " + prg );
|
|
xlog( d3, 4, "* Version : " + version );
|
|
xlog( d3, 4, "* Kunde : " + kunde );
|
|
xlog( d3, 4, "* geschrieben von : calb / d.velop AG" );
|
|
xlog( d3, 4, "* (c) d.velop AG" );
|
|
xlog( d3, 4, "************************************************" );
|
|
|
|
|
|
xlog( d3, 4, "Parameter: " );
|
|
xlog( d3, 4, "* DEBUG : " + debugtext );
|
|
|
|
|
|
|
|
|
|
xlog( d3, 4, "************************************************" );
|
|
|
|
|
|
|
|
def sqlQuery = "select id,ddf1,ddf48,ddf10,ddf21,ddf22,ddf25,ddf37,ddf42,ddf60,ddf69 from mig_beratungsakte where fehler is null and doku_id is null";
|
|
|
|
resultRows = d3.sql.executeAndGet( (String) sqlQuery );
|
|
|
|
if ( resultRows.size() > 0 )
|
|
{
|
|
xlog( d3, 4, " Es wurden " + resultRows.size() + " Treffer gefunden." );
|
|
xlog( d3, 4, "************************************************" );
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def xlog( D3Interface d3, int loglevel, String logtext )
|
|
{
|
|
def logdatei = "d:\\d3\\apps\\" + prg + ".txt";
|
|
def g_loglevel = 5;
|
|
def g_logdirect = "BEIDE"; // BEIDE oder D3LOG oder DATEI
|
|
def date = new Date();
|
|
def zeitstempel = date.format( "yyyy.MM.dd HH:mm:ss", TimeZone.getTimeZone('CET') );
|
|
def loglevel_lang = "[INFO ]";
|
|
|
|
|
|
|
|
|
|
|
|
if ( loglevel <= g_loglevel )
|
|
{
|
|
switch ( loglevel )
|
|
{
|
|
case 1:
|
|
loglevel_lang = "[FATAL]";
|
|
|
|
if ( ( g_logdirect == "D3LOG" ) || ( g_logdirect == "BEIDE" ) )
|
|
{
|
|
d3.log.critical( logtext );
|
|
}
|
|
break;
|
|
case 2:
|
|
loglevel_lang = "[ERROR]";
|
|
|
|
if ( ( g_logdirect == "D3LOG" ) || ( g_logdirect == "BEIDE" ) )
|
|
{
|
|
d3.log.error( logtext );
|
|
}
|
|
break;
|
|
case 3:
|
|
loglevel_lang = "[WARN ]";
|
|
|
|
if ( ( g_logdirect == "D3LOG" ) || ( g_logdirect == "BEIDE" ) )
|
|
{
|
|
d3.log.warn( logtext );
|
|
}
|
|
break;
|
|
case 4:
|
|
loglevel_lang = "[INFO ]";
|
|
|
|
if ( ( g_logdirect == "D3LOG" ) || ( g_logdirect == "BEIDE" ) )
|
|
{
|
|
d3.log.info( logtext );
|
|
}
|
|
break;
|
|
case 5:
|
|
loglevel_lang = "[DEBUG]";
|
|
// Da die d.3 Server i.d.R. nicht im Debug-Modus laufen, erscheinen DEBUG-Meldungen nicht im Log.
|
|
if ( ( g_logdirect == "D3LOG" ) || ( g_logdirect == "BEIDE" ) )
|
|
{
|
|
d3.log.debug( logtext );
|
|
}
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
if ( ( g_logdirect == "DATEI" ) || ( g_logdirect == "BEIDE" ) )
|
|
{
|
|
new File( logdatei ).append( zeitstempel + " " + loglevel_lang + " " + logtext + "\n", "UTF8" );
|
|
}
|
|
|
|
|
|
return 0;
|
|
} |