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
- [#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

View File

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

View File

@ -343,7 +343,8 @@ public class ProjectsCaller {
for (ItemFieldDV itemField : orderByFields) {
if (itemField.getJsonFields() != null) {
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();
bsValid_Document.append("$exists", true);
bsValid_Document.append("$ne", null);

View File

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

View File

@ -43,7 +43,7 @@ public class Project_Tests {
// private static String TOKEN = ""; //preVRE
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 PROJECT_ID = "62962b2502ad3d25dc21deac";

View File

@ -28,7 +28,7 @@ public class UCD_Tests {
// private static String TOKEN = ""; //preVRE
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";

View File

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