#23927 Integrated with Relationship definition in UCD
This commit is contained in:
parent
c5fecafe64
commit
27b90a6640
|
@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
- [#23835] Integrated with WORKFLOW_ACTION_LIST_GUI configuration
|
- [#23835] Integrated with WORKFLOW_ACTION_LIST_GUI configuration
|
||||||
- [#23909] Declared lombok required for JDK_11
|
- [#23909] Declared lombok required for JDK_11
|
||||||
- [#23913] Integrated with GUI presentation configurations read from IS
|
- [#23913] Integrated with GUI presentation configurations read from IS
|
||||||
|
- [#23927] Integrated with Relationship definition in UCD
|
||||||
|
|
||||||
## [v1.4.0] - 2022-06-08
|
## [v1.4.0] - 2022-06-08
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.gcube.application.geoportal.common.model.document.identification.Iden
|
||||||
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
|
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
|
||||||
import org.gcube.application.geoportal.common.model.document.relationships.Relationship;
|
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.HandlerDeclaration;
|
||||||
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.RelationshipDefinition;
|
||||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||||
import org.gcube.application.geoportalcommon.geoportal.GeoportalConfigUtil;
|
import org.gcube.application.geoportalcommon.geoportal.GeoportalConfigUtil;
|
||||||
import org.gcube.application.geoportalcommon.geoportal.config.ActionDefinition;
|
import org.gcube.application.geoportalcommon.geoportal.config.ActionDefinition;
|
||||||
|
@ -48,6 +49,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.project.Relationsh
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_CONFIGURATION_TYPE;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_CONFIGURATION_TYPE;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -727,12 +729,12 @@ public class ConvertToDataValueObjectModel {
|
||||||
String time = instantString.trim();
|
String time = instantString.trim();
|
||||||
DateTimeFormatter formatter = null;
|
DateTimeFormatter formatter = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if(time.contains("T")) {
|
if (time.contains("T")) {
|
||||||
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT + " " + TIME_FORMAT);
|
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT + " " + TIME_FORMAT);
|
||||||
LocalDateTime instant = LocalDateTime.parse(time);
|
LocalDateTime instant = LocalDateTime.parse(time);
|
||||||
return formatter.format(instant);
|
return formatter.format(instant);
|
||||||
}else {
|
} else {
|
||||||
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT);
|
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT);
|
||||||
LocalDate instant = LocalDate.parse(time, formatter);
|
LocalDate instant = LocalDate.parse(time, formatter);
|
||||||
return formatter.format(instant);
|
return formatter.format(instant);
|
||||||
|
@ -912,7 +914,7 @@ public class ConvertToDataValueObjectModel {
|
||||||
|
|
||||||
Object value = document.get(key);
|
Object value = document.get(key);
|
||||||
String keyLower = key.toLowerCase();
|
String keyLower = key.toLowerCase();
|
||||||
|
|
||||||
// String listAsStringValue = null;
|
// String listAsStringValue = null;
|
||||||
// if(value instanceof LinkedHashMap) {
|
// if(value instanceof LinkedHashMap) {
|
||||||
// LinkedHashMap<String, Object> toListView = (LinkedHashMap<String, Object>) value;
|
// LinkedHashMap<String, Object> toListView = (LinkedHashMap<String, Object>) value;
|
||||||
|
@ -1116,4 +1118,15 @@ public class ConvertToDataValueObjectModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static RelationshipDefinitionDV toRelationshipDefinition(RelationshipDefinition relationshipDefinition) {
|
||||||
|
|
||||||
|
RelationshipDefinitionDV rdv = new RelationshipDefinitionDV();
|
||||||
|
rdv.setId(relationshipDefinition.getId());
|
||||||
|
rdv.setLabel(relationshipDefinition.getLabel());
|
||||||
|
rdv.setReverseRelationId(relationshipDefinition.getReverseRelationId());
|
||||||
|
|
||||||
|
return rdv;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.gcube.application.geoportal.common.faults.InvalidRequestException;
|
||||||
import org.gcube.application.geoportal.common.model.configuration.Archive;
|
import org.gcube.application.geoportal.common.model.configuration.Archive;
|
||||||
import org.gcube.application.geoportal.common.model.configuration.Configuration;
|
import org.gcube.application.geoportal.common.model.configuration.Configuration;
|
||||||
import org.gcube.application.geoportal.common.model.document.Project;
|
import org.gcube.application.geoportal.common.model.document.Project;
|
||||||
import org.gcube.application.geoportal.common.model.document.relationships.Relationship;
|
import org.gcube.application.geoportal.common.model.rest.CreateRelationshipRequest;
|
||||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest;
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest;
|
||||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest.Direction;
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest.Direction;
|
||||||
|
@ -324,30 +324,28 @@ public class ProjectsCaller {
|
||||||
return client.updateDocument(projectID, updatedDocument);
|
return client.updateDocument(projectID, updatedDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the relationship.
|
* Creates the relationship.
|
||||||
*
|
*
|
||||||
* @param fromProfileID the from profile ID
|
* @param fromProfileID the from profile ID
|
||||||
* @param fromProjectID the from project ID
|
* @param fromProjectID the from project ID
|
||||||
* @param relationshipName the relationship name
|
* @param relationshipName the relationship name
|
||||||
* @param toProfileID the to profile ID
|
* @param toProfileID the to profile ID
|
||||||
* @param toProjectID the to project ID
|
* @param toProjectID the to project ID
|
||||||
* @return the project
|
|
||||||
* @throws RemoteException the remote exception
|
* @throws RemoteException the remote exception
|
||||||
*/
|
*/
|
||||||
public Relationship createRelationship(String fromProfileID, String fromProjectID, String relationshipName,
|
public void createRelationship(String fromProfileID, String fromProjectID, String relationshipName,
|
||||||
String toProfileID, String toProjectID) throws RemoteException {
|
String toProfileID, String toProjectID) throws RemoteException {
|
||||||
LOG.info("createRelationship called for fromProfileID {} and fromProjectID {}", fromProfileID, fromProjectID);
|
LOG.info("createRelationship called for fromProfileID {} and fromProjectID {}", fromProfileID, fromProjectID);
|
||||||
LOG.info("create relationshipName {}", relationshipName);
|
LOG.info("create relationshipName {}", relationshipName);
|
||||||
LOG.info("to toProfileID {} and toProjectID {}", toProfileID, toProjectID);
|
LOG.info("to toProfileID {} and toProjectID {}", toProfileID, toProjectID);
|
||||||
Projects<Project> client = (Projects<Project>) getClient(fromProfileID);
|
Projects<Project> client = (Projects<Project>) getClient(fromProfileID);
|
||||||
|
|
||||||
//TODO MISSING CREATE RELATIONSHIP
|
|
||||||
|
|
||||||
LOG.warn("\n\n\n\n CREATE Relationship MUST BE CALLED ON THE SERVICE \n\n\n");
|
CreateRelationshipRequest request = new CreateRelationshipRequest(fromProjectID, relationshipName, toProjectID, toProfileID);
|
||||||
|
client.setRelation(request);
|
||||||
|
|
||||||
return new Relationship(relationshipName, toProjectID, toProfileID);
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.util.List;
|
||||||
import org.bson.Document;
|
import org.bson.Document;
|
||||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration;
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration;
|
||||||
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.RelationshipDefinition;
|
||||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||||
import org.gcube.application.geoportal.common.rest.UseCaseDescriptorsI;
|
import org.gcube.application.geoportal.common.rest.UseCaseDescriptorsI;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -174,22 +175,18 @@ public class UseCaseDescriptorCaller {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the relationship names.
|
* Gets the relationship definitions.
|
||||||
*
|
*
|
||||||
* @param profileID the profile ID
|
* @param profileID the profile ID
|
||||||
* @return the relationship names
|
* @return the relationship definitions
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
//TODO MUST BE CALLED THE SERVICE
|
public List<RelationshipDefinition> getRelationshipDefinitions(String profileID) throws Exception {
|
||||||
public List<String> getRelationshipNames(String profileID) throws Exception {
|
|
||||||
LOG.info("getRelationshipNames called for profileID: {}", profileID);
|
LOG.info("getRelationshipNames called for profileID: {}", profileID);
|
||||||
UseCaseDescriptorsI client = useCaseDescriptorsClient();
|
UseCaseDescriptorsI client = useCaseDescriptorsClient();
|
||||||
LOG.warn("########### USING MOCK #############");
|
UseCaseDescriptor ucd = client.getById(profileID);
|
||||||
List<String> relationshipNames = new ArrayList<String>();
|
|
||||||
relationshipNames.add("Follows");
|
|
||||||
relationshipNames.add("Procedes");
|
|
||||||
return relationshipNames;
|
|
||||||
|
|
||||||
|
return ucd.getRelationshipDefinitions();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package org.gcube.application.geoportalcommon.shared.geoportal.ucd;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class RelationshipDefinitionDV implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -8542669180440066726L;
|
||||||
|
private String id;
|
||||||
|
private String label;
|
||||||
|
private String reverseRelationId;
|
||||||
|
|
||||||
|
public RelationshipDefinitionDV() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public RelationshipDefinitionDV(String id, String label, String reverseRelationId) {
|
||||||
|
super();
|
||||||
|
this.id = id;
|
||||||
|
this.label = label;
|
||||||
|
this.reverseRelationId = reverseRelationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReverseRelationId() {
|
||||||
|
return reverseRelationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReverseRelationId(String reverseRelationId) {
|
||||||
|
this.reverseRelationId = reverseRelationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("RelationshipDefinitionDV [id=");
|
||||||
|
builder.append(id);
|
||||||
|
builder.append(", label=");
|
||||||
|
builder.append(label);
|
||||||
|
builder.append(", reverseRelationId=");
|
||||||
|
builder.append(reverseRelationId);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue