Optima Groovy-Hooks hinzugefügt

This commit is contained in:
2026-02-06 13:42:40 +01:00
parent 12ef4a546d
commit f5f97b8886
15 changed files with 20476 additions and 0 deletions

456
Optima/_Groovy/Const.groovy Normal file
View File

@@ -0,0 +1,456 @@
// --------------------------------------------------------------------------------------------------------
// Const.groovy
// --------------------------------------------------------------------------------------------------------
//
// Groovy Definitionsdatei für alle benötigten Dokument- und Aktenarten,
// sowie DokDatfelder und RepositoryIDs
//
// --------------------------------------------------------------------------------------------------------
public class Const {
// Dokumentarten
// --- Teilprojektübergreifend ---
static final String gDTS_DKUKO = "DKUKO"; //Kundenkontaktdokumente
static final String gDTS_DLIKO = "DLIKO"; //Lieferantenkontaktdokument
static final String gDTS_DKOMM = "DKOMM"; //Email Kommunikation
static final String gDTS_DPRST = "DPRST"; //Projektsteuerungsdokumente (01 Projektorganisationsdokumente)
static final String gDTS_SAPDO = "SAPDO"; //SAP-Dokumente für die Migr
static final String gDTS_DVORL = "DVORL"; //90 Vorlagen
static final String gDTS_DUMMY = "Dummy"; //globale Suche
static final String gDTS_DALTD = "DALTD" //Altdokumente
// --- Organisationsprojekt ---
static final String gDTS_DPROO = "dproo"; //Organisationsprojektdokume
// --- Opportunity ---
static final String gDTS_DOPPD = "DOPPD"; //Angebotsdokumente
static final String gDTS_DVERD = "DVERD"; //Vertragrelevante Dokumente
// --- Bauakte ---
static final String gDTS_DBAUD = "DBAUD"; //Baudokumente
static final String gDTS_DABAU = "DABAU"; //abhängige Baudokumente
static final String gDTS_DBAAU = "DBAAU"; //Baudokumente Ausführung
static final String gDTS_DBAAS = "DBAAS"; //Baudokumente Ausschreibung
static final String gDTS_DBABE = "DBABE"; //Baudokumente Besprechungen
static final String gDTS_DBAGE = "DBAGE"; //Baudokumente Genehmigung
// --- Schulungsdokumente ---
static final String gDTS_DSCHU = "DSCHU"; //Schulungsdokumente
static final String gDTS_DREGE = "DREGE"; //Regelberichte
// --- Regelberichte ---
static final String gDTS_DAREG = "DAREG"; //Anhänge zu Regelberichten
// --- Marktforschungsdokumente ---
static final String gDTS_DMARK = "DMARK"; //Marktbeobachtungsdokumente
static final String gDTS_AMARK = "AMARK" //01.02.02 Marktforschungsprojekte
// --- Maschinenprojekt ---
static final String gDTS_DVERT = "DVERT"; // Vertragsdokumente
static final String gDTS_DMDOK = "DMDOK"; //Technikdokumente
static final String gDTS_DMAUF = "DMAUF"; //Vertriebsdokumente
static final String gDTS_DMSPE = "DMSPE"; //Spezifikationsdokumente
static final String gDTS_DMECR = "DMECR"; //ECR-Dokumente
static final String gDTS_DMEOP = "DMEOP"; //Ergebnisdokumente Opportunity (in Maschinenprojekt)
// --- Wissensmanagement ---
static final String gDTS_DWISS = "DWISS"; //Wissensdokumente
static final String gDTS_AWISS = "AWISS"; //Wissensarchiv
// --- Hauptvorgaenge
static final String gDTS_DOSSI = "DOSSI"; //Dossier
static final String gDTS_ATEIL = "ATEIL"; //Teilvorgangsakte
static final String gDTS_AHAUP = "AHAUP"; //Hauptvorgangsakte
// --- Lieferantenmanagement
static final String gDTS_DLIMA = "DLIMA" //Lieferantendokumente
static final String gDTS_DLONT = "DLONT" //Lieferantenkontakt_Neu (Lieferantenmanagement)
// --- Kundenmanagement
static final String gDTS_DKUMA = "DKUMA" //Kundendokumente (Kundenmanagement)
static final String gDTS_DERZD = "DERZD" //Erzeugnisdokumente
// --- Einkauf
static final String gDTS_DEINK = "DEINK" //Einkausbelegdokument
// --- Material
static final String gDTS_DMATE = "DMATE" //Materialdokumente
// Aktenarten
// --- Teilprojektübergreifend ---
static final String gDTS_APROA = "aproa"; //Prozess
static final String gDTS_APROZ = "aproz"; //Prozessart
static final String gDTS_APROG = "aprog"; //Prozessgruppe
static final String gDTS_AAFOL = "aafol"; //administrative folder
static final String gDTS_AZTXT = "AZTXT"; //administrative translation
static final String gDTS_AADOM = "AADOM"; //administrative domains
static final String gDTS_ALIEF = "ALIEF"; //Lieferantenakte
static final String gDTS_AKONT = "AKONT"; //Kundenkontakt
static final String gDTS_AKUND = "AKUND"; //Kundenakte
static final String gDTS_AKUKO = "AKUKO"; //Kundenaktivität
static final String gDTS_ALIEK = "ALIEK"; //Projektbeschaffung
static final String gDTS_ALIKO = "ALIKO"; //Lieferantenkontakt oder Projektlieferant
static final String gDTS_AKONA = "AKONA"; //Kontaktakte OP
static final String gDTS_APROR = "APROR"; //Projektorganisation
static final String gDTS_AABWL = "AABWL"; //Ablage Whitelist
static final String gDTS_AUNMA = "AUNMA"; //Unterakte Marktforschungsprojekte
static final String gDTS_AGLAK = "AGLAK"; // GL-Akte
static final String gDTS_DLOEH = "DLOEH"; //Notizdokumente
// --- Organisationsprojekte ---
static final String gDTS_AMEIS = "ameis"; //Meilensteine / Arbeitspakete
static final String gDTS_APROJ = "aproj"; //Organisationprojekte
// --- Opportunity ---
static final String gDTS_AREGI = "AREGI"; //Angebotsversion
static final String gDTS_AUNTE = "AUNTE"; //Angebotsvorgang
static final String gDTS_AOPPU = "AOPPU"; //Opportunityakte
static final String gDTS_AANGE = "AANGE"; //Angebot
static final String gDTS_AANGU = "AANGU"; //Angebotsübergreifend/vor Angebot
static final String gDTS_AKOMM = "AKOMM"; //Kommunikation
static final String gDTS_AVERT = "AVERT"; //Verträge/Vereinbarungen
static final String gDTS_AERGE = "AERGE"; //Vertragsergebnis
static final String gDTS_ASOPP = "ASOPP"; //Suche Opportunitydokumente
// --- Bauprojekt ---
static final String gDTS_ABAUG = "ABAUG"; //Bauaktengruppe
static final String gDTS_ABAUK = "ABAUK"; //Bauakte
static final String gDTS_ABAUN = "ABAUN"; //Bauakte untergeordnet
static final String gDTS_ABAUP = "ABAUP"; //Bauprojekte
static final String gDTS_ABAUA = "ABAUA"; //Bauplanänderung Akte
static final String gDTS_ABESP = "ABESP"; //Bauakte_Besprechungen
static final String gDTS_AGENB = "AGENB"; //Genehmigung_Bauprojekt
static final String gDTS_AAUSB = "AAUSB"; //Ausschreibung_Bauprojekt
// --- Maschinenprojekt ---
static final String gDTS_AMPRA = "AMPRA"; //Maschinenprojektakte
static final String gDTS_AMAUF = "AMAUF"; //Vertrieb
static final String gDTS_AMPRO = "AMPRO"; //Unterakte Technik
static final String gDTS_AMUEB = "AMUEB"; //Maschinenübergreifend
static final String gDTS_AMAKT = "AMAKT"; //Technik
static final String gDTS_AMNAC = "AMNAC"; //Unterakte Vertrieb
static final String gDTS_AMSPE = "AMSPE"; //Spezifikation
static final String gDTS_AMUPO = "AMUPO"; //Unterakte Projektorganisation
static final String gDTS_AMCRA = "AMCRA"; //ECR-Akte
static final String gDTS_AMECR = "AMECR"; //Unterakte ECR
static final String gDTS_AMUSP = "AMUSP"; //Unterakte Spezifikation
static final String gDTS_AMEOP = "AMEOP"; //Akte Ergebnis Opportunity (in Maschinenprojekt)
static final String gDTS_ASMAS = "ASMAS"; //Maschinenprojektdokumente
static final String gDTS_DERZ1 = "DERZ1"; // Maschinendokumente (vorher neutrale Maschinendokumente)
static final String gDTS_DSOFT = "DSOFT"; // Alle Software-Dokumente
static final String gDTS_AERZ1 = "AERZ1"; // Maschine
static final String gDTS_DMAP1 = "DMAP1"; // Alle Maschinenprojekt Dokumente
static final String gDTS_DOPP1 = "DOPP1"; // Alle Opportunity Dokumente
static final String gDTS_ENTMAP = "DPEN1"; // Entwicklungsprojektdokumente - Sammler für Primärentwicklung
// --- Primärentwicklung
static final String gDTS_APREN = "APREN"; //02.04 Entwicklungsprojektakte
// --- Abteilungsdokumente ---
static final String gDTS_AREME = "AREME"; //01.03.02 Abteilungsakte
static final String gDTS_AVODA = "AVODA"; //Vorgangsdatum Akte
static final String gDTS_DABTE = "DABTE"; //Abteilungsdokumente
// --- Sonstige ---
static final String gDTS_DVEME = "DVEME"; //Vertriebsmedien
static final String gDTS_AVEVO = "AVEVO"; //Vertrauliche Vorgangsakte
static final String gDTS_DVEDO = "DVEDO"; //Vertrauliche Dokumente
static final String gDTS_EVDOK = "EVDOK"; //Vertragsdokument
static final String gDTS_EVUNT = "EVUNT"; //Vertragsunterlage
static final String gDTS_EVERT = "EVERT"; //Einzelvertrag
static final String gDTS_RVERT = "RVERT"; //Rahmenvertrag
static final String gDTS_MNDNT = "MNDNT"; //Organisationseinheit dbs CaseMngr Contract
static final String gDTS_DMATO = "DMATO"; // Marketingtooldokumente
static final String gDTS_PRTNR = "PRTNR"; //Partnerakte
// --- Lieferantenmanagement
static final String gDTS_ALIMA = "ALIMA"; //Lieferantenmanagement
static final String gDTS_ALIAK = "ALIAK"; //Lieferantenaktivität (Lieferantenmanagement)
static final String gDTS_ALONT = "ALONT"; //Lieferantenkontakt_neu (Lieferantenmanagement)
static final String gDTS_AKUMA = "AKUMA"; //Kundenmanagement
static final String gDTS_AEINK = "AEINK"; //Prozess (Lieferant)
// --- Service
static final String gDTS_DSERE = "DSERE"; //Service Request Dokumente
static final String gDTS_ASERE = "ASERE"; //Service Request Akte
static final String gDTS_DSEBE = "DSEBE"; //Service Beleg Dokumente
static final String gDTS_ASEBE = "ASEBE"; //Service Beleg Akte
static final String gDTS_DSEFA = "DSEFA"; // Service Faktura Dokumente
static final String gDTS_DSELI = "DSELI"; // Service Lieferung Dokumente
static final String gDTS_DSER1 = "DSER1"; // Dokumentsammler für Servicedokumente
// --- ITSM
static final String gDTS_AITSM = "AITSM"; //ITSM Akte
static final String gDTS_DITSM = "DITSM"; //ITSM Dokumente
// --- Equipment
static final String gDTS_DEQUI = "DEQUI"; //Equipment Dokumente
static final String gDTS_AEQUI = "AEQUI"; //Equipment Akte
// --- Einkauf
static final String gDTS_AEIBE = "AEIBE"; //Einkaufsbeleg
// --- Material
static final String gDTS_AMATE = "AMATE" //Materialakten
// --------------------------------------------------------------------------------------------------------
// DocField IDs
// --------------------------------------------------------------------------------------------------------
static final int gDDF_PROJNR = 1; //Projekt-Nr.
static final int gDDF_STATUS = 1; //Status
static final int gDDF_PARTNERID = 1; //PartnerID
static final int gDDF_CONTRACTNO = 1; //Vertragsnummer intern
static final int gDDF_PROJTITLE = 2; //Projekt-Titel
static final int gDDF_OPPANNr = 2; //Angebot_Nr
static final int gDDF_PSPELEMENT = 2; //PSP-Element
static final int gDDF_ZIELDTS = 2; //Zieldokumentart
static final int gDDF_PARTNERNAME = 2; //Partnername
static final int gDDF_PROZESS = 3; //Prozess
static final int gDDF_CONTRACTNAME = 3; //Vertragsbezeichnung
static final int gDDF_PROZESSGROUP = 4; //Prozessgruppe
static final int gDDF_MASCHINENTYP = 4; //Maschinentyp (Achtung: Es gibt Maschinentyp und Maschinen_Typ)
static final int gDDF_PROZESSART = 5; //Prozessart
static final int gDDF_IHL = 5; //IH-Leistungsart (Service | GROOVY)
static final int gDDF_PROJLEITER = 6; //Projektleiter
static final int gDDF_ABTSENDER = 6; //Abteilung (Sender)
static final int gDDF_PROJVABT = 7; //Projektverantw. Abteilung
static final int gDDF_SENDER = 7; //Absender
static final int gDDF_PROJSTATUS = 8; //Projektstatus
static final int gDDF_PROJKLAMMER = 8; //Projektklammer
static final int gDDF_BELEGTYP = 8; //Belegtyp/-art ( Service | GROOVY )
static final int gDDF_BASEOPP = 9; //zugrundeliegende Opportunity
static final int gDDF_PROJEKTPHASE = 9; //Projektphase
static final int gDDF_EQUIPMENT = 9; //Equipment
static final int gDDF_LNR = 10; //Lieferant_Nr
static final int gDDF_EVENT = 10; //Vorgang
static final int gDDF_CASE = 10; //Vorgang
static final int gDDF_LNAME = 11; //Lieferant_Name
static final int gDDF_VORGANGSSTATUS = 11; //Vorgangsstatus
static final int gDDF_NPN = 12; //Netzplan_Nr
static final int gDDF_UNTERBAUAKTE = 12; //untergeordnete Bauakte
static final int gDDF_GLAKTYP = 12; //GL-Akten Typ
static final int gDDF_NPVN = 13; //Netzplanvorgangsnummer
static final int gDDF_BAUAKTENGRUPPE = 13; //Bauaktengruppe
static final int gDDF_MUSTERMATNR = 13; //Mustermaterial Nr.
static final int gDDF_VOROWNER = 13; //Vorgangsbesitzer
static final int gDDF_CASEOWNER = 13; //Vorgangsbesitzer
static final int gDDF_LNAME2 = 13; //Lieferant_Name2
static final int gDDF_ENDKUNDENNR = 13; //Endkunden_Nr
static final int gDDF_ENDKUNDENAM = 14; //Endkunden_Name
static final int gDDF_GREMIUN = 14; //Gremium
static final int gDDF_RESPSALESMAN = 14; //zust. Verkäufer
static final int gDDF_LLAND = 14; //Lieferant_Land
static final int gDDF_KONTAKTNUMMER = 15; //Kundenkontakt_ID
static final int gDDF_AKTIVITAETSID = 15; //ECR Aktivitäts_ID
static final int gDDF_ORGEINHEIT = 15; //Organisationseinheit dbs CaseMngr Contract
static final int gDDF_ITSMID = 15; //ITSM ID
static final int gDDF_ORDNUNG = 16; //Ordnung
static final int gDDF_AKTENGRP = 16; //Aktengruppe (Equipment)
static final int gDDF_APPHASE = 16; //Arbeitspaketphase
static final int gDDF_ADITTITLE = 16; //Zusatztitel
static final int gDDF_ORGPROJVERT = 16; //Org.Projekt_Vertretung
static final int gDDF_DOKTITLE = 17; //Dokumenttitel
static final int gDDF_DOKGRP = 18; //Dokumentkategorie
static final int gDDF_AKTENANLAGE = 18; //Nur Aktenanlage
static final int gDDF_REIHENFOLGE = 18; //Reihenfolge
static final int gDDF_LORT = 18; //Lieferant_Ort
static final int gDDF_MSAPS = 19; //Meilenstein/Arbeitspaket
static final int gDDF_AUFTRNR = 19; //Projekt_Nr
static final int gDDF_ANZZUGRIFFE = 19; //Anzahl Zugriffe
static final int gDDF_PROJVERKN = 20; //Projektverknüpfung
static final int gDDF_ANGELEGTVON = 20; //Angelegt von
static final int gDDF_FRAGESTELLUNG = 20; //Fragestellung
static final int gDDF_MATERIALNUMMER = 20; //Material_Nr
static final int gDDF_MODUL = 20; //Modul (Erzeugnisstruktur)
static final int gDDF_MODULM = 20; //M-Modul (Maschinendokumente)
static final int gDDF_NEUEFRAGE = 21; //Neue Fragestellung
static final int gDDF_DOKGROUP = 21; //Dokumentgruppe
static final int gDDF_KNR = 22; //Kunden_Nr
static final int gDDF_THEMEN = 22; //Themen (Caption für Wissensdokumente)
static final int gDDF_KNAME = 23; //Kunden_Name
static final int gDDF_ABBAUAKTE = 23; //abhängige Bauakte
static final int gDDF_KDAKTNAME = 24; //Kundenkontakt_Beschreibung
static final int gDDF_BESCHREIBUNG = 24; //ECR Beschreibung
static final int gDDF_BAUAKTE = 24; //Bauakte
static final int gDDF_SRID = 25; //Service-Request ID ( Service | GROOVY )
static final int gDDF_BAUPLANAENDERUNG = 25; //Bauprojekt Unteraktentitel
static final int gDDF_KDANPRT = 25; //Kunden_Ansprechpartner
static final int gDDF_ORGENTRY = 25; //Originaleintrag
static final int gDDF_DOMAIN = 25; //Domäne
static final int gDDF_REGISTER = 26; //Register
static final int gDDF_REFERENZOBJ = 26; //Referenzobjekt (wird über SAP gefüllt)
static final int gDDF_CLASS = 27; //Klasse
static final int gDDF_DTSKIND = 27; //Dokumentart des Kindes bei Verknüpfungs-Whitelist
static final int gDDF_ZUGRIFF = 27; //Zugriff
static final int gDDF_REFERENZNR = 27; //ReferenzNr (wird über SAP gefüllt)
static final int gDDF_BUCHKREIS = 28; //Buchungskreis
static final int gDDF_HAUPTPROJEKT = 29; //Hauptprojekt // TODO in den D3 Eigenschaften ist Feld 29 die Projektklammer!!
static final int gDDF_PROJEKTKLAMMER = 29;
static final int gDDF_HAUPTOPPANNR = 29; //Hauptangebot_Nr
static final int gDDF_FUNKTION = 29; //Funktion (Erzeugnisstruktur)
static final int gDDF_MARKETINGPROJEKT = 30; //Marktforschungsprojekt
static final int gDDF_ANLAGE = 30; //Anlage
static final int gDDF_KATEGORIE = 30; //Kategorie
static final int gDDF_BAUPROJEKT = 30; //Bauprojekt
static final int gDDF_SORTIERUNG = 30; //Sortierreiehenfolge
static final int gDDF_HAUPTVONR = 30; //Hauptvorgangsnummer
static final int gDDF_OPPNUMMER = 31; //Opportunity_Nr
static final int gDDF_GESPARTNR = 31; //Geschäftspartnernummer
static final int gDDF_HAUPTVOBEZ = 31; //Hauptvorgangsbezeichnung
static final int gDDF_BELEGNUMMER = 31; //Belegenummer ( Service | GROOVY )
static final int gDDF_KOMMRICHTUNG = 32; //Kommunikationsrichtung
static final int gDDF_TEILVONR = 32; //Teilvorgangsnummer
static final int gDDF_TEILVOBEZ = 33; //Teilvorgangsbezeichnung
static final int gDDF_JAHR = 33; //Jahr
static final int gDDF_MONAT = 34; //Monat
static final int gDDF_STRUKTURINFO = 34; //Strukturinformationen
static final int gDDF_VKPHASE = 35; //CRM-Verkaufsphase
static final int gDDF_HAUPTOPP = 36; //Hauptopportunity
static final int gDDF_SUBMISSION = 37; //Submission
static final int gDFF_SCHLUESSEL = 38; //Schlüsselwert
static final int gDDF_SRKATEGORIE = 38; //Service Request Kategorie ( Service | GROOVY )
static final int gDFF_ABTEILUNG = 39; //Abteilung (aus Org. Mgmt.)
static final int gDDF_ANNAME = 40; //Angebot_Name
static final int gDDF_SAPBESCHREIBUNG = 40; //SAP Beschreibung ITSM / Equipment
static final int gDDF_SVBESCHREIBUNG = 40; //Beschreibung ( Service | GROOVY )
static final int gDDF_ANNEU = 41; //neue Angebotsversion
static final int gDDF_ANFORDERER = 41; //Anforderer
static final int gDDF_MAPPCUSTACTION = 41; //Zuordnung Kundenkontakt
static final int gDDF_KDAKTLAND = 42; // Kunde Land
static final int gDDF_ANSTATUS = 43; //Angebotsstatus
static final int gDDF_ECRSTATUS = 43; //ECR Status
static final int gDDF_KDAKTORT = 43; // Kunde Ort
static final int gDDF_ERGEBNISDOK = 44; //Ergebnisdokumente
static final int gDDF_ANWENDUNGSFALL = 45; //Anwendungsfall
static final int gDDF_DTSVATER = 45; //Dokumentart des Vaters bei Verknüpfungs-Whitelist
static final int gDDF_KDAKTKAT = 45; //Kundenkontakt_Kategorie
static final int gDDF_LIEFAKTKAT = 45; //Lieferantenkontakt_Kategorie
static final int gDDF_KONTAKTBESCH = 46; //Kontakt_Beschreibung
static final int gDDF_KDAKTBESCH = 46; //Kundenkontakt_Beschreibung
static final int gDDF_KURZTEXT = 46; //Kurztext ( Service | GROOVY )
static final int gDDF_SALESGROUP = 47; //Verkäufergruppe
static final int gDDF_SUBJECT = 48; //Betreff
static final int gDDF_AKTE = 48; //Akte (Equipment)
static final int gDDF_BELEGART = 48; //Betreff
static final int gDDF_ARCDOCID = 49; //ARC Doc ID
static final int gDDF_BESPRTITEL = 49; //Besprechungstitel
static final int gDDF_ERDATE = 50; //Ereignisdatum
static final int gDDF_KONTAKTDATE = 52; //Kundenkontakt_Termin
static final int gDDF_DOKDATE = 54; //Dokumentdatum
static final int gDDF_EQUIPMENTS = 60; //Equipments (Service) - 12.12.2022
static final int gDDF_PROJBER = 60; //Projektbeteiligte
static final int gDDF_ERGDOCFUER = 60; //Ergebnisdokument für
static final int gDDF_VORGANG = 60; //Beteiligter Vorgang
static final int gDDF_TEILVONRM = 60; //Teilvorgangsnummern
static final int gDDF_GESPARTNR60 = 60; //Geschäftspartnernummer
static final int gDDF_SCHLAGWORT = 61; //Schlagwort
static final int gDDF_MSAPM = 61; //Meilenstein/Arbeitspaket Mehrfach
static final int gDDF_TEILVOBEZGEN = 61; //Teilvorgangsbezeichnungen
static final int gDDF_PROJEKTE = 62; //Projekte Mehrfach
static final int gDDF_OPPNRM = 62; //weitere Opportunity_Nr
static final int gDDF_STRUKTURINFOS = 62; //Strukturinformationen
static final int gDDF_WEITKDNR = 62; //weitere Kunden_Nr
static final int gDDF_MASCHINENTYPEN = 62; //Maschinen-Typen (Maschinendokumente)
static final int gDDF_WEITEREBELEGNR = 62; //Weitere Belegnummer (Service)
static final int gDDF_PROJLEITERM = 63; //Projektleiter Mehrfach
static final int gDDF_EMPFEHLUNG = 63; //Empfehlung
static final int gDDF_GESPART = 63; //Geschäftspartner
static final int gDDF_ABTEMPM = 63; //Abteilung (Empfänger) Mehrfach
static final int gDDF_HAUPTFUNKTION = 63; //Hauptfunktion (Regelberichte)
//static final int gDDF_D3USER = 63; //d.3 User
static final int gDDF_D3USER63 = 63; //d.3 User -> ehemals "gDDF_D3USER"
static final int gDDF_EMPFAENGERM = 65; //Empfänger
static final int gDDF_FUNKTIONM = 64; //M-Funktion (Maschinendokumente)
static final int gDDF_WEITERESRID = 64; //Weitere SR-ID (Service)
static final int gDDF_WEITEREEQUIPMENT = 64;
static final int gDDF_PROJVABTM = 65; //Projektverantwortliche Abteilung Mehrfach
static final int gDDF_THEMA = 66; //Thema Wissensdokumente
static final int gDDF_PROJEKTTITELM = 66; //Projekttitel Mehrfach
static final int gDDF_WEITAUFTRAGSNR = 66; //weitere Projekt_Nr
static final int gDDF_WEITLIEFNR = 66; //weitere Lieferanten_Nr
static final int gDDF_HAUPTPROJEKTM = 67; //Hauptprojekt Mehrfach
//static final int gDDF_d3USER = 67; //d.3 Anmeldename
static final int gDDF_D3USER67 = 67; //d.3 Anmeldename -> ehemals "gDDF_d3USER"
static final int gDDF_ISOCODE = 67; //ISO Sprachcode (ISO3)
static final int gDDF_REGIONALORG = 67; //Regionalorganisation
static final int gDDF_EMAILKONTAKT = 68; //Emailkontakt Mehrfach
static final int gDDF_BUCHKREIS68 = 68; //Buchungskreis Mehrfach Intercompany
static final int gDDF_ORGEINHEITEN = 69; //Orgeinheiten aus OrgMngmtn
static final int gDDF_UEBERSETZUNG = 69; //Übersetzung
static final int gDDF_MUSTERMATNR69 = 69; //Mustermaterial Nr. Mehrfach (Feld 69)
static final int gDDF_DOCINFONR = 80; //Dokumenteninfosatz Nr.
static final int gDDF_VERSIONINTERN = 88; //d.3 Version (intern)
// DDF für Vertriebsdokumente
static final int gDDF_DIVISION = 61;
static final int gDDF_MACHINESYSTEM = 62;
static final int gDDF_MACHINE = 63;
static final int gDDF_FUNCTIONS = 64;
static final int gDDF_MODULES = 60;
static final int gDDF_PACKAGE = 65;
// Werte für Baudokumente
static final String gAUSFUEHRUNG = "8 Ausführung";
static final String gBESPRECHUNG = "Besprechungen";
static final String gGENEHMIGUNG = "4 Genehmigungen";
static final String gAUSSCHREIBUNG = "6 Ausschreibung";
// Werte für Wiedervorlage Kundenberichte
static final String gDOKUGRP = "DG052"; //Wert aus den administrativen Akte für Dokumentgruppe (#Kundenberichte)
static final String gINFOGRP = "INFO_Kundenberichte"; //Gruppe empfängt Postkorbeintrag bei neuen Besuchsberichten
// Allgemeine Variablen (z.B. Schlüsselumstellung)
static final String gDG_Kommunikation = "DG134"
static final String gDG_Medien = "DG074"
static final String gDG_ECRChangeOrder = "DG025"
static final String gAK_Kommunikation = "AK010"
static final String gAK_Kundenaktivität = "AK011"
static final String gAK_Lieferantenaktivität = "AK014"
static final String gAK_Projektorganisation = "AK017"
static final String gAK_Spezifikation = "AK021"
static final String gAK_ErgebnisOpportuntiy = "AK004"
static final String gAK_Werkauftrag = "AK028"
static final int RETURNCODE_OK = 0;
static final String gTECHNICAL_GROUP = "d3_grp_hoo" // Gruppenkürzel
// Zentralisierung Additional Info Text
static final String gADITXT001049 = "Bitte geben Sie eine Projektnummer ein, erst dann koennen Sie ECR/CO_Nr und Beschreibung auswaehlen."
static final String gADITXT001001 = "Please provide a Project number, after that you can choose a ECR/CO no. and Description."
static final String gADITXT002049 = "Bitte waehlen Sie eine ECR/CO_Nr und Beschreibung passend zur Projektnummer."
static final String gADITXT002001 = "Please choose an ECR/CO no. and Description which fits to the Project number."
static final String gADITXT003049 = "Sie versuchen ein Ergebnisdokument in einen genehmigten ECR/Change Order zu importieren. Bitte korrigieren Sie Ihre Eingabe."
static final String gADITXT003001 = "You try to import a document to an accepted ECR/Change Order. Please correct your input."
static final String gADITXT004049 = "Bitte waehlen Sie eine gültige Mustermaterialnummer aus."
static final String gADITXT004001 = "Please choose a valid sample material number."
static final String gADITXT005049 = "Bitte waehlen Sie eine gültige Funktion aus."
static final String gADITXT005001 = "Please choose a valid function."
static final String gADITXT006049 = "Bitte waehlen Sie ein gültige Modulnummer aus."
static final String gADITXT006001 = "Please choose a valid module number."
static final String gADITXT007049 = "Sie versuchen ein Maschinenprojektdokument einer Opportunity zuzuordnen. Bitte korrigieren Sie Ihre Eingabe."
static final String gADITXT007001 = "You try to add a project document to an opportunity. Please correct your input."
static final String gADITXT008049 = "Sie versuchen ein Opportunitydokument einem Maschinenprojekt zuzuordnen. Bitte korrigieren Sie Ihre Eingabe."
static final String gADITXT008001 = "You try to add an opportunity document to an project. Please correct your input."
static final String gADITXT009049 = "Eine der Angebotsakten in die Sie importieren moechten ist versendet, oder bereits angenommen. Es koennen keine weiteren Ergebnisdokumente abgelegt werden. Erstellen Sie ein neues Angebot, oder importieren Sie ein Basisdokument ohne Ergebnischarakter."
static final String gADITXT009001 = "One offer folder you chose for your import has been sent or is already accepted. It is not allowed to import further more result documents. Please create a new offer folder or import a document without result character."
static final String gADITXT010049 = "Bitte wählen Sie entweder den Lieferantennamen oder die Lieferantennummer aus der Liste aus, oder geben Sie es manuell ein."
static final String gADITXT010001 = "Please choose either a Customer No. or a Customer Name from the Dropdown Box or provide them manually."
static final String gADITXT011049 = "Bitte geben Sie mindestens den Lieferantennamen ein oder wählen Sie ihn aus der Drop Down Liste."
static final String gADITXT011001 = "Please provide a Customer Name or chose from the Dropdown Box."
static final String gADITXT012049 = "Sie versuchen ein Dokument zu importieren, ohne entweder eine Projekt- oder eine Opportunitynummer eingetragen zu haben. Bitte korrigieren Sie Ihre Eingabe."
static final String gADITXT012001 = "You try to import a document without attaching it to an order or an opportunity. Please correct your input."
static final String gADITXT013049 = "Sie versuchen ein Dokument zu importieren. Dabei haben Sie sowohl eine Projekt- als auch eine Opportunitynummer (ggf. unter weitere) eingetragen. Bitte korrigieren Sie Ihre Eingabe."
static final String gADITXT013001 = "You try to import a document by attaching an order as well as an opportunity, maybe concerning the fields for further numbers. Please correct your input."
static final String gADITXT014049 = "Bitte geben Sie eine gueltige Kombination aus Kundenkontakt-ID und entweder Kundennummer, Projektnummer oder Opportunitynummer ein."
static final String gADITXT014001 = "Please provide a valid combination of Customer Contact ID and Customer Number, Project Number or Opportunitynumber."
static final String gADITXT015049 = "Sie versuchen ein Dokument mit der Dokumentgruppe Medien abzulegen, ohne eine Akte ausgewaehlt zu haben. Bitte korrigieren Sie Ihre Eingabe"
static final String gADITXT015001 = "You try to import an document as Medien without choosing a folder. Please correct your input."
static final String gADITXT016049 = "Bitte geben Sie einen gültigen, eindeutigen Lieferanten an oder wählen Sie den Lieferanten aus der Auswahlliste."
static final String gADITXT016001 = "Please choose a valid, unambiguous Supplier or choose from the supplier number drop down."
static final String gADITXT017049 = "Dieser Lieferant existiert bereits in dieser Opportunity, bzw. in diesem Projekt. Bitte nutzen Sie die existierende Akte."
static final String gADITXT017001 = "This Supplier already exists for this Opportunity or Project. Please use the existing Supplier."
static final String gADITXT018049 = "Der Benutzer ist bereits als Projektbeteiligter in diesem Organisationsprojekt hinterlegt."
static final String gADITXT018001 = "The User has already been assigned as project participant in this organizational project."
static final String gADITXT019049 = "Sie haben eine ungültige Vertragsnummer eingegeben."
static final String gADITXT019001 = "You have entered a non existent contract number."
static final String gADITXT020049 = "Bitte geben Sie einen gültigen Kunden an."
static final String gADITXT020001 = "Please choose a valid Customer"
static final String gADITXT021049 = "Bitte geben Sie eine gültige Kombination aus Lieferant_Nr, Kontakt_Beschreibung, Kategorie und Termin ein oder wählen Sie eine Kontakt_Beschreibung aus der Auswahlliste."
static final String gADITXT021001 = "Please provide a valid combination of supplier_nr, contact description, categorie and date or choose from the contact description drop down."
static final String gADITXT022049 = "Bitte wählen Sie die weitere Kunden_Nr aus der Auswahlliste aus oder geben Sie eine existierende weitere Kunden_Nr ein."
static final String gADITXT022001 = "Please choose either a Further customer no. from the Dropdown Box or provide a correct Further customer no. manually."
static final String gADITXT023049 = "Bitte wählen Sie die weitere Lieferant_Nr aus der Auswahlliste aus oder geben Sie eine existierende weitere Lieferant_Nr ein."
static final String gADITXT023001 = "Please choose either a Further supplier no. from the Dropdown Box or provide a correct Further supplier no. manually."
static final String gADITXT024049 = "Der Import einer MSG-Datei ist nicht erlaubt."
static final String gADITXT024001 = "Importing a MSG file is not allowed."
static final String gADITXT025049 = "Unbekannte ITSM ID"
static final String gADITXT025001 = "Unknown ITSM ID"
}

