Aufteilen in Ordner
This commit is contained in:
1225
Kleeberg/hooks/20_value_sets.groovy
Normal file
1225
Kleeberg/hooks/20_value_sets.groovy
Normal file
File diff suppressed because it is too large
Load Diff
31
Kleeberg/hooks/30_hook.jpl
Normal file
31
Kleeberg/hooks/30_hook.jpl
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
proc kle_hostimp_entry_10( user, doc_type_short )
|
||||
{
|
||||
//////////////////////////////////////
|
||||
// Falls "Oberregister" (DDF3) nicht gesetzt ist, setze das Feld auf "99 Nicht zugeordnete Dokumente" START
|
||||
//////////////////////////////////////
|
||||
|
||||
vars dokarten1 = "DBETR;DDAUE;DABSC;DBERA;DSTEU;DFIBU;DLOHN;DDEBD;DLSTD;DKRED;ABPSA;ABESA;AFBSA;AJASA;ALOSA;ASTSA;AJAOB;ALBRE;AJAAB;ABERO;ABERA;ASTOR;ASTRA;ABEPA;ABEOR;AFIOR;AFIRA;ALBOR;ALBSO;AAURR;AKROR"
|
||||
vars dokarten2 = "DUMMY;AOREG;AREGS;AUREG;AURG2;AURG3;AAURU;AAUR2;ABEUR;ABEU2;ABPUR;ABPU2;AFIUR;AFIU2;AJAUR;AJAU2;ALJUR;ALOUR;ALJR2;ALBU2;ASTU2;ASTUR;ADAUR;ABERB;ABETR;AFIBA;AJAAA;AKRED;ALOJA;ALBSA;ASTEU"
|
||||
|
||||
vars ergebnis1 = api_function( "string_get_position", dokarten1, doc_type_short, 1, 1 )
|
||||
vars ergebnis2 = api_function( "string_get_position", dokarten2, doc_type_short, 1, 1 )
|
||||
|
||||
if ( ( ergebnis1 > 0 ) || ( ergebnis2 > 0 ) )
|
||||
{
|
||||
if ( @length( dok_dat_feld[ 3 ] ) == 0 )
|
||||
{
|
||||
dok_dat_feld[ 3 ] = "99 Nicht zugeordnete Dokumente"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Falls "Oberregister" (DDF3) nicht gesetzt ist, setze das Feld auf "99 Nicht zugeordnete Dokumente" ENDE
|
||||
//////////////////////////////////////
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
3346
Kleeberg/hooks/30_hooks.groovy
Normal file
3346
Kleeberg/hooks/30_hooks.groovy
Normal file
File diff suppressed because it is too large
Load Diff
24
Kleeberg/hooks/ERwflProcessConstants.groovy
Normal file
24
Kleeberg/hooks/ERwflProcessConstants.groovy
Normal file
@@ -0,0 +1,24 @@
|
||||
public class ERwflProcessConstants{
|
||||
|
||||
// Base-Uri without trailing "/"
|
||||
static final String gBaseUri = "https://d3one.kleeberg.kleeberg.de";
|
||||
|
||||
// API-Key of a user with the right to start a process. It is recommended to use a user without d.3 document permissions
|
||||
static final String gApiKey = "BkelbC0cc2uf1PZ4Aftzvtw/tQKsUR7AGbj0/IrTDl/wIu34gyX4LWWU4NUkTDYEWF9uOfpxTIwn48fke1xzs8jJ5/dXf5ABBWRhuff/Z3U=&_z_A0V5ayCSDIwDiNS1nL5awyU2f_-oPqbOvu-W7spr3dMu6-RJODofIJ5nAN5pPh6GH3hdFbitxB2cXYhhUspF1O2Bu33Qq";
|
||||
|
||||
// Process ID
|
||||
static final String gProzessId = "Eingangsrechnungsworkflow";
|
||||
|
||||
// Repository ID
|
||||
static final String gRepoId = "7b813cf7-9909-54ba-a333-f62d302fdfdc";
|
||||
|
||||
// Dokumenttype used within the Hook-Definition
|
||||
static final String gDocType = "DEREC"
|
||||
|
||||
// Assignee group for first Task
|
||||
//static final String gBuchhaltung = "identity://" + "/identityprovider/scim/groups/dd1cbb6d-8603-4ffd-a666-f0d61c9502df"; //ID ist von der Gruppe D3T_BUHA
|
||||
static final String gBuchhaltung = "identity://" + "/identityprovider/scim/groups/7a37a8d3-45ff-46fa-9b3a-451681f7ac95"; //ID ist von der Gruppe D3T_BUHA_ER (Laut Fehlerliste soll hier eine Umstellung auf die Gruppe D3T_BUHA_ER umgestellt werden)
|
||||
|
||||
// Subject first Task
|
||||
static final String gSubject = "Eingangsrechnungsworkflow initial zur weiteren Bearbeitung prüfen";
|
||||
}
|
||||
89
Kleeberg/hooks/EingangsrechnungsWorkflow.groovy
Normal file
89
Kleeberg/hooks/EingangsrechnungsWorkflow.groovy
Normal file
@@ -0,0 +1,89 @@
|
||||
// Hooks
|
||||
import com.dvelop.d3.server.*
|
||||
import com.dvelop.d3.server.core.D3Interface
|
||||
|
||||
// REST / Http
|
||||
import javax.net.ssl.HttpsURLConnection
|
||||
import groovy.json.JsonSlurper
|
||||
|
||||
|
||||
class Eingangsrechnungsworkflow {
|
||||
|
||||
// Constructor
|
||||
Eingangsrechnungsworkflow() {}
|
||||
|
||||
@Entrypoint(entrypoint = "hook_insert_exit_30")
|
||||
@Condition(doctype = [ERwflProcessConstants.gDocType])
|
||||
int ProcessInsertExit30_1(D3Interface d3, Document doc, String fileDestination, Integer importOk, User d3User, DocumentType docType){
|
||||
|
||||
def processId = ERwflProcessConstants.gProzessId;
|
||||
def baseUri = ERwflProcessConstants.gBaseUri;
|
||||
def repoId = ERwflProcessConstants.gRepoId;
|
||||
def docId = doc.id;
|
||||
def subject = ERwflProcessConstants.gSubject;
|
||||
def empfaengerBuchhaltung = ERwflProcessConstants.gBuchhaltung;
|
||||
def date = new Date();
|
||||
def timeString = date.getDateTimeString();
|
||||
def businessKey = "${processId}-${timeString}-${docId}";
|
||||
businessKey = businessKey.replaceAll(" ", "");
|
||||
|
||||
|
||||
def jsonBody = """{
|
||||
"businessKey": "${businessKey}",
|
||||
"variables": {
|
||||
"empfaengerBuchhaltung" : "${empfaengerBuchhaltung}",
|
||||
"formInstanceId" : "${businessKey}",
|
||||
"baseUri" : "${baseUri}",
|
||||
"docId" : "${docId}",
|
||||
"repoId" : "${repoId}",
|
||||
"subject" : "${subject}",
|
||||
"dv_attachment": "dmsObject:///dms/r/${repoId}/o2/${docId}"
|
||||
}
|
||||
}"""
|
||||
|
||||
def migrationDoc = doc.field[48];
|
||||
|
||||
if ( migrationDoc == null || migrationDoc == "" ){
|
||||
d3.log.info("ProcessInsertExit30_1 - Groovy hook insert_exit_30_1 " + doc.id + processId);
|
||||
|
||||
validateGenericProcessStart( d3, doc, d3User, processId, jsonBody );
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
public static def validateGenericProcessStart(D3Interface d3, Document doc, User d3User, def processId, def jsonBody ) {
|
||||
|
||||
try {
|
||||
def body = jsonBody;
|
||||
|
||||
def http = new URL( ERwflProcessConstants.gBaseUri + "/process/processes/" + processId + "/instances").openConnection() as HttpsURLConnection
|
||||
http.setRequestMethod('POST')
|
||||
http.setDoOutput(true)
|
||||
http.setRequestProperty("Content-Type", "application/json; charset=utf-8")
|
||||
http.setRequestProperty("Authorization", "Bearer " + ERwflProcessConstants.gApiKey )
|
||||
http.setRequestProperty("Accept-Charset" , "utf-8")
|
||||
|
||||
http.outputStream.write(body.getBytes("UTF-8"))
|
||||
http.connect()
|
||||
|
||||
def response = [:]
|
||||
|
||||
if (http.responseCode == 200 || http.responseCode == 201) {
|
||||
def location = http.getHeaderField("location");
|
||||
d3.log.info("Process was started: " + location);
|
||||
d3.log.info("Process was started on: " + http);
|
||||
d3.log.info("Process was started on baseUri: " + ERwflProcessConstants.gBaseUri );
|
||||
} else {
|
||||
response = http.getResponseMessage()
|
||||
d3.log.error("Error while starting process: " + response + "(" + http.responseCode + ")");
|
||||
d3.log.error("POST-Request send: " + http + "(" + http.responseCode + ")");
|
||||
return -1;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
d3.log.error("Exception while starting process: " + e.getMessage());
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user