|
|
|
@ -23,12 +23,14 @@ import org.gcube.application.geoportal.common.model.document.lifecycle.Lifecycle
|
|
|
|
|
import org.gcube.application.geoportal.common.model.document.relationships.Relationship;
|
|
|
|
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration;
|
|
|
|
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
|
|
|
|
import org.gcube.application.geoportalcommon.geoportal.config.ActionDefinition;
|
|
|
|
|
import org.gcube.application.geoportalcommon.geoportal.config.FilePath;
|
|
|
|
|
import org.gcube.application.geoportalcommon.geoportal.config.GcubeProfile;
|
|
|
|
|
import org.gcube.application.geoportalcommon.geoportal.config.ItemField;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
|
|
|
@ -104,6 +106,7 @@ public class ConvertToDataValueObjectModel {
|
|
|
|
|
|
|
|
|
|
List<HandlerDeclarationDV> listHandlersDV = new ArrayList<HandlerDeclarationDV>();
|
|
|
|
|
if (handlersIds != null) {
|
|
|
|
|
LOG.info("List of input handlersIds is "+handlersIds+", converting it");
|
|
|
|
|
Map<String, List<HandlerDeclaration>> handlersMapByID = ucd.getHandlersMapByID();
|
|
|
|
|
|
|
|
|
|
if (handlersMapByID != null) {
|
|
|
|
@ -124,6 +127,7 @@ public class ConvertToDataValueObjectModel {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
LOG.info("List of input handlersIds is null, reading all handlers");
|
|
|
|
|
List<HandlerDeclaration> listHandlerDeclaration = ucd.getHandlers();
|
|
|
|
|
for (HandlerDeclaration handlerDeclaration : listHandlerDeclaration) {
|
|
|
|
|
LOG.debug("converting handler {}", handlerDeclaration);
|
|
|
|
@ -175,7 +179,8 @@ public class ConvertToDataValueObjectModel {
|
|
|
|
|
*/
|
|
|
|
|
public static HandlerDeclarationDV toHandlerDeclarationDV(HandlerDeclaration handlerDeclaration, String profileName,
|
|
|
|
|
GEOPORTAL_CONFIGURATION_TYPE... readConfigs) throws Exception {
|
|
|
|
|
|
|
|
|
|
LOG.debug("toHandlerDeclarationDV called [handlerDeclaration: "+handlerDeclaration+"], [profileName: "+profileName+"], [readConfigs: "+readConfigs+"]");
|
|
|
|
|
|
|
|
|
|
if (handlerDeclaration == null) {
|
|
|
|
|
LOG.warn(HandlerDeclaration.class.getSimpleName() + " is null");
|
|
|
|
|
return null;
|
|
|
|
@ -199,24 +204,25 @@ public class ConvertToDataValueObjectModel {
|
|
|
|
|
readConfigs = GEOPORTAL_CONFIGURATION_TYPE.values();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GEOPORTAL_CONFIGURATION_TYPE geoportalConfigType = null;
|
|
|
|
|
List<GEOPORTAL_CONFIGURATION_TYPE> listGeoportalConfigType = new ArrayList<GEOPORTAL_CONFIGURATION_TYPE>();
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
// 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) {
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
// TODO: handle exception
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ArrayList<LinkedHashMap<String, Object>> listHashMapConfig = configuration
|
|
|
|
|
.get(configManaged.getId(), ArrayList.class);
|
|
|
|
|
LOG.debug("hashMapConfig found is: {}", listHashMapConfig);
|
|
|
|
@ -227,17 +233,17 @@ 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);
|
|
|
|
|
}
|
|
|
|
|
LOG.debug("configurations found are: {}", jsonConfigurations);
|
|
|
|
|
geoportalConfigType = configManaged;
|
|
|
|
|
listGeoportalConfigType.add(configManaged);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
@ -246,6 +252,7 @@ public class ConvertToDataValueObjectModel {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (jsonConfigurations == null) {
|
|
|
|
|
String error = "No managed configurations as '"
|
|
|
|
|
+ Arrays.asList(GEOPORTAL_CONFIGURATION_TYPE.values()).toString() + "' found in the handler "
|
|
|
|
@ -253,50 +260,73 @@ public class ConvertToDataValueObjectModel {
|
|
|
|
|
LOG.warn(error);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (GEOPORTAL_CONFIGURATION_TYPE geoportalConfigType : listGeoportalConfigType) {
|
|
|
|
|
|
|
|
|
|
switch (geoportalConfigType) {
|
|
|
|
|
case gcube_profiles: {
|
|
|
|
|
|
|
|
|
|
switch (geoportalConfigType) {
|
|
|
|
|
case gcube_profiles: {
|
|
|
|
|
List<GcubeProfileDV> listGcubeProfiles = new ArrayList<GcubeProfileDV>(jsonConfigurations.size());
|
|
|
|
|
|
|
|
|
|
List<GcubeProfileDV> listGcubeProfiles = new ArrayList<GcubeProfileDV>(jsonConfigurations.size());
|
|
|
|
|
int i = 0;
|
|
|
|
|
for (String asJSONString : jsonConfigurations) {
|
|
|
|
|
LOG.debug(++i + ") the gCubeProfile is: " + asJSONString);
|
|
|
|
|
GcubeProfile profile = org.gcube.application.geoportal.client.utils.Serialization.read(asJSONString,
|
|
|
|
|
GcubeProfile.class);
|
|
|
|
|
listGcubeProfiles.add(toGcubeProfileDV(profile));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
for (String asJSONString : jsonConfigurations) {
|
|
|
|
|
LOG.debug(++i + ") the gCubeProfile is: " + asJSONString);
|
|
|
|
|
GcubeProfile profile = org.gcube.application.geoportal.client.utils.Serialization.read(asJSONString,
|
|
|
|
|
GcubeProfile.class);
|
|
|
|
|
listGcubeProfiles.add(toGcubeProfileDV(profile));
|
|
|
|
|
ConfigurationDV<List<GcubeProfileDV>> dDV = new ConfigurationDV<List<GcubeProfileDV>>(
|
|
|
|
|
listGcubeProfiles);
|
|
|
|
|
dDV.setConfiguration(listGcubeProfiles);
|
|
|
|
|
dDV.setConfigurationType(geoportalConfigType); // -> GEOPORTAL_CONFIGURATION_TYPE.gcube_profiles
|
|
|
|
|
hdDV.setConfiguration(dDV);
|
|
|
|
|
LOG.info("returning {}", hdDV);
|
|
|
|
|
return hdDV;
|
|
|
|
|
}
|
|
|
|
|
case item_fields: {
|
|
|
|
|
|
|
|
|
|
List<ItemFieldDV> listItemFields = new ArrayList<ItemFieldDV>(jsonConfigurations.size());
|
|
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
for (String asJSONString : jsonConfigurations) {
|
|
|
|
|
LOG.debug(++i + ") the itemField is: " + asJSONString);
|
|
|
|
|
ItemField itemField = org.gcube.application.geoportal.client.utils.Serialization.read(asJSONString,
|
|
|
|
|
ItemField.class);
|
|
|
|
|
listItemFields.add(toItemFieldDV(itemField));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ConfigurationDV<List<ItemFieldDV>> dDV = new ConfigurationDV<List<ItemFieldDV>>(listItemFields);
|
|
|
|
|
dDV.setConfiguration(listItemFields);
|
|
|
|
|
dDV.setConfigurationType(geoportalConfigType); // -> GEOPORTAL_CONFIGURATION_TYPE.item_fields
|
|
|
|
|
hdDV.setConfiguration(dDV);
|
|
|
|
|
LOG.info("returning {}", hdDV);
|
|
|
|
|
return hdDV;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ConfigurationDV<List<GcubeProfileDV>> dDV = new ConfigurationDV<List<GcubeProfileDV>>(
|
|
|
|
|
listGcubeProfiles);
|
|
|
|
|
dDV.setConfiguration(listGcubeProfiles);
|
|
|
|
|
dDV.setConfigurationType(geoportalConfigType); //-> GEOPORTAL_CONFIGURATION_TYPE.gcube_profiles
|
|
|
|
|
hdDV.setConfiguration(dDV);
|
|
|
|
|
LOG.info("returning {}", hdDV);
|
|
|
|
|
return hdDV;
|
|
|
|
|
}
|
|
|
|
|
case item_fields: {
|
|
|
|
|
case actions_definition: {
|
|
|
|
|
|
|
|
|
|
List<ItemFieldDV> listItemFields = new ArrayList<ItemFieldDV>(jsonConfigurations.size());
|
|
|
|
|
List<ActionDefinitionDV> listActionsDef = new ArrayList<ActionDefinitionDV>(jsonConfigurations.size());
|
|
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
for (String asJSONString : jsonConfigurations) {
|
|
|
|
|
LOG.debug(++i + ") the itemField is: " + asJSONString);
|
|
|
|
|
ItemField profile = org.gcube.application.geoportal.client.utils.Serialization.read(asJSONString,
|
|
|
|
|
ItemField.class);
|
|
|
|
|
listItemFields.add(toItemFieldDV(profile));
|
|
|
|
|
int i = 0;
|
|
|
|
|
for (String asJSONString : jsonConfigurations) {
|
|
|
|
|
LOG.debug(++i + ") the ActionDefinition is: " + asJSONString);
|
|
|
|
|
ActionDefinition actionDef = org.gcube.application.geoportal.client.utils.Serialization
|
|
|
|
|
.read(asJSONString, ActionDefinition.class);
|
|
|
|
|
listActionsDef.add(toActionDefinition(actionDef));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ConfigurationDV<List<ActionDefinitionDV>> dDV = new ConfigurationDV<List<ActionDefinitionDV>>(listActionsDef);
|
|
|
|
|
dDV.setConfiguration(listActionsDef);
|
|
|
|
|
dDV.setConfigurationType(geoportalConfigType); // -> GEOPORTAL_CONFIGURATION_TYPE.actions_definition
|
|
|
|
|
hdDV.setConfiguration(dDV);
|
|
|
|
|
LOG.info("returning {}", hdDV);
|
|
|
|
|
return hdDV;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ConfigurationDV<List<ItemFieldDV>> dDV = new ConfigurationDV<List<ItemFieldDV>>(listItemFields);
|
|
|
|
|
dDV.setConfiguration(listItemFields);
|
|
|
|
|
dDV.setConfigurationType(geoportalConfigType); //-> GEOPORTAL_CONFIGURATION_TYPE.item_fields
|
|
|
|
|
hdDV.setConfiguration(dDV);
|
|
|
|
|
LOG.info("returning {}", hdDV);
|
|
|
|
|
return hdDV;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
@ -372,6 +402,30 @@ public class ConvertToDataValueObjectModel {
|
|
|
|
|
return ifDV;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* To action definition.
|
|
|
|
|
*
|
|
|
|
|
* @param actionDefinition the action definition
|
|
|
|
|
* @return the action definition DV
|
|
|
|
|
*/
|
|
|
|
|
public static ActionDefinitionDV toActionDefinition(ActionDefinition actionDefinition) {
|
|
|
|
|
LOG.trace("toActionDefinition called");
|
|
|
|
|
|
|
|
|
|
if (actionDefinition == null) {
|
|
|
|
|
LOG.warn(ActionDefinition.class.getSimpleName() + " is null");
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ActionDefinitionDV actDef = new ActionDefinitionDV();
|
|
|
|
|
actDef.setId(actionDefinition.getId());
|
|
|
|
|
actDef.setCallSteps(actionDefinition.getCall_STEPS());
|
|
|
|
|
actDef.setDescription(actionDefinition.getDescription());
|
|
|
|
|
actDef.setDisplayOnPhase(actionDefinition.getDisplay_on_phase());
|
|
|
|
|
|
|
|
|
|
LOG.info("returning: " + actionDefinition);
|
|
|
|
|
return actDef;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* To file path DV.
|
|
|
|
|
*
|
|
|
|
@ -712,34 +766,86 @@ public class ConvertToDataValueObjectModel {
|
|
|
|
|
|
|
|
|
|
return documentDV;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static final DateTimeFormatter FULL_FORMATTER=DateTimeFormatter.ofPattern("uuuuMMdd_HH-mm-ss");
|
|
|
|
|
|
|
|
|
|
public static final DateTimeFormatter FULL_FORMATTER = DateTimeFormatter.ofPattern("uuuuMMdd_HH-mm-ss");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The Class MyLocalDateSerializer.
|
|
|
|
|
*
|
|
|
|
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
|
|
|
*
|
|
|
|
|
* Sep 9, 2022
|
|
|
|
|
*/
|
|
|
|
|
public static class MyLocalDateSerializer extends JsonSerializer<LocalDate> {
|
|
|
|
|
@Override
|
|
|
|
|
public void serialize(LocalDate value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
|
|
|
|
|
gen.writeString(value.format(FULL_FORMATTER));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class ParseDeserializer extends StdDeserializer<LocalDateTime> {
|
|
|
|
|
public ParseDeserializer() {
|
|
|
|
|
super(LocalDateTime.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
|
|
|
|
return LocalDateTime.parse(p.getValueAsString()); // or overloaded with an appropriate format
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Serialize.
|
|
|
|
|
*
|
|
|
|
|
* @param value the value
|
|
|
|
|
* @param gen the gen
|
|
|
|
|
* @param serializers the serializers
|
|
|
|
|
* @throws IOException Signals that an I/O exception has occurred.
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void serialize(LocalDate value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
|
|
|
|
|
gen.writeString(value.format(FULL_FORMATTER));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class MyLocalDateDeserializer extends JsonDeserializer<LocalDate> {
|
|
|
|
|
/**
|
|
|
|
|
* The Class ParseDeserializer.
|
|
|
|
|
*
|
|
|
|
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
|
|
|
*
|
|
|
|
|
* Sep 9, 2022
|
|
|
|
|
*/
|
|
|
|
|
public static class ParseDeserializer extends StdDeserializer<LocalDateTime> {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public LocalDate deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
|
|
|
|
return LocalDate.parse(p.getValueAsString(),FULL_FORMATTER);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Instantiates a new parses the deserializer.
|
|
|
|
|
*/
|
|
|
|
|
public ParseDeserializer() {
|
|
|
|
|
super(LocalDateTime.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Deserialize.
|
|
|
|
|
*
|
|
|
|
|
* @param p the p
|
|
|
|
|
* @param ctxt the ctxt
|
|
|
|
|
* @return the local date time
|
|
|
|
|
* @throws IOException Signals that an I/O exception has occurred.
|
|
|
|
|
* @throws JsonProcessingException the json processing exception
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt)
|
|
|
|
|
throws IOException, JsonProcessingException {
|
|
|
|
|
return LocalDateTime.parse(p.getValueAsString()); // or overloaded with an appropriate format
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The Class MyLocalDateDeserializer.
|
|
|
|
|
*
|
|
|
|
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
|
|
|
*
|
|
|
|
|
* Sep 9, 2022
|
|
|
|
|
*/
|
|
|
|
|
public static class MyLocalDateDeserializer extends JsonDeserializer<LocalDate> {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Deserialize.
|
|
|
|
|
*
|
|
|
|
|
* @param p the p
|
|
|
|
|
* @param ctxt the ctxt
|
|
|
|
|
* @return the local date
|
|
|
|
|
* @throws IOException Signals that an I/O exception has occurred.
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public LocalDate deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
|
|
|
|
return LocalDate.parse(p.getValueAsString(), FULL_FORMATTER);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Fill map.
|
|
|
|
@ -754,32 +860,33 @@ public class ConvertToDataValueObjectModel {
|
|
|
|
|
|
|
|
|
|
Object value = document.get(key);
|
|
|
|
|
String keyLower = key.toLowerCase();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
JavaTimeModule javaTimeModule = new JavaTimeModule();
|
|
|
|
|
javaTimeModule.addDeserializer(LocalDateTime.class, new ParseDeserializer());
|
|
|
|
|
// javaTimeModule.addSerializer(LocalDate.class, new MyLocalDateSerializer());
|
|
|
|
|
objectMapper.registerModule(javaTimeModule);
|
|
|
|
|
* ObjectMapper objectMapper = new ObjectMapper(); JavaTimeModule javaTimeModule
|
|
|
|
|
* = new JavaTimeModule(); javaTimeModule.addDeserializer(LocalDateTime.class,
|
|
|
|
|
* new ParseDeserializer()); // javaTimeModule.addSerializer(LocalDate.class,
|
|
|
|
|
* new MyLocalDateSerializer()); objectMapper.registerModule(javaTimeModule);
|
|
|
|
|
*
|
|
|
|
|
* objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
|
|
|
|
* objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS,
|
|
|
|
|
* false); objectMapper.configure(SerializationFeature.
|
|
|
|
|
* WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false);
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
|
|
|
|
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
|
|
|
|
|
objectMapper.configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false);
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//checking if the key is a Date
|
|
|
|
|
// checking if the key is a Date
|
|
|
|
|
for (String possibleDate : KEYSET_POSSIBLE_DATE) {
|
|
|
|
|
if (keyLower.contains(possibleDate)) {
|
|
|
|
|
try {
|
|
|
|
|
LOG.debug("value "+value+" is instance of: "+value.getClass());
|
|
|
|
|
LOG.debug("value " + value + " is instance of: " + value.getClass());
|
|
|
|
|
Document documentDate = new Document((Map) value);
|
|
|
|
|
String jsonValue = documentDate.toJson();
|
|
|
|
|
LOG.debug("jsonValue "+value);
|
|
|
|
|
|
|
|
|
|
//LocalDate asDate = objectMapper.readerFor(LocalDate.class).readValue(jsonValue);
|
|
|
|
|
|
|
|
|
|
LocalDateTime asDate = org.gcube.application.geoportal.client.utils.Serialization.read(jsonValue, LocalDateTime.class);
|
|
|
|
|
LOG.debug("jsonValue " + value);
|
|
|
|
|
|
|
|
|
|
// LocalDate asDate =
|
|
|
|
|
// objectMapper.readerFor(LocalDate.class).readValue(jsonValue);
|
|
|
|
|
|
|
|
|
|
LocalDateTime asDate = org.gcube.application.geoportal.client.utils.Serialization.read(jsonValue,
|
|
|
|
|
LocalDateTime.class);
|
|
|
|
|
LOG.info("Casted as date: " + asDate);
|
|
|
|
|
value = asDate;
|
|
|
|
|
break;
|
|
|
|
@ -788,19 +895,33 @@ public class ConvertToDataValueObjectModel {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
documentAsMap.put(key, value);
|
|
|
|
|
return documentAsMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class LocalDateDeserializer extends JsonDeserializer<LocalDate> {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public LocalDate deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
|
|
|
|
return LocalDate.parse(p.getValueAsString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* The Class LocalDateDeserializer.
|
|
|
|
|
*
|
|
|
|
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
|
|
|
*
|
|
|
|
|
* Sep 9, 2022
|
|
|
|
|
*/
|
|
|
|
|
public class LocalDateDeserializer extends JsonDeserializer<LocalDate> {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Deserialize.
|
|
|
|
|
*
|
|
|
|
|
* @param p the p
|
|
|
|
|
* @param ctxt the ctxt
|
|
|
|
|
* @return the local date
|
|
|
|
|
* @throws IOException Signals that an I/O exception has occurred.
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public LocalDate deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
|
|
|
|
|
return LocalDate.parse(p.getValueAsString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* To relationship DV.
|
|
|
|
@ -835,10 +956,10 @@ public class ConvertToDataValueObjectModel {
|
|
|
|
|
liDV.setPhase(li.getPhase());
|
|
|
|
|
liDV.setErrorMessages(li.getErrorMessages());
|
|
|
|
|
liDV.setLastInvokedStep(li.getLastInvokedStep());
|
|
|
|
|
|
|
|
|
|
if(li.getLastEvent()!=null)
|
|
|
|
|
|
|
|
|
|
if (li.getLastEvent() != null)
|
|
|
|
|
liDV.setLastEvent(li.getLastEvent().getEvent());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
liDV.setLastOperationStatus(toLifecycleInformationDVStatus(li.getLastOperationStatus()));
|
|
|
|
|
liDV.setWarningMessages(li.getWarningMessages());
|
|
|
|
|
liDV.setAsJSONString(toJSON(li));
|
|
|
|
|