View File

@@ -0,0 +1,3 @@
D:\d3\d3server.prg\ext_groovy\Jar-Files\json-20180813.jar
D:\d3\d3server.prg\ext_groovy\Jar-Files\commons-io-2.5.jar
D:\d3\d3server.prg\ext_groovy\Jar-Files\commons-lang-2.6.jar

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
D:\d3\d3server.prg\ext_groovy\Jar-Files\json-20180813.jar
D:\d3\d3server.prg\ext_groovy\Jar-Files\commons-io-2.5.jar
D:\d3\d3server.prg\ext_groovy\Jar-Files\commons-lang-2.6.jar
D:\d3\d3server.prg\ext_groovy\Jar-Files\bcprov-jdk15on-1.62.jar

4621
Optima/_Groovy/Hooks.groovy Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,123 @@
// --------------------------------------------------------------------------------------------------------
// SystemSpecificConst.groovy -> hier P-System
// --------------------------------------------------------------------------------------------------------
//
// Groovy Definitionsdatei f<>r alle ben<65>tigten Repositoryabh<62>ngigen Konfigurationen
//
// --------------------------------------------------------------------------------------------------------
//
// Historie:
// 25.03.2019 dvelop Erste Version f<>r oData-Schnittstelle
//
// --------------------------------------------------------------------------------------------------------
public class SystemSpecificConst {
/*
* Systemspezifische Variablen
*/
static final String updatedUser = "d3groovy";
// imue 06.2019 - Pfad um Datei tempor<6F>r zu kopieren - notwendig da es in Groovy noch keine Funktion zum kopieren gibt, wo die FileExtension nicht verloren geht
static final String cloneDocumentTempPath = "E:\\d3\\d3work\\D3P\\CloneDocumentTemp"
//Aufruf d.3one Link f<>r<EFBFBD>Wissensdokumente
static final String gD3oneString = "<a href=https://dms.optima-group.org/dms/r/31edf125-2d59-5950-b055-5bec6a933289/o2/"
// Datei mit Text f<>r Email f<>r die Empfehlung der Wissensdokumente
static final String gBodyfile = "D:\\d3\\d3config\\D3P\\Hooks\\Mailbody\\body.html"
//ersten drei Ziffern der AppId vom d.3one
static final String gApp_D3one = "020"
// Deaktivierung der Zertifikatspr<70>fung (keine Zertifikatspr<70>fung = false; Ausf<73>hrung Zertifikatspr<70>fung = true)
static final boolean needCertificateCheck = false;
// Empf<70>nger Benachrichtung bei Fehler von Eigenschafts<74>nderungen
static final String recipientHoldFile = "HookUpdates"
// imue 08.2019 - Verarbeitung der Massendatenaktualisierungen (true = Aufruf Async und Jpl Funktionen, false = Aufruf von Async Jobs f<>r UPD001)
static final boolean workWithAsyncJplForMassDataUpdate = false
/*
* Eigenschaften-ID's
*/
static final int gProjOrgNrID = 1 // Repository-Id der Eigenschaft Org.Projekt_Nr
static final int gProzessGroupId = 4
static final int gRepIDProzessart = 5
static final int gNetzplanNrId = 15 // Repository-ID der Eigenchaft Netzplan_Nr
static final int gBuchungskreisID = 17 // Repository-ID der Eigenschaft Buchungskreis (Einfachfeld)
static final int gEreignisDateID = 22 // Repository-ID Der Eigenschaft Ereignisdatum
static final int gProjektNrID = 134 // Repository-ID der Eigenschaft Projekt_Nr
static final int gDokgroupID = 36 // Repository-ID der Eigenschaft Dokumentgruppe
static final int gLieferantNrID = 37
static final int gLieferantNaID = 38
static final int gKundennrID = 39
static final int gKundennameID = 40
static final int gEndkundennrID = 302 // Repository-ID der Eigenschaft "Endkunden_Nr"
static final int gEndkundennameID = 301 // Repository-ID der Eigenschaft "Endkunden_Name"
static final int gRegisterId = 42
static final int gKundenkontaktIDID = 72
static final int gOpportunityNrID = 84
static final int gKommunikationsrichtID = 68
static final int gJahrID = 66
static final int gMonatID = 82
static final int gVerkaufsphaseID = 88
static final int gHauptOpportunityID = 64
static final int gSubmissionID = 85
static final int gAbteilungOrgID = 52
static final int gOppannrID = 53
static final int gAngebotsnameID = 54
static final int gErgebnisDokID = 62
static final int gKontaktBeschreibungID = 80
static final int gArcdocidID = 57
static final int gWeitOpportunityID = 91 // Repository-ID der Mehrfacheigenschaft Opportunity
static final int gHauptangebotNrID = 63
static final int gSalesgroupID = 87
static final int gKundenkontaktKategorieID = 73
static final int gHauptOppNrID = 63
static final int gAbtsenderID = 96
static final int gSenderID = 97
static final int gWeitProjektnummerID = 131 // Repository-ID der Mehrfacheigenschaft Projekt_Nr
static final int gPSPElementId = 127 // Repository-ID der Eigenchaft PSP-Element
static final int gAdittitleID = 102
static final int gECRCONRID = 122 // Repository-ID der Eigenschaft ECR/CR_NR ID (Activity ID)
static final int gIntercompanyID = 136 // Repository-ID der Eigenschaft Intercompany
static final int gFunktionID = 202 // Repository-ID der Eigenschaft Funktion
static final int gModuleID = 203 // Repository-ID der Eigenschaft Module
static final int gBuchungskreiseID = 239 // Repository-ID der Eigenschaft Buchungskreise (Mehrfachfeld)
static final int gMusterMaterialMehrfID = 278
static final int gOrganEinheitID = 253 // Repository-ID der Eigenschaft Organisationseinheit
static final int gVertriebMaterialNrID = 291
static final int gAktuellVersInternID = 288
static final int gMaschinentypID = 303 // Repository-ID Maschinentyp (ein Wort)
static final int gBelegNrID = 316 // Repository-ID Belegnummer
static final int gBelegArtID = 314 // Repository-ID Belegart
static final int gSRBeschreibungID = 320 // Repository-ID f<>r Beschreibung (Service)
static final int gBelegBeschreibungID = 317
static final int gEquipmentID = 312
static final int gSRIDID = 315 // Repository-ID f??R ID (Service)
static final int gWeitereBelegNrID = 322
static final int gWeitereSRIDID = 324
static final int gWeitereEquipmentID = 325
static final int gEinkaufsBelegNrID = 334
static final int gWeitereEinkaufBelegNrID = 333
static final int gEquipmentsID = 336
/*
* Wertemengen-ID's
*/
static final int gPredValueIDKTKKat = 56 // Ermittlung der <20>bersetzung der Kontakt_Kategorie
static final int gPredValueIDKatLief = 112 // Ermittlung der <20>bersetzung der Lieferantenkontakt_Kategorie
static final int gPredValueIDRegister = 51 // Repository-ID der manuellen Wertemenge Register
/*
* ODATA-Schnittstelle - Zugangsdaten
*/
static final String baseOdata = "host";
static final def lUserOdata = "user"
static final def lPassOdata = "pass"
// Bauakte
static final String gResBauakteID = "\$000000130" //DocID des Restrikition Sets Bauakte
}

