Integrated with #23784 functionalities

This commit is contained in:
Francesco Mangiacrapa 2022-08-31 17:22:15 +02:00
parent e5a10134bd
commit 8c302a4110
7 changed files with 44 additions and 13 deletions

View File

@ -9,7 +9,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
#### Enhancements #### Enhancements
- [#22883] Integrate the configurations exposed by (the new) geoportal-client (>= 1.1.0-SNAPSHOT) - [#22883] Integrated the configurations exposed by (the new) geoportal-client (>= 1.1.0-SNAPSHOT)
- Passed to UCD/Projects geoportal client/service
## [v1.4.0] - 2022-06-08 ## [v1.4.0] - 2022-06-08

View File

@ -201,11 +201,22 @@ public class ConvertToDataValueObjectModel {
GEOPORTAL_CONFIGURATION_TYPE geoportalConfigType = null; GEOPORTAL_CONFIGURATION_TYPE geoportalConfigType = null;
ArrayList<String> jsonConfigurations = null; ArrayList<String> jsonConfigurations = null;
//this is the 'projection' field stored in the Configuration,
//if the field exists, e.g. _theDocument, it used as suffix to get the right JSON path concatenating the projection + the paths
String projection = null;
for (GEOPORTAL_CONFIGURATION_TYPE configManaged : readConfigs) { for (GEOPORTAL_CONFIGURATION_TYPE configManaged : readConfigs) {
try { try {
LOG.debug("searching '" + configManaged.getId() + "' in the configuration " + configuration); LOG.debug("searching '" + configManaged.getId() + "' in the configuration " + configuration);
LOG.trace("contains " + configManaged.getId() + ": " LOG.trace("contains " + configManaged.getId() + ": "
+ configuration.containsKey(configManaged.getId())); + configuration.containsKey(configManaged.getId()));
try {
projection = configuration.getString("projection");
}catch (Exception e) {
// TODO: handle exception
}
ArrayList<LinkedHashMap<String, Object>> listHashMapConfig = configuration ArrayList<LinkedHashMap<String, Object>> listHashMapConfig = configuration
.get(configManaged.getId(), ArrayList.class); .get(configManaged.getId(), ArrayList.class);
LOG.debug("hashMapConfig found is: {}", listHashMapConfig); LOG.debug("hashMapConfig found is: {}", listHashMapConfig);
@ -216,6 +227,11 @@ public class ConvertToDataValueObjectModel {
for (LinkedHashMap<String, Object> config : listHashMapConfig) { for (LinkedHashMap<String, Object> config : listHashMapConfig) {
Document document = new Document(config); Document document = new Document(config);
// //THIS PART MUST BE REVISITED
// if(projection!=null)
// document.append("projection", projection);
String jsonValue = document.toJson(); String jsonValue = document.toJson();
LOG.debug("config is: {}", jsonValue); LOG.debug("config is: {}", jsonValue);
jsonConfigurations.add(jsonValue); jsonConfigurations.add(jsonValue);
@ -254,7 +270,7 @@ public class ConvertToDataValueObjectModel {
ConfigurationDV<List<GcubeProfileDV>> dDV = new ConfigurationDV<List<GcubeProfileDV>>( ConfigurationDV<List<GcubeProfileDV>> dDV = new ConfigurationDV<List<GcubeProfileDV>>(
listGcubeProfiles); listGcubeProfiles);
dDV.setConfiguration(listGcubeProfiles); dDV.setConfiguration(listGcubeProfiles);
dDV.setConfigurationType(GEOPORTAL_CONFIGURATION_TYPE.gcube_profiles); dDV.setConfigurationType(geoportalConfigType); //-> GEOPORTAL_CONFIGURATION_TYPE.gcube_profiles
hdDV.setConfiguration(dDV); hdDV.setConfiguration(dDV);
LOG.info("returning {}", hdDV); LOG.info("returning {}", hdDV);
return hdDV; return hdDV;
@ -273,7 +289,7 @@ public class ConvertToDataValueObjectModel {
ConfigurationDV<List<ItemFieldDV>> dDV = new ConfigurationDV<List<ItemFieldDV>>(listItemFields); ConfigurationDV<List<ItemFieldDV>> dDV = new ConfigurationDV<List<ItemFieldDV>>(listItemFields);
dDV.setConfiguration(listItemFields); dDV.setConfiguration(listItemFields);
dDV.setConfigurationType(GEOPORTAL_CONFIGURATION_TYPE.item_fields); dDV.setConfigurationType(geoportalConfigType); //-> GEOPORTAL_CONFIGURATION_TYPE.item_fields
hdDV.setConfiguration(dDV); hdDV.setConfiguration(dDV);
LOG.info("returning {}", hdDV); LOG.info("returning {}", hdDV);
return hdDV; return hdDV;
@ -473,7 +489,7 @@ public class ConvertToDataValueObjectModel {
* @return the result document DV * @return the result document DV
*/ */
public static ResultDocumentDV toResultDocumentDV(Project project) { public static ResultDocumentDV toResultDocumentDV(Project project) {
LOG.info("toResultDocumentDV called"); LOG.debug("toResultDocumentDV called");
if (project == null) if (project == null)
return null; return null;

View File

@ -343,7 +343,8 @@ public class ProjectsCaller {
for (ItemFieldDV itemField : orderByFields) { for (ItemFieldDV itemField : orderByFields) {
if (itemField.getJsonFields() != null) { if (itemField.getJsonFields() != null) {
for (String field : itemField.getJsonFields()) { for (String field : itemField.getJsonFields()) {
orderingFields.add(field); String fieldFullPath = String.format("%s.%s", itemField.getProjection(),field);
orderingFields.add(fieldFullPath);
} }
} }
@ -424,6 +425,7 @@ public class ProjectsCaller {
} }
//TESTING MODE - REMOVING DIRTY DOCUMENTS
BasicDBObject bsValid_Document = new BasicDBObject(); BasicDBObject bsValid_Document = new BasicDBObject();
bsValid_Document.append("$exists", true); bsValid_Document.append("$exists", true);
bsValid_Document.append("$ne", null); bsValid_Document.append("$ne", null);

View File

@ -22,9 +22,12 @@ public class ItemFieldDV implements GeoportalConfigurationID, Serializable {
private boolean displayAsResult; private boolean displayAsResult;
private boolean sortable; private boolean sortable;
private boolean searchable; private boolean searchable;
private String configID; private String configID;
// This is the prefix of the document projection, e.g. _theDocument
private String projection = "_theDocument";
/** /**
* Instantiates a new item field. * Instantiates a new item field.
*/ */
@ -172,11 +175,15 @@ public class ItemFieldDV implements GeoportalConfigurationID, Serializable {
this.searchable = searchable; this.searchable = searchable;
} }
/** //THIS ONE MUST BE REVISITED. MUST BE PASSED IN THE CONFIGURATION
* To string. public String getProjection() {
* return projection;
* @return the string }
*/
// public void setProjection(String projection) {
// this.projection = projection;
// }
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
@ -192,6 +199,10 @@ public class ItemFieldDV implements GeoportalConfigurationID, Serializable {
builder.append(sortable); builder.append(sortable);
builder.append(", searchable="); builder.append(", searchable=");
builder.append(searchable); builder.append(searchable);
builder.append(", configID=");
builder.append(configID);
builder.append(", projection=");
builder.append(projection);
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }

View File

@ -43,7 +43,7 @@ public class Project_Tests {
// private static String TOKEN = ""; //preVRE // private static String TOKEN = ""; //preVRE
private static String CONTEXT = "/gcube/devsec/devVRE"; private static String CONTEXT = "/gcube/devsec/devVRE";
private static String TOKEN = ""; // devVRE private static String TOKEN = "c41a00c0-7897-48d2-a67a-05190d6ce5e6-98187548"; // devVRE
private static String PROFILE_ID = "profiledConcessioni"; private static String PROFILE_ID = "profiledConcessioni";
private static String PROJECT_ID = "62962b2502ad3d25dc21deac"; private static String PROJECT_ID = "62962b2502ad3d25dc21deac";

View File

@ -28,7 +28,7 @@ public class UCD_Tests {
// private static String TOKEN = ""; //preVRE // private static String TOKEN = ""; //preVRE
private static String CONTEXT = "/gcube/devsec/devVRE"; private static String CONTEXT = "/gcube/devsec/devVRE";
private static String TOKEN = ""; // devVRE private static String TOKEN = "c41a00c0-7897-48d2-a67a-05190d6ce5e6-98187548"; // devVRE
private static String PROFILE_ID = "profiledConcessioni"; private static String PROFILE_ID = "profiledConcessioni";

View File

@ -5,3 +5,4 @@
/pred4s.gcubekey /pred4s.gcubekey
/preprod.gcubekey /preprod.gcubekey
/geoportal-config.json /geoportal-config.json
/devVRE_TOKEN.txt