1 package com.proalpha.pds.templates.jet.version61;
3 import com.openedge.pdt.core.template.TemplateGenerationException;
4 import com.proalpha.pds.templates.jet.IpaTemplateGenerator;
5 import com.proalpha.pds.templates.data.GeneratorSettingsConstans;
9 import java.text.SimpleDateFormat;
10 import com.proalpha.pds.templates.helper.CodeFormatter;
14 protected static String nl;
23 public final String NL = nl ==
null ? (System.getProperties().getProperty(
"line.separator")) : nl;
24 protected final String TEXT_1 =
"&ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r2 GUI" + NL +
"&ANALYZE-RESUME" + NL;
25 protected final String TEXT_2 = NL +
"&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DECLARATIONS V-table-Win " + NL +
"routine-level on error undo, throw." + NL +
"" + NL +
"/* _UIB-CODE-BLOCK-END */ " + NL +
"&ANALYZE-RESUME" + NL + NL;
26 protected final String TEXT_3 = NL +
"&ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR \"Update Information\" Procedure _INLINE" + NL +
"/* Actions: ? ? ? ? adm/support/proc/ds_pa_01.w */" + NL +
"" + NL +
"/* _UIB-CODE-BLOCK-END */" + NL +
"&ANALYZE-RESUME" + NL +
"" + NL +
"&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure" + NL +
"/******************************************************************************/" + NL +
"/* @COPYRIGHT@ */" + NL +
"/* Project: proALPHA */" + NL +
"/* */";
27 protected final String TEXT_4 = NL;
28 protected final String TEXT_5 = NL +
"/* */";
29 protected final String TEXT_6 = NL +
"/* Current: @PAVERSION@ as of @PADATE@/@PALASTAUTHOR@ */" + NL +
"/* */" + NL +
"/*----------------------------------------------------------------------------*/" + NL +
"/* DESCRIPTION */" + NL +
"/*----------------------------------------------------------------------------*/" + NL +
"/* */";
30 protected final String TEXT_7 = NL +
"/* */" + NL +
"/*----------------------------------------------------------------------------*/" + NL +
"/* PARAMETERS */" + NL +
"/*----------------------------------------------------------------------------*/" + NL +
"/* Name Description */" + NL +
"/*----------------------------------------------------------------------------*/" + NL +
"/* */" + NL +
"/*----------------------------------------------------------------------------*/" + NL +
"/* HISTORY */" + NL +
"/*----------------------------------------------------------------------------*/" + NL +
"/*@FILEHISTORY@*/" + NL +
"/******************************************************************************/" + NL +
"\t\t" + NL +
"/* Procedure Information -----------------------------------------------------*/" + NL +
"" + NL +
"&GLOBAL-DEFINE pa-Autor ";
31 protected final String TEXT_8 = NL +
"&GLOBAL-DEFINE pa-Version @PAVERSION@" + NL +
"&GLOBAL-DEFINE pa-Datum @PADATE@" + NL +
"&GLOBAL-DEFINE pa-Letzter @PALASTAUTHOR@" + NL +
"" + NL +
"&GLOBAL-DEFINE pa-GenVersion OEA" + NL +
"&GLOBAL-DEFINE pa-ProgrammTyp BusinessCockpitExport" + NL +
"&GLOBAL-DEFINE pa-Template pabusinesscockpitexport.pjet" + NL +
"&GLOBAL-DEFINE pa-TemplateVersion 1.00" + NL +
"&GLOBAL-DEFINE pa-XBasisName ";
32 protected final String TEXT_9 = NL +
"&GLOBAL-DEFINE pa-NameSpace 2.00" + NL +
"" + NL +
"/*----------------------------------------------------------------------------*/" + NL +
"/* Definitions */" + NL +
"/*----------------------------------------------------------------------------*/" + NL +
"" + NL +
"/* Parameters ----------------------------------------------------------------*/" + NL +
"" + NL +
"/* Globals -------------------------------------------------------------------*/" + NL +
"" + NL +
"{adm/template/incl/dt_job10.df}" + NL +
"{info/bc/incl/ic_exp00.df}" + NL +
"" + NL +
"/* SCOPEDs -------------------------------------------------------------------*/" + NL +
"" + NL +
"/* Streams -------------------------------------------------------------------*/" + NL +
"" + NL +
"/* Variables -----------------------------------------------------------------*/" + NL +
"" + NL +
"/* Buffers -------------------------------------------------------------------*/" + NL +
"" + NL +
"define buffer <gbTableName> for <TableName>." + NL +
"" + NL +
"/* _UIB-CODE-BLOCK-END */" + NL +
"&ANALYZE-RESUME" + NL +
"" + NL +
"" + NL +
"&ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK" + NL +
"" + NL +
"/* ******************** Preprocessor Definitions ******************** */" + NL +
"" + NL +
"&SCOPED-DEFINE PROCEDURE-TYPE Procedure" + NL +
"&SCOPED-DEFINE DB-AWARE no" + NL +
"" + NL +
"" + NL +
"" + NL +
"/* _UIB-PREPROCESSOR-BLOCK-END */" + NL +
"&ANALYZE-RESUME" + NL +
"" + NL +
"" + NL +
"" + NL +
"/* *********************** Procedure Settings ************************ */" + NL +
"" + NL +
"&ANALYZE-SUSPEND _PROCEDURE-SETTINGS" + NL +
"/* Settings for THIS-PROCEDURE" + NL +
" Type: Procedure" + NL +
" Allow:" + NL +
" Frames: 0" + NL +
" Add Fields to: Neither" + NL +
" Other Settings: CODE-ONLY" + NL +
" */" + NL +
"&ANALYZE-RESUME _END-PROCEDURE-SETTINGS" + NL +
"" + NL +
"/* ************************* Create Window ************************** */" + NL +
"" + NL +
"&ANALYZE-SUSPEND _CREATE-WINDOW" + NL +
"/* DESIGN Window definition (used by the UIB)" + NL +
" CREATE WINDOW Procedure ASSIGN" + NL +
" HEIGHT = 6.95" + NL +
" WIDTH = 50.4." + NL +
"/* END WINDOW DEFINITION */" + NL +
" */" + NL +
"&ANALYZE-RESUME" + NL +
"" + NL +
"&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure" + NL +
"/* ************************* Included-Libraries *********************** */" + NL +
"" + NL +
"{basis/job/incl/bj_job10.lib}" + NL +
"" + NL +
"/* _UIB-CODE-BLOCK-END */" + NL +
"&ANALYZE-RESUME" + NL +
"" + NL +
"" + NL +
"" + NL +
"" + NL +
"" + NL +
"&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure" + NL +
"" + NL +
"" + NL +
"/* *************************** Main Block *************************** */" + NL +
"" + NL +
"/*----------------------------------------------------------------------------*/" + NL +
"/* Processing */" + NL +
"/*----------------------------------------------------------------------------*/" + NL +
"" + NL +
"/* Common pre-processing */" + NL +
"" + NL +
"{info/bc/incl/ic_exp01.if}" + NL +
"{adm/template/incl/dt_job20.if}" + NL +
"" + NL +
"/* Start processing */" + NL +
"" + NL +
"put stream strBCExport unformatted" + NL +
" goExport:cColumnLabel(<'TableName.Field1_ID'>:U,'<Field1_ID>':U)" + NL +
" ';':U" + NL +
" goExport:cColumnLabel(<'TableName.Field2_ID>':U,'<Field2_ID>':U)" + NL +
" ';':U" + NL +
"" + NL +
" ... /* Further Fields */" + NL +
" " + NL +
" skip." + NL +
"" + NL +
"Processing:" + NL +
"for each <gb...> /* Table Name*/" + NL +
" no-lock" + NL +
" on error undo, throw:" + NL +
"" + NL +
" put stream strBCExport unformatted" + NL +
" <gbTableName.Field1_ID>" + NL +
" {&PA_IS_ExpDelimiter}" + NL +
" <gbTableName.Field2_ID>" + NL +
" {&PA_IS_ExpDelimiter}" + NL +
" ... /* Further Fields */" + NL +
" skip." + NL +
" " + NL +
"end. /* end for each */" + NL +
"" + NL +
"/* Common post-processing */" + NL +
"" + NL +
"" + NL +
"{adm/template/incl/dt_job21.if}" + NL +
"{info/bc/incl/ic_exp02.if}" + NL +
"" + NL +
"/* _UIB-CODE-BLOCK-END */" + NL +
"&ANALYZE-RESUME";
37 public String generate(Map<String, Object> wizardSettings)
throws TemplateGenerationException
39 final StringBuffer stringBuffer =
new StringBuffer();
45 String module = (String)wizardSettings.get(
"Module");
48 String xbasename = fileName.replace(
".",
"_");
49 Date date =
new Date();
50 SimpleDateFormat year =
new SimpleDateFormat(
"yyyy");
51 SimpleDateFormat today =
new SimpleDateFormat(
"dd.MM.yyyy");
52 stringBuffer.append(TEXT_1);
53 if ((fileName.endsWith(
".p")) || (fileName.endsWith(
".w") || (fileName.endsWith(
".cls"))))
55 stringBuffer.append(TEXT_2);
57 stringBuffer.append(TEXT_3);
58 stringBuffer.append(TEXT_4);
59 stringBuffer.append(
CodeFormatter.SingleLineComment(
"Name : " + fileName));
60 stringBuffer.append(TEXT_4);
61 stringBuffer.append(
CodeFormatter.SingleLineComment(
"Product: " + product +
" - " + productDesc ));
62 stringBuffer.append(TEXT_4);
63 stringBuffer.append(
CodeFormatter.SingleLineComment(
"Module : " + module +
" - " + moduleDesc ));
64 stringBuffer.append(TEXT_5);
65 stringBuffer.append(TEXT_4);
66 stringBuffer.append(
CodeFormatter.SingleLineComment(
"Created: " + version +
" as of " + today.format(date) +
"/" + author));
67 stringBuffer.append(TEXT_6);
68 stringBuffer.append(TEXT_4);
69 stringBuffer.append(
CodeFormatter.MultiLineComment(description));
70 stringBuffer.append(TEXT_7);
71 stringBuffer.append(author);
72 stringBuffer.append(TEXT_8);
73 stringBuffer.append(xbasename);
74 stringBuffer.append(TEXT_9);
75 stringBuffer.append(TEXT_4);
76 return stringBuffer.toString();