View File

@@ -0,0 +1,3 @@
D:\d3\d3server.prg\ext_groovy\Jar-Files\json-20180813.jar
D:\d3\d3server.prg\ext_groovy\Jar-Files\commons-io-2.5.jar
D:\d3\d3server.prg\ext_groovy\Jar-Files\commons-lang-2.6.jar

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
D:\d3\d3server.prg\ext_groovy\Jar-Files\json-20180813.jar
D:\d3\d3server.prg\ext_groovy\Jar-Files\commons-io-2.5.jar

View File

@@ -0,0 +1,744 @@
// --------------------------------------------------------------------------------------------------------
// ValueSets_Common.groovy
// --------------------------------------------------------------------------------------------------------
//
// Grrovy Wertemengen Übersetzungen
//
// --------------------------------------------------------------------------------------------------------
//
// Historie:
// 26.06.2017 phoer/dvelop Erste Version zur Umstellung der dynamischen Wertemengen und Übersetzung
//
// --------------------------------------------------------------------------------------------------------
import com.dvelop.d3.server.Entrypoint;
import com.dvelop.d3.server.core.D3Interface;
import com.dvelop.d3.server.Document;
import com.dvelop.d3.server.User;
import com.dvelop.d3.server.DocumentType;
import com.dvelop.d3.server.RepositoryField;
import com.dvelop.d3.server.UserOrUserGroup;
import com.dvelop.d3.server.ValueSet;
import com.dvelop.d3.server.ValueSetTranslation;
import com.dvelop.d3.server.Validation;
import com.dvelop.d3.server.Translation;
import com.dvelop.d3.server.*;
// zusätzliche Imports für oData Zugriff 21.01.2019
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.net.URLConnection;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.security.cert.X509Certificate;
import org.json.JSONArray;
import org.json.JSONObject;
import org.apache.commons.io.IOUtils;
import groovy.sql.GroovyRowResult;
import groovy.io.FileType;
class ValueSets_Translation
{
@ValueSetTranslation(entrypoint="SubjectValues")
def SubjectValuesTranslation(D3Interface d3, Translation transl)
{
def lang = transl.locale.language
d3.log.info("Groovy - ValueSets: start SubjectValueTranslation " + lang + " - locale: " + transl.locale);
if( lang == "de" ) {
lang = "DEU"
} else if( lang == "en" ) {
lang = "ENG"
}
// IMUE 26.08.2019 neue Wertemenge bei Umstellung auf Schlüssel statt LangKey
// NEU = def lSQL = """select fs.dok_dat_feld_${Const.gDFF_SCHLUESSEL} as ShortKey, value_char as TransVal
// ALT = def lSQL = """select fs.dok_dat_feld_${Const.gDDF_ORGENTRY} as LangKey, value_char as TransVal
def lSQL = """select fs.dok_dat_feld_${Const.gDFF_SCHLUESSEL} as ShortKey, value_char as TransVal
from firm_spez_mult_val as mv
join firmen_spezifisch as fs on fs.doku_id = mv.doku_id
where field_no = '${Const.gDDF_UEBERSETZUNG}'
and mv.doku_id in (
select doku_id
from firmen_spezifisch
where kue_dokuart = '${Const.gDTS_AZTXT}'
AND dok_dat_feld_${Const.gDFF_SCHLUESSEL} like 'AK%' )
and row_number in (
select row_number
from firm_spez_mult_val as mv, firmen_spezifisch as fs
where value_char like '${lang}%'
and mv.field_no = '${Const.gDDF_ISOCODE}'
and fs.kue_dokuart = '${Const.gDTS_AZTXT}'
and fs.doku_id = mv.doku_id )""";
def resultlist = d3.sql.executeAndGet( lSQL );
d3.log.info("Es wurden " + resultlist.size() + " Eintraege gefunden!");
for ( def i = 0; i < resultlist.size(); i++ ) {
transl.set( resultlist.get(i).get("ShortKey"), resultlist.get(i).get("TransVal") );
}
}
@ValueSetTranslation(entrypoint="MProjNumValues")
def getMProjNumValuesTranslation(D3Interface d3, Translation transl)
{
def lang = transl.locale.language
if ( lang != "DEU" ) {
transl.set( "keine Submission", "No Submission" );
}
}
@ValueSetTranslation(entrypoint="DokumentuntergruppeValues")
def DokumentuntergruppeValuesTranslation(D3Interface d3, Translation transl)
{
def lang = transl.locale.language
d3.log.info("Groovy - ValueSets: start DokumentuntergruppeValueTranslation " + lang + " - locale: " + transl.locale);
if( lang == "de" ) {
lang = "DEU"
} else if( lang == "en" ) {
lang = "ENG"
}
// IMUE 05.03.2019 neue Wertemenge bei Umstellung auf Schlüssel statt LangKey
// ALT = def lSQL = """select fs.dok_dat_feld_${Const.gDDF_ORGENTRY} as LangKey, value_char as TransVal
def lSQL = """select fs.dok_dat_feld_${Const.gDFF_SCHLUESSEL} as ShortKey, value_char as TransVal
from firm_spez_mult_val as mv
join firmen_spezifisch as fs on fs.doku_id = mv.doku_id
where field_no = '${Const.gDDF_UEBERSETZUNG}'
and mv.doku_id in (
select doku_id
from firmen_spezifisch
where kue_dokuart = '${Const.gDTS_AZTXT}'
AND dok_dat_feld_${Const.gDFF_SCHLUESSEL} like 'DG%' )
and row_number in (
select row_number
from firm_spez_mult_val as mv, firmen_spezifisch as fs
where value_char like '${lang}%'
and field_no = '${Const.gDDF_ISOCODE}'
and fs.kue_dokuart = '${Const.gDTS_AZTXT}'
and fs.doku_id = mv.doku_id )""";
def resultlist = d3.sql.executeAndGet( lSQL );
d3.log.info("Es wurden " + resultlist.size() + " Eintraege gefunden!");
for ( def i = 0; i < resultlist.size(); i++ )
{
// IMUE 05.03.2019 neue Wertemenge bei Umstellung auf Schlüssel statt LangKey
// Alt = transl.set( resultlist.get(i).get("LangKey"), resultlist.get(i).get("TransVal") );
transl.set( resultlist.get(i).get("ShortKey"), resultlist.get(i).get("TransVal") );
}
}
@ValueSetTranslation(entrypoint="ProzessValues")
def ProzessValuesTranslation(D3Interface d3, Translation transl)
{
def lang = transl.locale.language
d3.log.info("Groovy - ValueSets: start ProzessValuesTranslation " + lang + " - locale: " + transl.locale);
if( lang == "de" ) {
lang = "DEU"
} else if( lang == "en" ) {
lang = "ENG"
}
// IMUE 05.02.2019 - Folgendes Statement ergibt die Schlüssel und die jeweilige Übersetzung nach Prozessumbau
def lSQL = """ SELECT fs.dok_dat_feld_${Const.gDFF_SCHLUESSEL} as LangKey, mv.value_char as TransVal
FROM firmen_spezifisch fs
LEFT JOIN firm_spez_mult_val mv ON fs.doku_id = mv.doku_id
LEFT JOIN firm_spez_mult_val mv2 ON fs.doku_id = mv2.doku_id AND mv.row_number = mv2.row_number
WHERE fs.kue_dokuart = '${Const.gDTS_AZTXT}'
AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}'
AND mv2.field_no = '${Const.gDDF_ISOCODE}'
AND mv2.value_char LIKE '${lang}%'
ORDER BY mv2.value_char asc """;
/*
def lSQL = """select fs.dok_dat_feld_${Const.gDDF_ORGENTRY} as LangKey, value_char as TransVal
from firm_spez_mult_val as mv
join firmen_spezifisch as fs on fs.doku_id = mv.doku_id
where field_no = '${Const.gDDF_UEBERSETZUNG}'
and mv.doku_id in (
select doku_id
from firmen_spezifisch
where kue_dokuart = '${Const.gDTS_AZTXT}'
AND dok_dat_feld_${Const.gDFF_SCHLUESSEL} like 'PZ%' )
and row_number in (
select row_number
from firm_spez_mult_val as mv, firmen_spezifisch as fs
where value_char like '${lang}%'
and field_no = '${Const.gDDF_ISOCODE}'
and fs.kue_dokuart = '${Const.gDTS_AZTXT}'
and fs.doku_id = mv.doku_id )""";
*/
def resultlist = d3.sql.executeAndGet( lSQL );
d3.log.info("Es wurden " + resultlist.size() + " Eintraege gefunden!");
for ( def i = 0; i < resultlist.size(); i++ )
{
transl.set( resultlist.get(i).get("LangKey"), resultlist.get(i).get("TransVal") );
}
}
@ValueSetTranslation(entrypoint="ProzArtValues")
def ProzArtValuesTranslation(D3Interface d3, Translation transl)
{
def lang = transl.locale.language
d3.log.info("Groovy - ValueSets: start ProzArtValuesTranslation " + lang + " - locale: " + transl.locale);
if( lang == "de" ) {
lang = "DEU"
} else if( lang == "en" ) {
lang = "ENG"
}
def lSQL = """ SELECT fs.dok_dat_feld_${Const.gDFF_SCHLUESSEL} as LangKey, mv.value_char as TransVal
FROM firmen_spezifisch fs
LEFT JOIN firm_spez_mult_val mv ON fs.doku_id = mv.doku_id
LEFT JOIN firm_spez_mult_val mv2 ON fs.doku_id = mv2.doku_id AND mv.row_number = mv2.row_number
WHERE fs.kue_dokuart = '${Const.gDTS_AZTXT}'
AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}'
AND mv2.field_no = '${Const.gDDF_ISOCODE}'
AND mv2.value_char LIKE '${lang}%' """;
/*def lSQL = """select fs.dok_dat_feld_${Const.gDDF_ORGENTRY} as LangKey, value_char as TransVal
from firm_spez_mult_val as mv
join firmen_spezifisch as fs on fs.doku_id = mv.doku_id
where field_no = '${Const.gDDF_UEBERSETZUNG}'
and mv.doku_id in (
select doku_id
from firmen_spezifisch
where kue_dokuart = '${Const.gDTS_AZTXT}'
AND dok_dat_feld_${Const.gDFF_SCHLUESSEL} like 'PA%' )
and row_number in (
select row_number
from firm_spez_mult_val as mv, firmen_spezifisch as fs
where value_char like '${lang}%'
and field_no = '${Const.gDDF_ISOCODE}'
and fs.kue_dokuart = '${Const.gDTS_AZTXT}'
and fs.doku_id = mv.doku_id )""";
*/
def resultlist = d3.sql.executeAndGet( lSQL );
d3.log.info("Es wurden " + resultlist.size() + " Eintraege gefunden!");
for ( def i = 0; i < resultlist.size(); i++ )
{
transl.set( resultlist.get(i).get("LangKey"), resultlist.get(i).get("TransVal") );
}
}
// 07.2019 wird produktiv noch nicht genutzt
@ValueSetTranslation(entrypoint="MachineDocumentModuls")
def MachineDocumentsModulsTranslation(D3Interface d3, Translation transl)
{
// Persistierung nur der eindeutigen ID - In der Wertemenge wird über die Translation "ID - Beschreibung" angezeigt"
def lang = transl.locale.language
lang = lang.toUpperCase();
def fallbackLangEng = "EN";
/*
// Create a trust manager that does not validate certificate chains -> entfernt 13.02.2019
Dafür ist es erforderlich das Zertifikat in Java als vertrauenswürdig hinzuzufügen:
cd D:\d3\d3server.prg\JRE\bin keytool.exe -import -keystore "D:\d3\d3server.prg\JRE\lib\security\cacerts" -file "E:\optima_group_ca.cer"
*/
if(SystemSpecificConst.needCertificateCheck == false) {
deactivateCertificateCheck();
}
URL url = new URL( 'https://' + SystemSpecificConst.baseOdata + '/sap/opu/odata/sap/ZPS_MACHINE_MASTER_SRV/ModuleTextSet?$filter=Deleted%20eq%20false%20&$format=json');
try {
URLConnection con = url.openConnection();
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
con.setRequestProperty ("Authorization", basicAuth);
InputStream is = con.getInputStream();
String responseValue = IOUtils.toString(is, "UTF-8");
is.close();
JSONObject obj = new JSONObject(responseValue);
JSONArray arr = obj.get("d").getJSONArray("results");
List<String> guidList = new ArrayList<>();
HashMap<String, JSONObject> guidJsonObMap = new HashMap<>();
if(arr.length() > 0) {
for (int i = 0; i < arr.length(); i++) {
JSONObject metadataObj = arr.getJSONObject(i);
// Eindeutige GUID einmalig holen
String guid = metadataObj.getString("ModuleGUID");
boolean exist = guidList.contains(guid);
if(exist == false) {
guidList.add(guid);
}
// Je GUID das JsonObject zwischernspeichern - Eine GUID ist nur je Sprache eindeutig, daher Zusammensetzung für den HashMap-Key notwendig
String language = metadataObj.getString("LanguageSap");
guidJsonObMap.put(guid + "_" + language, metadataObj);
}
} else {
d3.log.error( " ## ValueSetTranslation for MachineDocumentModuls - JSONArray Size = 0 ") ;
}
// für jede eindeutige GUID müssen die weiteren Informationen in der Anmeldesprache gefunden werden
// wenn kein Ergebnis gefunden wurde - Fallback Englisch
for(String guid : guidList) {
JSONObject jsonTempOb = guidJsonObMap.get(guid + "_" + lang);
// wenn es Informationen zu der GUID und der Anmeldesprache gibt
if(jsonTempOb != null) {
// Eindeutige ID holen
String id = jsonTempOb.getString("Id");
// Beschreibung holen
String description = jsonTempOb.getString("Description");
transl.set( guid, id + " - " + description);
} else {
// Fallback - gibt es keine Informationen in der Anmeldesprache, nehme Englisch
JSONObject jsonTempObEng = guidJsonObMap.get(guid + "_" + fallbackLangEng);
// Eindeutige ID holen
String id = jsonTempObEng.getString("Id");
// Beschreibung holen
String description = jsonTempObEng.getString("Description");
//d3.log.error( " ## ValueSetTranslation for MachineDocumentModuls - " + fallbackLangEng + " - " + guid + " - " + id + " - " + description);
transl.set( guid, id + " - " + description);
}
}
} catch(Exception e) {
d3.log.error( " ## ValueSetTranslation for MachineDocumentModuls - Exception = " + e.getMessage() );
}
}
// 07.2019 wird produktiv noch nicht genutzt
@ValueSetTranslation(entrypoint="MachineDocumentFunctions")
def MachineDocumentsFunctionsTranslation(D3Interface d3, Translation transl)
{
// Persistierung nur der eindeutigen ID - In der Wertemenge wird über die Translation "ID - Beschreibung" angezeigt"
def lang = transl.locale.language
lang = lang.toUpperCase();
def fallbackLangEng = "EN";
/*
// Create a trust manager that does not validate certificate chains -> entfernt 13.02.2019
Dafür ist es erforderlich das Zertifikat in Java als vertrauenswürdig hinzuzufügen:
cd D:\d3\d3server.prg\JRE\bin keytool.exe -import -keystore "D:\d3\d3server.prg\JRE\lib\security\cacerts" -file "E:\optima_group_ca.cer"
*/
if(SystemSpecificConst.needCertificateCheck == false) {
deactivateCertificateCheck();
}
// aktuell ist es noch nicht möglich ohne Filterung den oData Aufruf auszuführen
URL url = new URL('https://' + SystemSpecificConst.baseOdata + '/sap/opu/odata/sap/ZPS_MACHINE_MASTER_SRV/FunctionTextSet?$filter=Deleted%20eq%20false%20&$format=json');
try {
URLConnection con = url.openConnection();
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
con.setRequestProperty ("Authorization", basicAuth);
InputStream is = con.getInputStream();
String responseValue = IOUtils.toString(is, "UTF-8");
is.close();
JSONObject obj = new JSONObject(responseValue);
JSONArray arr = obj.get("d").getJSONArray("results");
List<String> guidList = new ArrayList<>();
HashMap<String, JSONObject> guidJsonObMap = new HashMap<>();
if(arr.length() > 0) {
for (int i = 0; i < arr.length(); i++) {
JSONObject metadataObj = arr.getJSONObject(i);
// Eindeutige GUID einmalig holen
String guid = metadataObj.getString("FunctionGUID");
boolean exist = guidList.contains(guid);
if(exist == false) {
guidList.add(guid);
}
// Je GUID das JsonObject zwischernspeichern - Eine GUID ist nur je Sprache eindeutig, daher Zusammensetzung für den HashMap-Key notwendig
String language = metadataObj.getString("LanguageSap");
guidJsonObMap.put(guid + "_" + language, metadataObj);
}
} else {
d3.log.error( " ## ValueSetTranslation for MachineDocumentFunctions - JSONArray Size = 0 ") ;
}
// für jede eindeutige GUID müssen die weiteren Informationen in der Anmeldesprache gefunden werden
// wenn kein Ergebnis gefunden wurde - Fallback Englisch
for(String guid : guidList) {
JSONObject jsonTempOb = guidJsonObMap.get(guid + "_" + lang);
// wenn es Informationen zu der GUID und der Anmeldesprache gibt
if(jsonTempOb != null) {
// Eindeutige ID holen
String id = jsonTempOb.getString("Id");
// Beschreibung holen
String description = jsonTempOb.getString("Description");
transl.set( guid, id + " - " + description);
} else {
// Fallback - gibt es keine Informationen in der Anmeldesprache, nehme Englisch
JSONObject jsonTempObEng = guidJsonObMap.get(guid + "_" + fallbackLangEng);
// Eindeutige ID holen
String id = jsonTempObEng.getString("Id");
// Beschreibung holen
String description = jsonTempObEng.getString("Description");
//d3.log.error( " ## ValueSetTranslation for MachineDocumentFunctions - " + fallbackLangEng + " - " + guid + " - " + id + " - " + description);
transl.set( guid, id + " - " + description);
}
}
} catch(Exception e) {
d3.log.error( " ## ValueSetTranslation for MachineDocumentFunctions - Exception = " + e.getMessage() );
}
}
// 07.2019 wird produktiv noch nicht genutzt
@ValueSetTranslation(entrypoint="MachineDocumentMachineType")
def MachineDocumentMachineTypeTranslation(D3Interface d3, Translation transl)
{
// Persistierung nur der eindeutigen ID - In der Wertemenge wird über die Translation "ID - Beschreibung" angezeigt"
def lang = transl.locale.language
lang = lang.toUpperCase();
/*
// Create a trust manager that does not validate certificate chains -> entfernt 13.02.2019
Dafür ist es erforderlich das Zertifikat in Java als vertrauenswürdig hinzuzufügen:
cd D:\d3\d3server.prg\JRE\bin keytool.exe -import -keystore "D:\d3\d3server.prg\JRE\lib\security\cacerts" -file "E:\optima_group_ca.cer"
*/
if(SystemSpecificConst.needCertificateCheck == false) {
deactivateCertificateCheck();
}
URL url = new URL('https://' + SystemSpecificConst.baseOdata + '/sap/opu/odata/sap/ZPS_MACHINE_MASTER_SRV/MachineSimpleSet?$format=json');
try {
URLConnection con = url.openConnection();
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
con.setRequestProperty ("Authorization", basicAuth);
InputStream is = con.getInputStream();
String responseValue = IOUtils.toString(is, "UTF-8");
is.close();
JSONObject obj = new JSONObject(responseValue);
JSONArray arr = obj.get("d").getJSONArray("results");
for (int i = 0; i < arr.length(); i++)
{
JSONObject metadataObj = arr.getJSONObject(i);
// Eindeutige Id holen
String id = metadataObj.getString("Id");
// Beschreibung holen
String description = metadataObj.getString("Description");
transl.set( id, id + " - " + description);
}
} catch(Exception e) {
d3.log.error( " ## ValueSetTranslation for MachineDocumentModuls - Exception = " + e.getMessage() );
}
}
@ValueSetTranslation(entrypoint="VorlagenProzArtValues")
def VorlagenProzArtValuesTranslation(D3Interface d3, Translation transl)
{
def lang = transl.locale.language
if( lang == "de" ) {
lang = "DEU"
} else if( lang == "en" ) {
lang = "ENG"
}
def lSQL = """select fs.dok_dat_feld_${Const.gDFF_SCHLUESSEL} as LangKey, value_char as TransVal
from firm_spez_mult_val as mv
join firmen_spezifisch as fs on fs.doku_id = mv.doku_id
where field_no = '${Const.gDDF_UEBERSETZUNG}'
and mv.doku_id in (
select doku_id
from firmen_spezifisch
where kue_dokuart = '${Const.gDTS_AZTXT}' )
and row_number in (
select row_number
from firm_spez_mult_val as mv, firmen_spezifisch as fs
where value_char like '${lang}%'
and field_no = '${Const.gDDF_ISOCODE}'
and fs.kue_dokuart = '${Const.gDTS_AZTXT}'
and fs.doku_id = mv.doku_id )""";
def resultlist = d3.sql.executeAndGet( lSQL );
for ( def i = 0; i < resultlist.size(); i++ )
{
transl.set( resultlist.get(i).get("LangKey"), resultlist.get(i).get("TransVal") );
}
}
@ValueSetTranslation(entrypoint="RegisterValues")
def RegisterTranslation(D3Interface d3, Translation transl)
{
//d3.log.error("RegisterValues Translation started");
def lang = transl.locale.language
// Erweiterte Eigenschaft Register hat die ID 51 und muss pro System geprüft werden
def registerResultsetTransMan = d3.sql.executeAndGet("SELECT value_char_allowed, value_char_transl FROM dbo.doc_field_val_lang WHERE predef_value_id = 51");
if( lang == "de" ) {
// manuelle Wertemenge
for ( int i = 0; i < registerResultsetTransMan.size(); i++ ) {
transl.set( registerResultsetTransMan.get(i).get("value_char_allowed"), registerResultsetTransMan.get(i).get("value_char_allowed") );
}
// dynamische Wertemenge
def registerResultsetTransDyn = d3.sql.executeAndGet("SELECT fs.dok_dat_feld_${Const.gDFF_SCHLUESSEL} as ShortKey, mv.value_char as ValueTrans FROM firmen_spezifisch fs LEFT JOIN firm_spez_mult_val mv ON fs.doku_id = mv.doku_id WHERE fs.kue_dokuart = '${Const.gDTS_AZTXT}' AND fs.dok_dat_feld_${Const.gDFF_SCHLUESSEL} LIKE 'DG%' AND field_no = ${Const.gDDF_UEBERSETZUNG} AND mv.row_number = 1");
for ( int i = 0; i < registerResultsetTransDyn.size(); i++ ) {
transl.set( registerResultsetTransDyn.get(i).get("ShortKey"), registerResultsetTransDyn.get(i).get("ValueTrans") );
}
} else if( lang == "en" ) {
// manuelle Wertemenge
for ( int i = 0; i < registerResultsetTransMan.size(); i++ ) {
transl.set( registerResultsetTransMan.get(i).get("value_char_allowed"), registerResultsetTransMan.get(i).get("value_char_transl") );
}
// dynamische Wertemenge
def registerResultsetTransDyn = d3.sql.executeAndGet("SELECT fs.dok_dat_feld_${Const.gDFF_SCHLUESSEL} as ShortKey, mv.value_char as ValueTrans FROM firmen_spezifisch fs LEFT JOIN firm_spez_mult_val mv ON fs.doku_id = mv.doku_id WHERE fs.kue_dokuart = '${Const.gDTS_AZTXT}' AND fs.dok_dat_feld_${Const.gDFF_SCHLUESSEL} LIKE 'DG%' AND field_no = ${Const.gDDF_UEBERSETZUNG} AND mv.row_number = 2");
for ( int i = 0; i < registerResultsetTransDyn.size(); i++ ) {
transl.set( registerResultsetTransDyn.get(i).get("ShortKey"), registerResultsetTransDyn.get(i).get("ValueTrans") );
}
}
}
@ValueSetTranslation(entrypoint="OGValues")
def OGValuesTranslation(D3Interface d3, Translation transl)
{
//def lang = transl.locale.language
//d3.log.info("Groovy - ValueSets: start OGValuesTranslation " + lang + " - locale: " + transl.locale);
//if( lang == "de" ) {
//lang = "DEU"
//} else if( lang == "en" ) {
//lang = "ENG"
//}
//def lSQL = """ SELECT fs.dok_dat_feld_${Const.gDFF_SCHLUESSEL} as LangKey, mv.value_char as TransVal
// FROM firmen_spezifisch fs
// LEFT JOIN firm_spez_mult_val mv ON fs.doku_id = mv.doku_id
// LEFT JOIN firm_spez_mult_val mv2 ON fs.doku_id = mv2.doku_id AND mv.row_number = mv2.row_number
// WHERE fs.kue_dokuart = '${Const.gDTS_AZTXT}'
// AND mv.field_no = '${Const.gDDF_UEBERSETZUNG}'
// AND mv2.field_no = '${Const.gDDF_ISOCODE}'
// AND mv2.value_char LIKE '${lang}%' """;
//def resultlist = d3.sql.executeAndGet( lSQL );
//d3.log.info("Es wurden " + resultlist.size() + " Eintraege gefunden!");
//for ( def i = 0; i < resultlist.size(); i++ )
//{
// transl.set( resultlist.get(i).get("LangKey"), resultlist.get(i).get("TransVal") );
//}
// Persistierung nur der eindeutigen ID - In der Wertemenge wird über die Translation "ID - Beschreibung" angezeigt"
def lang = transl.locale.language
lang = lang.toUpperCase();
/*
// Create a trust manager that does not validate certificate chains -> entfernt 13.02.2019
Dafür ist es erforderlich das Zertifikat in Java als vertrauenswürdig hinzuzufügen:
cd D:\d3\d3server.prg\JRE\bin keytool.exe -import -keystore "D:\d3\d3server.prg\JRE\lib\security\cacerts" -file "E:\optima_group_ca.cer"
*/
if(SystemSpecificConst.needCertificateCheck == false) {
deactivateCertificateCheck();
}
URL url = new URL('https://' + SystemSpecificConst.baseOdata + '/sap/opu/odata/sap/ZCA_D3_AUTHORIZATIONS_SRV/OrgUnitSet?$format=json');
try {
URLConnection con = url.openConnection();
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
con.setRequestProperty ("Authorization", basicAuth);
InputStream is = con.getInputStream();
String responseValue = IOUtils.toString(is, "UTF-8");
is.close();
JSONObject obj = new JSONObject(responseValue);
JSONArray arr = obj.get("d").getJSONArray("results");
for (int i = 0; i < arr.length(); i++)
{
JSONObject metadataObj = arr.getJSONObject(i);
// Eindeutige Id holen
String id = metadataObj.getString("Id");
// Beschreibung holen
String description = metadataObj.getString("DisplayName");
transl.set( id, description);
}
} catch(Exception e) {
d3.log.error( " ## ValueSetTranslation for OGValuesTranslation - Exception = " + e.getMessage() );
}
}
@ValueSetTranslation(entrypoint="BuchungskreisValues")
def getValuesBuchungskreis(D3Interface d3, Translation transl)
{
// Persistierung nur der eindeutigen ID - In der Wertemenge wird über die Translation "ID - Beschreibung" angezeigt"
List<String> buchungskreisResultset = [];
if(SystemSpecificConst.needCertificateCheck == false) {
deactivateCertificateCheck();
}
URL url = new URL('https://' + SystemSpecificConst.baseOdata + '/sap/opu/odata/sap/ZCA_D3_VALUE_LISTS_SRV/CompanySet?$format=json&$orderby=CompanyCode');
try {
if(url != null) {
URLConnection con = url.openConnection();
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
con.setRequestProperty ("Authorization", basicAuth);
InputStream is = con.getInputStream();
String responseValue = IOUtils.toString(is, "UTF-8");
is.close();
JSONObject obj = new JSONObject(responseValue);
JSONArray arr = obj.get("d").getJSONArray("results");
for (int i = 0; i < arr.length(); i++)
{
JSONObject metadataObj = arr.getJSONObject(i);
// Buchungskreis holen
String companyCode = metadataObj.getString("CompanyCode");
// Beschreibung holen
String description = metadataObj.getString("Description");
transl.set( companyCode, companyCode + " | " + description);
}
}
} catch(Exception e) {
d3.log.error( " ## BuchungskreisTranslationValues - Exception = " + e.getMessage() );
}
}
@ValueSetTranslation(entrypoint="ServicBelegartValues")
def ServicBelegartTransValues(D3Interface d3, Translation transl) {
def lang = transl.locale.language
d3.log.info("Groovy - ValueSets: start ServicBelegartValues " + lang + " - locale: " + transl.locale);
if( lang == "de" ) {
lang = "DE"
} else if( lang == "en" ) {
lang = "EN"
}
List<String> buchungskreisResultset = [];
if(SystemSpecificConst.needCertificateCheck == false) {
deactivateCertificateCheck();
}
URL url = new URL("https://" + SystemSpecificConst.baseOdata + "/sap/opu/odata/sap/ZCA_D3_VALUE_LISTS_SRV/DocumentTypeSet?\$format=json&\$filter=LanguageIso%20eq%20'" + lang + "'");
try {
if(url != null) {
URLConnection con = url.openConnection();
String userpass = SystemSpecificConst.lUserOdata + ":" + SystemSpecificConst.lPassOdata;
String basicAuth = "Basic " + new String(Base64.getEncoder().encode(userpass.getBytes()));
con.setRequestProperty ("Authorization", basicAuth);
InputStream is = con.getInputStream();
String responseValue = IOUtils.toString(is, "UTF-8");
is.close();
JSONObject obj = new JSONObject(responseValue);
JSONArray arr = obj.get("d").getJSONArray("results");
for (int i = 0; i < arr.length(); i++) {
JSONObject metadataObj = arr.getJSONObject(i);
// Belegart holen
String documentTypeShort = metadataObj.getString("Id");
// Beschreibung holen
String documentTypeDescription = metadataObj.getString("Description");
transl.set( documentTypeShort, documentTypeDescription );
}
}
} catch(Exception e) {
d3.log.error( " ## ServicBelegartTransValues - Exception = " + e.getMessage() );
}
}
// Deaktivierung der Zertifikatsprüfung
def deactivateCertificateCheck() {
// CONNECT WITHOUT SSL CHECK
TrustManager[] trustAllCerts = new TrustManager[1]
def tm = new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; }
public void checkClientTrusted(X509Certificate[] certs, String authType) { }
public void checkServerTrusted(X509Certificate[] certs, String authType) { }
}
trustAllCerts[0] = tm;
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
HostnameVerifier allHostsValid = new HostnameVerifier() {
public boolean verify(String hostname, SSLSession session) { return true; }
};
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
// CONNECT WITHOUT SSL CHECK
}
} // End of file

