Project

General

Profile

dataset-handle.diff

Constantin Asofiei, 11/06/2023 01:21 PM

Download (3.48 KB)

View differences:

new/src/com/goldencode/p2j/oo/reflect/Legacy4GLMethod.java 2023-11-06 18:21:03 +0000
13 13
**     ME  20211028 Added 'POLY' return data type for invoke. 
14 14
** 004 ME  20230905 Implement remaining stubs methods.
15 15
**     ME  20230918 Use function blocks for method that needs error handling, cache string representation.
16
** 005 CA  20231106 Properly report DATASET/TABLE/-HANDLE parameters. 
16 17
*/
17 18

  
18 19
/*
......
468 469

  
469 470
         for (int i = 0; i < params.length; i++)
470 471
         {
471
            _parameters.add(new Parameter(i, params[i]));
472
            _parameters.add(new Parameter(i, params[i], this.ie.getMethod()));
472 473
         }
473 474
      }
474 475
      
new/src/com/goldencode/p2j/oo/reflect/Parameter.java 2023-11-06 18:21:09 +0000
11 11
** 003 ME  20230829 Added default ctor and set properties according to parameter signature.
12 12
**     ME  20230904 Override toString to use the string representation in method signature.
13 13
**     ME  20230918 Cache string representation, fix parameter mode enum mapping.
14
** 004 CA  20231106 Properly report DATASET/TABLE/-HANDLE parameters. 
14 15
*/
15 16

  
16 17
/*
......
74 75
import static com.goldencode.p2j.report.ReportConstants.RT_LVL_FULL;
75 76
import static com.goldencode.p2j.util.InternalEntry.Type;
76 77

  
78
import java.lang.reflect.*;
79

  
77 80
import com.goldencode.p2j.oo.lang.LegacyEnum;
81
import com.goldencode.p2j.persist.*;
78 82

  
79 83
/**
80 84
 * Business logic (converted to Java from the 4GL source code
......
99 103
   
100 104
   private String txtSig;
101 105

  
102
   public Parameter (int position, LegacyParameter legacyParam) {
106
   public Parameter (int position, LegacyParameter legacyParam, Method mthd) {
103 107
      this.position.assign(position + 1);
104 108
      this.name.assign(getName(legacyParam));
105 109
      this.mode.assign(getMode(legacyParam));
106
      this.dataType.assign(DataType.getEnum(new character(legacyParam.type())));
110
      java.lang.reflect.Parameter mthdParam =  mthd.getParameters()[position];
111
      Class<?> mthdParamType = mthdParam.getType();
112
      if (DataSetParameter.class.isAssignableFrom(mthdParamType))
113
      {
114
         if (InputDataSetHandle.class == mthdParamType  ||
115
             OutputDataSetHandle.class == mthdParamType ||
116
             InputOutputDataSetHandle.class == mthdParamType)
117
         {
118
            this.dataType.assign(DataType.dataSetHandle);
119
         }
120
         else
121
         {
122
            this.dataType.assign(DataType.dataSet);
123
         }
124
      }
125
      else if (TableParameter.class.isAssignableFrom(mthdParamType))
126
      {
127
         if (InputTableHandle.class == mthdParamType  ||
128
             OutputTableHandle.class == mthdParamType ||
129
             InputTableHandle.class == mthdParamType)
130
         {
131
            this.dataType.assign(DataType.tableHandle);
132
         }
133
         else
134
         {
135
            this.dataType.assign(DataType.table);
136
         }
137
      }
138
      else
139
      {
140
         this.dataType.assign(DataType.getEnum(new character(legacyParam.type())));
141
      }
142
      
107 143
      this.dataTypeName.assign(legacyParam.qualified() == null || legacyParam.qualified().isEmpty() ? null : legacyParam.qualified());
108 144
      // extends is unknown if size not set, 0 if not an array
109 145
      if (legacyParam.extent() != -1)