Skip to content

Commit bc783a6

Browse files
authored
Merge branch 'master' into embedding-data-type
2 parents 175cc47 + 55cf746 commit bc783a6

File tree

302 files changed

+18306
-149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+18306
-149
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ These are the source of the GeneXus Standard Classes for Java, valid since GeneX
2525
| gxexternalproviders | Implements service provider for IBM Cloud, Google, Azure, Amazon
2626
| gxgeospatial | Geography data type implementation
2727
| gxodata | OData access
28+
| securityapicommons | SecurityAPI's common module
29+
| gxcryptography | SecurityAPI's GeneXusCryptography module
30+
| gxjwt | SecurityAPI's GeneXusJWT module
31+
| gxxmlsignature | SecurityAPI's GeneXusXmlSignature module
32+
| gxftps | SecurityAPI's GeneXusFTPS module
33+
| gxsftp | SecurityAPI's GeneXusSFTP module
2834

2935
The dependencies between the projects are specified in each pom.xml within their directory.
3036

android/src/main/java/com/genexus/db/SQLAndroidSQLiteHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
public class SQLAndroidSQLiteHelper
77
{
8-
private static String clazzFullName = "com.artech.layers.LocalUtils";
8+
private static String clazzFullName = "com.genexus.android.core.layers.LocalUtils";
99

1010
public static void beginTransaction()
1111
{

android/src/main/java/com/genexus/internet/HttpContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ public void SendState()
414414
}catch(Exception ex){}
415415
writeTextNL("<script type=\"text/javascript\">gx.http.useBase64State=true;</script>");
416416
}
417-
writeText("<div><input type=\"hidden\" name=\"GXState\" value='");
417+
writeText("<div><input type=\"hidden\" name=\"GXState\" data-gtm-ignore='true' value='");
418418
writeTextNL("'" + htmlEndTag(HTMLElement.INPUT) + "</div>");
419419
if (this.formCaption != null && !this.formCaption.equals(""))
420420
{

android/src/main/java/com/genexus/specific/android/AndroidJSONSerialization.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.Map;
1010

1111
public class AndroidJSONSerialization implements IExtensionJSONSerialization {
12+
1213
@Override
1314
public Iterator<Map.Entry<String, Object>> getJSONObjectIterator(JSONObjectWrapper obj) {
1415
Map<String, Object> map = new LinkedHashMap<>();
@@ -24,4 +25,15 @@ public Iterator<Map.Entry<String, Object>> getJSONObjectIterator(JSONObjectWrapp
2425
public JSONTokener getJSONTokener(String s) {
2526
return new AndroidJSONTokenerWrapper(s);
2627
}
28+
29+
@Override
30+
public Map<String, Object> getJSONObjectMap(JSONObjectWrapper obj) {
31+
Map<String, Object> map = new LinkedHashMap<>();
32+
for (Iterator<String> it = obj.keys(); it.hasNext(); ) {
33+
String k = it.next();
34+
map.put(k, obj.get(k)); // add key and value to map result
35+
}
36+
return map;
37+
38+
}
2739
}

common/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<dependency>
4444
<groupId>org.bouncycastle</groupId>
4545
<artifactId>bcprov-jdk18on</artifactId>
46-
<version>1.78.1</version>
46+
<version>${org.bouncycastle.version}</version>
4747
</dependency>
4848
<dependency>
4949
<groupId>io.opentelemetry</groupId>
@@ -53,7 +53,7 @@
5353
<dependency>
5454
<groupId>org.json</groupId>
5555
<artifactId>json</artifactId>
56-
<version>20231013</version>
56+
<version>20250517</version>
5757
</dependency>
5858
</dependencies>
5959

common/src/main/java/com/genexus/BaseProvider.java

Lines changed: 44 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.io.File;
44
import java.io.IOException;
5-
import java.nio.charset.StandardCharsets;
65
import java.util.Date;
76
import java.util.List;
87
import java.util.ListIterator;
@@ -20,6 +19,8 @@
2019
import com.genexus.common.interfaces.SpecificImplementation;
2120
import com.genexus.util.GXDirectory;
2221
import com.genexus.util.GXFileCollection;
22+
import org.springframework.core.io.ClassPathResource;
23+
import org.springframework.core.io.FileSystemResource;
2324
import org.springframework.core.io.Resource;
2425
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
2526

@@ -53,76 +54,65 @@ private void loadQueryTables()
5354
{
5455
String path = SpecificImplementation.Application.getModelContext().getHttpContext().getDefaultPath();
5556
String configurationDirectoryPath = path + File.separatorChar + "Metadata" + File.separatorChar + "TableAccess";
56-
57-
ConcurrentHashMap<String, Vector<String>> qTables = new ConcurrentHashMap();
58-
loadQueryTablesPlatform(configurationDirectoryPath, qTables);
57+
ConcurrentHashMap<String, Vector<String>> qTables = new ConcurrentHashMap<String, Vector<String>>();
58+
if (ApplicationContext.getInstance().isSpringBootApp())
59+
loadQueryTablesSpringBoot(configurationDirectoryPath, qTables);
60+
else
61+
loadQueryTablesFileSystem(configurationDirectoryPath, qTables);
5962
startupDate = CommonUtil.now(false,false);
6063
queryTables = qTables;
6164
}
6265
}
6366

64-
public void loadQueryTablesPlatform(String configurationDirectoryPath, ConcurrentHashMap<String, Vector<String>> qTables) {
65-
if (ApplicationContext.getInstance().isSpringBootApp())
66-
loadQueryTablesSpringBoot(configurationDirectoryPath, qTables);
67-
else
68-
loadQueryTablesNone(configurationDirectoryPath, qTables);
69-
70-
}
71-
72-
public void loadQueryTablesNone(String configurationDirectoryPath, ConcurrentHashMap<String, Vector<String>> qTables) {
67+
private void loadQueryTablesFileSystem(String configurationDirectoryPath, ConcurrentHashMap<String, Vector<String>> qTables){
7368
GXDirectory configurationDirectory = new GXDirectory(configurationDirectoryPath);
7469
GXFileCollection files = configurationDirectory.getFiles();
7570
XMLReader reader = new XMLReader();
76-
short ok;
77-
boolean anyTable=false;
78-
for(int i=1; i <= files.getItemCount(); i++) {
79-
Vector<String> lst = new Vector<String>();
80-
lst.add(FORCED_INVALIDATE); // Caso en que se invalido el cache manualmente
71+
boolean anyTables=false;
72+
for(int i=1; i <= files.getItemCount(); i++)
73+
{
8174
AbstractGXFile xmlFile = files.item(i);
82-
reader.open(xmlFile.getAbsoluteName());
83-
ok = reader.readType(1, "Table");
84-
while (ok == 1) {
85-
anyTable=true;
86-
lst.add(normalizeKey(reader.getAttributeByName("name")));
87-
ok = reader.readType(1, "Table");
88-
}
89-
reader.close();
90-
if (anyTable) {
91-
qTables.put(normalizeKey(xmlFile.getNameNoExt()), lst);
92-
}
75+
String xmlFileName = xmlFile.getAbsoluteName();
76+
String xmlFileNameNoExt = xmlFile.getNameNoExt();
77+
anyTables = processXMLFile(reader, anyTables, xmlFileName, xmlFileNameNoExt, qTables);
9378
}
9479
}
9580

96-
public void loadQueryTablesSpringBoot(String configurationDirectoryPath, ConcurrentHashMap<String, Vector<String>> qTables) {
81+
private void loadQueryTablesSpringBoot(String configurationDirectoryPath, ConcurrentHashMap<String, Vector<String>> qTables){
82+
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
9783
try {
98-
Resource[] resources = new PathMatchingResourcePatternResolver().getResources(configurationDirectoryPath + "/*.xml");
84+
Resource[] resources = resolver.getResources("classpath:" + configurationDirectoryPath + "/*");
9985
XMLReader reader = new XMLReader();
100-
reader.setDocEncoding("UTF8");
101-
short ok;
102-
boolean anyTable=false;
103-
String xmlContent;
104-
for (int i = 0; i < resources.length; i++) {
105-
Vector<String> lst = new Vector<String>();
106-
lst.add(FORCED_INVALIDATE);
107-
xmlContent = resources[i].getContentAsString(StandardCharsets.UTF_8);
108-
if (!xmlContent.startsWith("<"))
109-
xmlContent = xmlContent.substring(1); //Avoid BOM
110-
reader.openFromString(xmlContent);
111-
ok = reader.readType(1, "Table");
112-
while (ok == 1) {
113-
anyTable=true;
114-
lst.add(normalizeKey(reader.getAttributeByName("name")));
115-
ok = reader.readType(1, "Table");
116-
}
117-
reader.close();
118-
if (anyTable) {
119-
qTables.put(normalizeKey(resources[i].getFilename().substring(0, resources[i].getFilename().lastIndexOf("."))), lst);
120-
}
86+
boolean anyTables=false;
87+
for (Resource resource : resources) {
88+
String xmlFileName = resource.getFilename();
89+
String xmlFileNameNoExt = xmlFileName.substring(0, xmlFileName.lastIndexOf('.'));
90+
xmlFileName = resource instanceof FileSystemResource? ((FileSystemResource) resource).getPath() : ((ClassPathResource) resource).getPath();
91+
anyTables = processXMLFile(reader, anyTables, xmlFileName, xmlFileNameNoExt, qTables);
12192
}
12293
}
123-
catch (IOException e) {
124-
logger.error("Error reading Table Access metadata", e);
94+
catch (IOException e){
95+
logger.error("Error loading Query Tables ", e);
96+
}
97+
}
98+
99+
private boolean processXMLFile(XMLReader reader, boolean anyTables, String xmlFileName, String xmlFileNameNoExt, ConcurrentHashMap<String, Vector<String>> qTables) {
100+
Vector<String> lst = new Vector<>();
101+
lst.add(FORCED_INVALIDATE); // Caso en que se invalido el cache manualmente
102+
reader.open(xmlFileName);
103+
short ok = reader.readType(1, "Table");
104+
boolean anyLocalTables = false;
105+
while (ok == 1)
106+
{
107+
anyLocalTables = true;
108+
lst.add(normalizeKey(reader.getAttributeByName("name")));
109+
ok = reader.readType(1, "Table");
110+
}
111+
reader.close();
112+
if (anyTables || anyLocalTables) {
113+
qTables.put(normalizeKey(xmlFileNameNoExt), lst);
125114
}
115+
return anyTables || anyLocalTables;
126116
}
127117

128118
public ConcurrentHashMap<String, Vector<String>> queryTables() {

common/src/main/java/com/genexus/GXBaseCollection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public void FromJSONObject(Object obj)
233233
try
234234
{
235235
Object jsonObj = jsonArr.get(i);
236-
if (jsonObj instanceof JSONObject)
236+
if ((jsonObj instanceof JSONObject) && !(jsonObj instanceof JSONObjectWrapper))
237237
jsonObj = new JSONObjectWrapper((JSONObject)jsonObj);
238238
Class[] parTypes = new Class[] {};
239239
Object[] arglist = new Object[] {};

common/src/main/java/com/genexus/GxSilentTrnSdt.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
package com.genexus;
2-
import com.genexus.ModelContext;
2+
33
import com.genexus.common.interfaces.IPendingEventHelper;
44
import com.genexus.common.interfaces.SpecificImplementation;
55
import com.genexus.diagnostics.core.ILogger;
66
import com.genexus.diagnostics.core.LogManager;
77
import com.genexus.util.GXProperties;
88

9-
import java.io.InputStream;
10-
import java.io.StringWriter;
119
import java.lang.reflect.Method;
1210
import java.util.HashMap;
1311
import java.util.HashSet;
14-
15-
import com.genexus.xml.GXXMLSerializer;
12+
import java.util.Set;
1613

1714
public class GxSilentTrnSdt extends com.genexus.xml.GXXMLSerializable
1815
{
1916
static final ILogger logger = LogManager.getLogger(GxSilentTrnSdt.class);
2017
static final String SET_METHOD_PREFIX = "setgxTv_";
2118
static final String GET_METHOD_PREFIX = "getgxTv_";
2219
IPendingEventHelper pendingHelper;
23-
GXProperties dirties = new GXProperties();
20+
Set<String> dirties = new HashSet<>();
2421

2522
IGxSilentTrn trn;
2623
public GxSilentTrnSdt( ModelContext context, String type)
@@ -238,14 +235,12 @@ public boolean InsertOrUpdate()
238235

239236
public void SetDirty(String fieldName)
240237
{
241-
dirties.put(fieldName.toLowerCase(), "true");
238+
dirties.add(fieldName.toLowerCase());
242239
}
243240
@Override
244241
public boolean IsDirty(String fieldName)
245242
{
246-
if (dirties.containsKey(fieldName.toLowerCase()))
247-
return true;
248-
return false;
243+
return dirties.contains(fieldName.toLowerCase());
249244
}
250245

251246
public GXProperties getMetadata()

common/src/main/java/com/genexus/LocalUtil.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.genexus;
22

3+
import java.math.RoundingMode;
34
import java.util.*;
45
import java.text.*;
56

@@ -1713,6 +1714,7 @@ private String formatBigDecimal(java.math.BigDecimal value, String picture, Numb
17131714
{
17141715
DecimalFormat df = (DecimalFormat) numberFormat;
17151716
df.applyPattern(pictureToNumberFormat(withoutSuffixPicture));
1717+
df.setRoundingMode(RoundingMode.HALF_UP);
17161718
if ( CommonUtil.in(picture, '.') || CommonUtil.in(picture, ','))
17171719
{
17181720
formatted = alignAndPad(df.format(value), '0', withoutSuffixPicture, floating, numberFormat, originalPicture);

common/src/main/java/com/genexus/common/interfaces/IExtensionJSONSerialization.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
public interface IExtensionJSONSerialization {
1010
Iterator<Map.Entry<String, Object>> getJSONObjectIterator(JSONObjectWrapper obj);
1111
JSONTokener getJSONTokener(String s);
12+
public Map<String, Object> getJSONObjectMap(JSONObjectWrapper obj);
1213
}

common/src/main/java/com/genexus/json/JSONObjectWrapper.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,12 @@ public JSONObjectWrapper(String string) {
2222
? SpecificImplementation.JsonSerialization.getJSONTokener(string)
2323
: new JSONTokenerWrapper(string)
2424
);
25-
26-
if (map == null)
27-
map = new LinkedHashMap<String, Object>();
25+
initMap();
2826
}
2927

3028
public JSONObjectWrapper(JSONTokenerWrapper token) {
3129
super(token);
32-
if (map == null)
33-
map = new LinkedHashMap<String, Object>();
30+
initMap();
3431
}
3532

3633
public JSONObjectWrapper(Map<?,?> m) {
@@ -48,8 +45,18 @@ public JSONObjectWrapper(Map<?,?> m) {
4845

4946
public JSONObjectWrapper(JSONObject jsonObject) {
5047
super(jsonObject.toString());
48+
initMap();
49+
}
50+
51+
private void initMap() {
5152
if (map == null)
52-
map = new LinkedHashMap<String, Object>();
53+
{
54+
// this is a workaround for the Android implementation not loading the map in the JsonObject constructor
55+
if (SpecificImplementation.JsonSerialization != null)
56+
map = SpecificImplementation.JsonSerialization.getJSONObjectMap(this);
57+
else
58+
map = new LinkedHashMap<String, Object>();
59+
}
5360
}
5461

5562
public Set<Entry<String, Object>> entrySet() {

common/src/main/java/com/genexus/json/JSONTokenerWrapper.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,32 @@
44
import org.json.JSONException;
55

66
public class JSONTokenerWrapper extends JSONTokener{
7+
private String mySource;
8+
private int myIndex;
79

810
public JSONTokenerWrapper(String string) {
911
super(string);
12+
mySource = string;
13+
myIndex = 0;
14+
}
15+
16+
public void back() {
17+
if (myIndex > 0) {
18+
myIndex -= 1;
19+
}
20+
}
21+
22+
public boolean more() {
23+
return myIndex < mySource.length();
24+
}
25+
26+
public char next() {
27+
if (more()) {
28+
char c = mySource.charAt(myIndex);
29+
this.myIndex += 1;
30+
return c;
31+
}
32+
return 0;
1033
}
1134

1235
public Object nextValue() throws JSONException {

common/src/main/java/com/genexus/xml/GXXMLSerializable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ public void FromJSONObject(Object obj)
363363
}
364364
else
365365
{
366-
if (obj instanceof JSONObject)
366+
if ((obj instanceof JSONObject) && !(obj instanceof JSONObjectWrapper))
367367
obj = new JSONObjectWrapper((JSONObject)obj);
368368
Iterator objIterator = getJSONObjectIterator((JSONObjectWrapper) obj);
369369
Iterator modifiedObjIterator = getFromJSONObjectOrderIterator(objIterator);
@@ -467,7 +467,7 @@ private void collectionFromJSONArray(JSONArray jsonArray, GXSimpleCollection gxC
467467
for(int i = 0; i < jsonArray.length(); i++)
468468
{
469469
Object currObj = jsonArray.get(i);
470-
if (currObj instanceof JSONObject)
470+
if ((currObj instanceof JSONObject) && !(currObj instanceof JSONObjectWrapper))
471471
currObj = new JSONObjectWrapper((JSONObject)currObj);
472472
if(currObj instanceof JSONObjectWrapper || !gxColl.IsSimpleCollection())
473473
{

gxcryptocommon/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<dependency>
2323
<groupId>org.bouncycastle</groupId>
2424
<artifactId>bcpkix-jdk18on</artifactId>
25-
<version>1.78.1</version>
25+
<version>${org.bouncycastle.version}</version>
2626
</dependency>
2727
<dependency>
2828
<groupId>org.apache.santuario</groupId>

0 commit comments

Comments
 (0)