Binary file not shown.

View File

@@ -0,0 +1 @@
D:\d3\d3server.prg\ext_groovy\Jar-Files\case-mngmnt-hook.jar

View File

@@ -0,0 +1,408 @@
import groovy.sql.GroovyRowResult
import java.io.File;
import java.lang.reflect.Field
import java.net.URI;
import java.util.Calendar;
import java.util.Date
import javax.swing.text.html.FrameSetView;
import com.dvelop.casemanagement.clients.ConditionExecutionClient;
import com.dvelop.casemanagement.clients.HTTPClientException;
import com.dvelop.casemanagement.config.io.HookHandler;
import com.dvelop.casemanagement.constants.IniConstants;
import com.dvelop.d3.server.ArchiveObject;
import com.dvelop.d3.server.Condition
import com.dvelop.d3.server.Document;
import com.dvelop.d3.server.DocumentType;
import com.dvelop.d3.server.Entrypoint;
import com.dvelop.d3.server.User;
import com.dvelop.d3.server.core.D3Interface;
//TODO: Refactor statics into a util class
public class dbsCaseContractHooks {
private static HookHandler handler;
private static Map<String, Map<String, String>> langMap;
private static final int leadingZeroCount = 5;
static {
langMap = new HashMap<String, Map<String,String>>();
langMap.put("001", new HashMap<String, String>());
langMap.put("049", new HashMap<String, String>());
}
private String getTranslation(String language, String key) {
Map<String, String> l;
if(langMap.containsKey( language)) {
l = langMap.get( language);
} else {
l = langMap.get( "001");
}
if(l.containsKey(key)) {
return l.get(key);
}
return key;
}
private static HookHandler getHandler(D3Interface d3) {
if(dbsCaseContractHooks.handler == null) {
List<String> paths = new ArrayList<String>();
for(int i = 0; i < 100; i++) {
String path = d3.conf.value("HOOK_GROOVY_DIRS_CUSTOMER", i);
if(path != null && path.length() > 0) {
paths.add(path);
} else {
break;
}
}
dbsCaseContractHooks.handler = new HookHandler(paths);
}
return dbsCaseContractHooks.handler;
}
@Entrypoint( entrypoint = "hook_upd_attrib_entry_20" )
public int hook_upd_attrib_entry_20_dbsContract ( D3Interface d3, Document doc , User user, DocumentType docType, DocumentType docTypeNew) {
String docTypeShort = docType.id;
if(getHandler(d3).getOption(IniConstants.DBS_KUE_DOKUART_VERTRAG).equals( docTypeShort) || getHandler(d3).getOption(IniConstants.DBS_KUE_DOKUART_RAHMEN).equals( docTypeShort)) {
String completeAction = "${user.getLongName()} aktualisierte Eigenschaften.".toString();
Integer updateField = Integer.parseInt( getHandler(d3).getOption( IniConstants.DBS_CASEORCONTRACT_LASTCHANGEACTION));
String currentActionValue = doc.field[updateField];
if(currentActionValue == null || "".equals(currentActionValue)) {
doc.field[updateField] = completeAction;
} else {
Document file = d3.archive.getDocument(doc.id, user.id);
if(file != null) {
String oldValue = file.field[updateField];
if(currentActionValue.equals( oldValue )) {
doc.field[updateField] = completeAction;
}
}
}
}
return 0;
}
@Entrypoint( entrypoint = "hook_insert_exit_20" )
public int hook_insert_exit_20_dbsContract (D3Interface d3 , Document doc, String fileDestination, def importOk, User user, DocumentType docType) {
// check importOk for int and string -> type change after update of d.3 server
if(importOk == "1" || importOk == 1 ) {
String docTypeShort = docType.id;
String restPath = getHandler(d3).getOption( IniConstants.DBS_PRESENTATION_SERVER_BASE_URL);
ConditionExecutionClient client = new ConditionExecutionClient(restPath);
switch(docTypeShort) {
case getHandler(d3).getOption(IniConstants.DBS_KUE_DOKUART_VERTRAG):
case getHandler(d3).getOption(IniConstants.DBS_KUE_DOKUART_RAHMEN):
try {
d3.log.info("Informing dbs | case manager contract about import of document with doc id " + doc.id + ".");
if(!client.importOfDocument( doc.id, user.id)) {
d3.log.error("Could not inform dbs | case manager contract about import of document!");
return -1;
}
} catch (HTTPClientException e) {
d3.log.error("Could not inform dbs | case manager contract about import of document with doc id " + doc.id + ": " + e.getLogMsg() + " entity was: " + e.getEntityMsg() );
return -1;
} catch (Exception e) {
d3.log.error("Could not inform dbs | case manager contract about import of document with doc id " + doc.id + ": " + e.getMessage() );
return -1;
}
break;
case getHandler(d3).getOption(IniConstants.DBS_KUE_DOKUART_VERTR_VUNT):
try {
d3.log.info("Informing dbs | case manager contract about import of contract paper with doc id " + doc.id + ".");
if(!client.importOfMail( doc.id)) {
d3.log.error("Could not inform dbs | case manager contract about import of contract paper with doc id " + doc.id + ".");
return -1;
}
} catch (HTTPClientException e) {
d3.log.error("Could not inform dbs | case manager contract about import of contract paper with doc id " + doc.id + ": " + e.getLogMsg() + " entity was: " + e.getEntityMsg() );
return -1;
} catch (Exception e) {
d3.log.error("Could not inform dbs | case manager contract about import of contract paper with doc id " + doc.id + ": " + e.getMessage() );
return -1;
}
//Break is missing intentionally!
case getHandler(d3).getOption(IniConstants.DBS_KUE_DOKUART_VERTR_DOK):
updateLastActionOfContract(d3, user, doc, " importierte ein neues Dokument.");
break;
}
}
return 0;
}
@Entrypoint( entrypoint = "hook_upd_attrib_exit_20" )
public int hook_upd_attrib_exit_20_dbsContract ( D3Interface d3, Document doc , Integer errorCode, User user, DocumentType docType, DocumentType docTypeNew) {
if(errorCode == 0) {
String docTypeShort = docType.id;
String restPath = getHandler(d3).getOption( IniConstants.DBS_PRESENTATION_SERVER_BASE_URL);
ConditionExecutionClient client = new ConditionExecutionClient(restPath);
switch(docTypeShort) {
case getHandler(d3).getOption(IniConstants.DBS_KUE_DOKUART_VERTRAG):
case getHandler(d3).getOption(IniConstants.DBS_KUE_DOKUART_RAHMEN):
try {
d3.log.info("Informing dbs | case manager contract about update of document with doc id " + doc.id + ".");
if(!client.updateOfDocument( doc.id, user.id)) {
d3.log.error("Could not inform dbs | case manager contract about update of document with doc id " + doc.id + ".");
return -1;
}
} catch (HTTPClientException e) {
d3.log.error("Could not inform dbs | case manager contract about update of document with doc id " + doc.id + ": " + e.getLogMsg() + " entity was: " + e.getEntityMsg() );
return -1;
} catch (Exception e) {
d3.log.error("Could not inform dbs | case manager contract about update of document with doc id " + doc.id + ": " + e.getMessage() );
return -1;
}
break;
case getHandler(d3).getOption(IniConstants.DBS_KUE_DOKUART_VERTR_DOK):
case getHandler(d3).getOption(IniConstants.DBS_KUE_DOKUART_VERTR_VUNT):
updateLastActionOfContract(d3, user, doc, " aktualisierte ein bestehendes Dokument.");
break;
}
}
return 0;
}
private void updateLastActionOfContract(D3Interface d3, User user, Document doc, String action) {
Integer internalNumberField = Integer.parseInt( getHandler(d3).getOption(IniConstants.DBS_VERTRAGSNUMMER));
Integer updateField = Integer.parseInt( getHandler(d3).getOption( IniConstants.DBS_CASEORCONTRACT_LASTCHANGEACTION));
String frameStart = getHandler(d3).getOption( IniConstants.DBS_PREFIX_RAHMEN);
String docTypeFather = getHandler(d3).getOption( IniConstants.DBS_KUE_DOKUART_VERTRAG);
String internalNumberFather = doc.field[internalNumberField];
if(internalNumberFather != null && internalNumberFather.startsWith( frameStart)) {
docTypeFather = getHandler(d3).getOption( IniConstants.DBS_KUE_DOKUART_RAHMEN);
}
if(internalNumberField != null && updateField != null && internalNumberFather != null && docTypeFather != null ) {
def query = "SELECT doku_id FROM firmen_spezifisch WHERE dok_dat_feld_${internalNumberField} = ? AND kue_dokuart = ?";
def params = [internalNumberFather, docTypeFather];
GroovyRowResult resultRow = d3.sql.firstRow(query, params);
if(resultRow != null && resultRow.containsKey("doku_id" ) && resultRow.getProperty("doku_id") != null) {
String docIdFile = resultRow.getProperty("doku_id");
String completeAction = "${user.getLongName()} ${action}".toString();
Document file = d3.archive.getDocument(docIdFile, user.id);
if(file != null) {
file.field[updateField] = completeAction;
file.updateAttributes(user.id, true);
}
} else {
throw new RuntimeException("Could not find any contract files with the internal contract number ${internalNumberFather}" );
}
} else {
throw new RuntimeException("dbs | case manager contract hook configuration not found or the configuration was not completed! Please check your configuration.");
}
}
// To provide the hook for entrypoint 'hook_validate_import_entry_10' uncomment the following annotation.
// Mind that for this method the d.3 server version 8.1 is required.
@Entrypoint( entrypoint = "hook_validate_import_entry_10" )
public int hook_validate_import_entry_10_dbsContract ( D3Interface d3, User user, DocumentType docType, Document doc, String nextcall ) {
String docTypeContractRV = getHandler(d3).getOption(IniConstants.DBS_KUE_DOKUART_RAHMEN);
String docTypeContractEV = getHandler(d3).getOption(IniConstants.DBS_KUE_DOKUART_VERTRAG);
String docTypeContractEVDOK = getHandler(d3).getOption( IniConstants.DBS_KUE_DOKUART_VERTR_DOK);
String docTypeContractEVUNT = getHandler( d3).getOption( IniConstants.DBS_KUE_DOKUART_VERTR_VUNT);
String docTypeShort = docType.id;
Integer internalNumberField = Integer.parseInt( getHandler(d3).getOption(IniConstants.DBS_VERTRAGSNUMMER));
if(docTypeContractRV == null || docTypeContractEV == null || docTypeContractEVDOK == null || docTypeContractEVUNT == null) {
throw new RuntimeException("dbs | case manager hook configuration not found or the configuration was not completed! Please check your configuration.");
}
try
{
if( docTypeContractRV.equals(docTypeShort) || docTypeContractEV.equals(docTypeShort)) {
String importAction = "${user.getLongName()} importierte Akte.".toString();
Integer updateField = Integer.parseInt( getHandler(d3).getOption( IniConstants.DBS_CASEORCONTRACT_LASTCHANGEACTION));
doc.field[updateField] = importAction;
}
// date validation if activated in administration
if ( Integer.parseInt( getHandler(d3).getOption( IniConstants.DBS_VALIDATEDATE)) == 1) {
if ( docTypeContractEV.equals( docTypeShort)) {
d3.log.info("checking internal contract number for blanket contract agreement");
Integer internalFrameContractNumberField = Integer.parseInt( getHandler( d3).getOption( IniConstants.DBS_VERTRAG_DOKDAT_RAHMEN));
String internalFrameContractNumber = doc.field[internalFrameContractNumberField];
if ( internalFrameContractNumber != null && internalFrameContractNumber != "" ) {
Integer startDateField = Integer.parseInt(getHandler( d3).getOption( IniConstants.DBS_CONTRACT_STARTDATE_CONTRACT));
Date startDateEV = doc.field[startDateField];
Integer endDateField = Integer.parseInt(getHandler( d3).getOption( IniConstants.DBS_CONTRACT_ENDDATE_CONTRACT));
Date endDateEV = doc.field[endDateField];
String docIdFrameContract = getDocId(d3, internalFrameContractNumber, docTypeContractRV, internalNumberField);
if ( docIdFrameContract != "" ) {
d3.log.info("comparing contract start / end dates with corresponding dates of blanket contract agreement")
Date startDateRV = getDate(d3, docIdFrameContract, docTypeContractRV, startDateField);
if (startDateRV != null ) {
if (startDateEV != null && startDateEV.before( startDateRV)) {
d3.log.error("An error occurred validating the contract dates! The specified start date lies before the start date of the blanket agreement.");
return -8140505;
}
if ( endDateEV != null && endDateEV.before( startDateRV)) {
d3.log.error("An error occurred validating the contract dates! The specified end date lies before the start date of the blanket agreement.");
return -8140506;
}
}
Date endDateRV = getDate(d3, docIdFrameContract, docTypeContractRV, endDateField);
if (endDateRV != null ){
if (startDateEV != null && startDateEV.after( endDateRV)) {
d3.log.error("An error occurred validating the contract dates! The specified start date lies after the end date of the blanket agreement.");
return -8140507;
}
if ( endDateEV != null && endDateEV.after( endDateRV)) {
d3.log.error("An error occurred validating the contract dates! The specified end date lies after the end date of the blanket agreement.");
return -8140508;
}
}
} else {
d3.log.error("Please check the specified internal contract number for the blanket agreement.");
return -8140502;
}
}
}
}
if ( docTypeContractEV.equals( docTypeShort) || docTypeContractRV.equals( docTypeShort) || docTypeContractEVDOK.equals( docTypeShort)) {
if ( doc.field[internalNumberField] != null && doc.field[internalNumberField] != "") {
d3.log.info("docfield[${internalNumberField}] for the internal contract number was not empty");
int numberOfFoundInternalContractNumber = countExistingInternalContractNumber(d3, docTypeShort, doc.field[internalNumberField], internalNumberField );
if (numberOfFoundInternalContractNumber >= 1) {
d3.log.info("next api function: ${nextcall}");
if ( !"ImportNewVersionDocument".equals( nextcall) || numberOfFoundInternalContractNumber > 1 ) {
d3.log.error("Please check the internal contract number. The internal contract number '${doc.field[internalNumberField]}' is already assigned to other contract files and it is forbidden to use duplicates.");
return -8140503;
}
}
doc.number = doc.field[internalNumberField];
return 0;
} else {
if ( doc.number != null && doc.number != "") {
d3.log.info("doc number was not empty");
doc.field[internalNumberField] = doc.number;
int numberOfFoundInternalContractNumber = countExistingInternalContractNumber(d3, docTypeShort, doc.field[internalNumberField], internalNumberField );
if (numberOfFoundInternalContractNumber >= 1) {
d3.log.error("Please check the internal contract number. The internal contract number '${doc.field[internalNumberField]}' is already assigned to other contract files and it is forbidden to use duplicates.");
return -8140503;
}
return 0;
}
}
d3.log.info("Need to generate a new number: ");
setNextContractNumber(d3, docType, doc);
} else if ( docTypeContractEVUNT.equals( docTypeShort)) {
int numberOfFoundInternalContractNumberEV = countExistingInternalContractNumber(d3, docTypeContractEV, doc.field[internalNumberField], internalNumberField );
if ( numberOfFoundInternalContractNumberEV == 0 ) {
int numberOfFoundInternalContractNumberRV = countExistingInternalContractNumber(d3, docTypeContractRV, doc.field[internalNumberField], internalNumberField );
if ( numberOfFoundInternalContractNumberRV == 0) {
d3.log.error("Please check the internal contract number.");
return -8140509;
}
}
}
}
catch( Exception e)
{
d3.log.error("An Exception occured: ${e.getCause()} StackTrace: ${e}");
return -1;
}
return 0;
}
private void setNextContractNumber(D3Interface d3, DocumentType docType, Document doc) {
String docTypeContractRV = getHandler(d3).getOption(IniConstants.DBS_KUE_DOKUART_RAHMEN);
String docTypeContractEV = getHandler(d3).getOption(IniConstants.DBS_KUE_DOKUART_VERTRAG);
if(docTypeContractRV == null || docTypeContractEV == null) {
throw new RuntimeException("dbs | case manager hook configuration not found or the configuration was not completed! Please check your configuration.");
}
String prefixType = null;
String docTypeShortForPrefix = docTypeContractEV;
if ( docType.id == docTypeContractRV){
docTypeShortForPrefix = docTypeContractRV;
}
switch(docTypeShortForPrefix) {
case docTypeContractRV:
prefixType = IniConstants.DBS_PREFIX_RAHMEN;
break;
case docTypeContractEV:
prefixType = IniConstants.DBS_PREFIX_ID;
break;
default:
throw new RuntimeException("The hook function \"setNextContractNumber\" was called with an unknown doc type! Expected ${docTypeContractEV} or ${docTypeContractRV} but was ${docTypeShortForPrefix}");
}
String configuredPrefix = getHandler(d3).getOption(prefixType);
Integer internalNumberField = Integer.parseInt( getHandler(d3).getOption(IniConstants.DBS_VERTRAGSNUMMER));
if(configuredPrefix == null || internalNumberField == null) {
throw new RuntimeException("dbs | case manager hook configuration not found or the configuration was not completed! Please check your configuration.");
}
GroovyObject prefixGenerator = preparePrefixGenerator(d3);
String prefix = prefixGenerator.generateContractNumberPrefix(configuredPrefix);
d3.log.info("Generated prefix for internal contract number: ${prefix}");
String query = "select max( dok_dat_feld_${internalNumberField} ) as docNumberCount from firmen_spezifisch where kue_dokuart = ? and (dok_dat_feld_${internalNumberField} like ?)";
GroovyRowResult resultRow = d3.sql.firstRow(query, [docTypeShortForPrefix, (prefix + "%")]);
int number = 0;
if(resultRow != null && resultRow.containsKey("docNumberCount" ) && resultRow.getProperty("docNumberCount") != null) {
Integer result = Integer.parseInt(resultRow.getProperty("docNumberCount").substring( prefix.length()));
number = result != null ? result : 0;
}
number++;
String numberString = String.valueOf( number);
if(numberString.length() > leadingZeroCount) {
throw new RuntimeException("Could not generate a valid contract number. There are no more contract numbers left! Please use a higher leading zero count.");
}
while(numberString.length() < leadingZeroCount) {
numberString = "0" + numberString;
}
String contractNumberResult = prefix + numberString;
d3.log.info("Generated contractNumber: ${contractNumberResult} setting docfield[${internalNumberField}]");
doc.field[internalNumberField] = contractNumberResult;
doc.number = contractNumberResult;
}
private int countExistingInternalContractNumber(D3Interface d3, String docTypeShort, String internalNumberValue, Integer internalNumberField ) {
int countedInternalNumbers = 0;
if ( internalNumberValue == null || internalNumberValue.trim().equals( "")){
return countedInternalNumbers;
}
String query = "select count( doku_id) as countedIdenticalInternalNumbers from firmen_spezifisch where kue_dokuart = ? and (dok_dat_feld_${internalNumberField} = ?)";
List<Object> params = [docTypeShort, internalNumberValue];
GroovyRowResult resultRow = d3.sql.firstRow(query, params);
if(resultRow != null && resultRow.containsKey("countedIdenticalInternalNumbers" ) && resultRow.getProperty("countedIdenticalInternalNumbers") != null) {
countedInternalNumbers = resultRow.getProperty("countedIdenticalInternalNumbers");
}
return countedInternalNumbers;
}
private String getDocId( D3Interface d3, String internalContractNumber, String docTypeShort, Integer internalNumberField) {
String docId = "";
String query = "SELECT doku_id FROM firmen_spezifisch WHERE dok_dat_feld_${internalNumberField} = ? AND kue_dokuart = ?";
List<Object> params = [internalContractNumber, docTypeShort];
List<GroovyRowResult> resultRowList = d3.sql.executeAndGet( query, params, 2);
if(resultRowList != null ) {
if (resultRowList.size() == 2) {
d3.log.error("More than one blanket agreement with the internal contract number ${internalContractNumber} was found.");
} else if ( resultRowList.size() == 1) {
docId = resultRowList[0].getProperty("doku_id");
}
}
return docId;
}
private Date getDate(D3Interface d3, String docId, String docTypeShort, Integer dateField) {
Date requestedDate = null;
String query = "select dok_dat_feld_${dateField} as returnedDate from firmen_spezifisch where kue_dokuart = ? and doku_id = ?";
List<Object> params = [ docTypeShort, docId];
GroovyRowResult resultRow = d3.sql.firstRow(query, params);
if(resultRow != null && resultRow.containsKey("returnedDate" ) && resultRow.getProperty("returnedDate") != null) {
requestedDate = resultRow.getProperty("returnedDate");
}
return requestedDate;
}
private GroovyObject preparePrefixGenerator(D3Interface d3) {
String currentPath = getClass().protectionDomain.codeSource.location.path;
d3.log.info("Looking for file to generate prefix here (encoded): ${currentPath}");
URI uri = new URI(currentPath);
d3.log.info("Looking for file to generate prefix here (decoded): ${uri.getPath()}");
File sourceFilePrefixGeneration = new File(new File( uri.getPath()).getParentFile(), "dbsCaseContractHooks_prefixGen.groovy");
d3.log.info("Found file to generate prefix: ${sourceFilePrefixGeneration.getPath()}");
Class prefixGenerationClass = new GroovyClassLoader(getClass().getClassLoader()).parseClass(sourceFilePrefixGeneration);
GroovyObject prefixGenerationObject = (GroovyObject) prefixGenerationClass.newInstance();
return prefixGenerationObject;
}
}

