7
7
8
8
import com .genexus .CommonUtil ;
9
9
import com .genexus .GXBaseCollection ;
10
+ import com .genexus .ModelContext ;
10
11
import com .genexus .SdtMessages_Message ;
11
- import com .genexus .common . interfaces . SpecificImplementation ;
12
+ import com .genexus .util . GXProperties ;
12
13
13
14
public class GXDynamicCall {
14
15
15
- private GXDynCallProperties properties ;
16
+ private GXProperties properties ;
16
17
private Object instanceObject ;
17
- private String objectName ;
18
+ private String externalName ;
19
+ private int remoteHandle ;
20
+ private ModelContext context ;
18
21
19
- public GXDynamicCall (){
20
- properties = new GXDynCallProperties () ;
21
- properties . setPackageName ( SpecificImplementation . Application . getPACKAGE ()) ;
22
+ public GXDynamicCall (int remoteHandle , ModelContext context ){
23
+ this . remoteHandle = remoteHandle ;
24
+ this . context = context ;
22
25
}
23
26
24
- public GXDynCallProperties getProperties () {
27
+ public GXProperties getProperties () {
25
28
return properties ;
26
29
}
27
30
28
- public void setProperties (GXDynCallProperties properties ) {
31
+ public void setProperties (GXProperties properties ) {
29
32
this .properties = properties ;
30
33
}
31
34
32
- public String getObjectName (){
33
- return objectName ;
34
-
35
+ public String getExternalName (){
36
+ return externalName ;
35
37
}
36
38
37
- public void setObjectName (String name ){
38
- objectName =name ;
39
- properties .setExternalName (name );
39
+ public void setExternalName (String name ){
40
+ externalName =name ;
40
41
}
41
42
42
43
public void execute (Vector <Object > parameters , Vector <SdtMessages_Message > errorsArray ) {
@@ -73,7 +74,7 @@ public Object execute(Vector<Object> parameters, GXDynCallMethodConf methodConfi
73
74
{
74
75
Class <?> auxClass =null ;
75
76
try {
76
- auxClass = loadClass ( properties . getExternalName (), properties . getPackageName () );
77
+ auxClass = Class . forName ( this . externalName );
77
78
} catch (ClassNotFoundException e ) {
78
79
CommonUtil .ErrorToMessages ("Load class Error" , e .getMessage (), errors );
79
80
errorsArray .addAll (errors .getStruct ());
@@ -88,12 +89,10 @@ public Object execute(Vector<Object> parameters, GXDynCallMethodConf methodConfi
88
89
89
90
public void create (Vector <Object > constructParameters , Vector <SdtMessages_Message > errors ) {
90
91
GXBaseCollection <SdtMessages_Message > error =new GXBaseCollection <SdtMessages_Message >();
91
- String objectNameToInvoke ;
92
92
Constructor <?> constructor =null ;
93
- objectNameToInvoke = constructParameters ==null ?objectName :properties .getExternalName ();
94
- if (!objectNameToInvoke .isEmpty ()) {
93
+ if (!this .externalName .isEmpty ()) {
95
94
try {
96
- Class <?> objClass = loadClass ( objectNameToInvoke , properties . getPackageName () );
95
+ Class <?> objClass = Class . forName ( this . externalName );
97
96
Object [] auxConstParameters ;
98
97
Class <?>[] auxConstructorTypes ;
99
98
if (constructParameters != null && constructParameters .size () > 0 ) {
@@ -104,9 +103,9 @@ public void create(Vector<Object> constructParameters, Vector<SdtMessages_Messag
104
103
auxConstructorTypes [i ] = obj .getClass ();
105
104
i ++;
106
105
}
107
- } else {
108
- auxConstParameters = new Object [] {Integer . valueOf (- 1 ) };
109
- auxConstructorTypes = new Class [] {int .class };
106
+ } else {
107
+ auxConstParameters = new Object [] {this . remoteHandle , this . context };
108
+ auxConstructorTypes = new Class [] {int .class , ModelContext . class };
110
109
}
111
110
try {
112
111
constructor = objClass .getConstructor (auxConstructorTypes );
@@ -255,13 +254,4 @@ private static void updateParams(Vector<Object> originalParameter, Object[] call
255
254
originalParameter .set (i , objectToUpdate );
256
255
}
257
256
}
258
-
259
- private Class <?> loadClass (String className , String sPackage ) throws ClassNotFoundException {
260
- String classPackage ="" ;
261
- if (sPackage != null )
262
- classPackage += sPackage + "." ;
263
- classPackage += className ;
264
- Class <?> c = Class .forName (classPackage );;
265
- return c ;
266
- }
267
257
}
0 commit comments