38 lines
2.3 KiB
Groovy
38 lines
2.3 KiB
Groovy
//Dieses Skript erzeugt gezielt für Dokumente eine Rendition
|
|
//Ausgeführt wird dieses Skript per d.3 server interface, zuvor muss das SQL-Statement angepasst werden. Das SQL-Statement muss die Dokumenten-IDs der Dokumente liefern, für die eine Rendition erzeugt werden soll.
|
|
//Es muss ein Benutzer "scriptUser" angegeben werden, der volle Rechte für die entsprechenden Dokumente hat.
|
|
|
|
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 javax.swing.*;
|
|
String scriptName = getClass().getName()
|
|
|
|
int dialogButton = JOptionPane.YES_NO_OPTION;
|
|
int dialogResult = JOptionPane.showConfirmDialog (null, "Dies ist ein nicht supportetes Tool und ist nur fuer den internen Einsatz durch die d.velop AG gedacht.\nEs koennen erhebliche Schaeden in Ihrer d.3 Umgebung entstehen.\n \nWollen Sie wirklich fortfahren?\n ---------------------------------------------------\nThis is an unsupported tool and is only intended for internal use by d.velop AG.\nConsiderable damage can occur in your d.3 environment.\n \nAre you sure you want to continue?","Warning",dialogButton);
|
|
if(dialogResult == JOptionPane.NO_OPTION){
|
|
d3.log.info(scriptName + " - cancel")
|
|
return 0;
|
|
}
|
|
|
|
final def maxRows = 3000
|
|
String scriptUser = "d3_groovy"
|
|
int render_option = 2 //0=Nur OCR, 1=TIFF, 2=PDF, 3=TIFF und PDF
|
|
boolean ocr = true
|
|
boolean replace_doc = false
|
|
boolean overwrite = true //false=Auftrag für Rendition wird nur erzeugt, wenn noch keine Rendition vorhanden ist, true=Auftrag für Rendition wird immer erzeugt
|
|
String prio = "normal" //mögl. Wertelow, normal, high
|
|
|
|
def resultSet = d3.sql.executeAndGet("select doku_id from firmen_spezifisch where doku_id = 'A000016491'", maxRows)
|
|
d3.log.info (scriptName + " - "+resultSet.size()+" Documents found for rendition creation")
|
|
for (row in resultSet)
|
|
{
|
|
try {
|
|
def retval = d3.call.document_render ("", "", render_option, ocr, true, replace_doc, overwrite, row["doku_id"], scriptUser, "", 0, prio);
|
|
d3.log.info (scriptName + " - create rendition for " + row["doku_id"] + "--> " + retval)
|
|
}
|
|
catch (D3Exception e) {
|
|
d3.log.error("Error creating rendition " + e.getMessage())
|
|
}
|
|
} |