View File

@@ -0,0 +1,15 @@
public class dbsCaseContractHooks_prefixGen {
/* ########################################################################################
* ################### The functions below may be edited by customers #####################
* ########################################################################################
*/
public String generateContractNumberPrefix(String configuredPrefix) {
int year = Calendar.getInstance().get( Calendar.YEAR);
if ( configuredPrefix == null || configuredPrefix == ""){
return "${year}-";
} else {
return "${configuredPrefix}-${year}-";
}
}
}

View File

@@ -0,0 +1,34 @@
# Version: 1.0.0.3
#
# Beschreibung dieser Datei
#
# dbsCase_vertragsnummer - Datenbankposition der Vertragsnummer intern
# dbsCase_dokuart_vertrag_kue - Kürzel der Dokumentart der Verträge
# dbsCase_dokuart_vertrag_vunt_kue - Kürzel der Dokumentart der vertragsrelevanten Unterlagen
#
# Description of this file
#
# dbsCase_vertragsnummer - Database location of the Internal contract number
# dbsCase_dokuart_vertrag_kue - doc_type_short of doctype "Contracts"
# dbsCase_dokuart_vertrag_vunt_kue - doc_type_short of doctype "Contract related documents"
#
[dbsContractFunctions]
dbsCase_vertragsnummer = 1
dbsCase_vorgangsnummer = 1
dbsCase_vertrag_dokdat_rahmen = 13
dbsCase_contract_startDate_contract = 51
dbsCase_contract_endDate_contract = 52
dbsCase_caseOrContract_lastChangeAction = 47
dbsCase_dokuart_rahmen_kue = RVERT
dbsCase_dokuart_vertrag_kue = EVERT
dbsCase_dokuart_vorgang_kue = CASE
dbsCase_dokuart_vorgang_dok_kue = DCASE
dbsCase_dokuart_vertrag_dok_kue = EVDOK
dbsCase_dokuart_vertrag_vunt_kue = EVUNT
dbsCase_prefix_id = DV
dbsCase_prefix_rahmen = RV
dbsCase_prefix_vorgang =
dbsCase_validateDate = 1
dbsCase_presentation_server_base_url = https://sde01d3p01.optima-group.org:8444/case-mngmnt-core/