Fixing relationships

This commit is contained in:
Francesco Mangiacrapa 2022-10-03 17:51:29 +02:00
parent 27b90a6640
commit fa2e46af79
4 changed files with 38 additions and 4 deletions

View File

@ -989,7 +989,10 @@ public class ConvertToDataValueObjectModel {
if (relationship == null) if (relationship == null)
return null; return null;
RelationshipDV rDV = new RelationshipDV(relationship.getRelationshipName(), relationship.getTargetID()); RelationshipDV rDV = new RelationshipDV();
rDV.setRelationshipName(relationship.getRelationshipName());
rDV.setTargetID(relationship.getTargetID());
rDV.setTargetUCD(relationship.getTargetUCD());
String jsonDocument = null; String jsonDocument = null;
try { try {

View File

@ -105,6 +105,7 @@ public class SearchingFilter implements Serializable {
projection.put("_version", 1); projection.put("_version", 1);
projection.put("_lifecycleInformation", 1); projection.put("_lifecycleInformation", 1);
projection.put("_info", 1); projection.put("_info", 1);
projection.put("_relationships", 1);
} }
} }

View File

@ -11,14 +11,26 @@ public class RelationshipDV implements Serializable {
private String relationshipName; private String relationshipName;
private String targetID; private String targetID;
private String asJSON; private String asJSON;
private String targetUCD;
public RelationshipDV() { public RelationshipDV() {
} }
public RelationshipDV(String relationshipName, String targetID) { public RelationshipDV(String relationshipName, String targetID, String targetUCD, String asJSON) {
super();
this.relationshipName = relationshipName; this.relationshipName = relationshipName;
this.targetID = targetID; this.targetID = targetID;
this.targetUCD = targetUCD;
this.asJSON = asJSON;
}
public String getTargetUCD() {
return targetUCD;
}
public void setTargetUCD(String targetUCD) {
this.targetUCD = targetUCD;
} }
public String getTargetID() { public String getTargetID() {
@ -52,6 +64,10 @@ public class RelationshipDV implements Serializable {
builder.append(relationshipName); builder.append(relationshipName);
builder.append(", targetID="); builder.append(", targetID=");
builder.append(targetID); builder.append(targetID);
builder.append(", asJSON=");
builder.append(asJSON);
builder.append(", targetUCD=");
builder.append(targetUCD);
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }

View File

@ -27,6 +27,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.api.ScopeProvider;
import org.junit.Before; import org.junit.Before;
import org.junit.Test;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonParser;
@ -42,9 +43,9 @@ 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 = "630f905855e2947b0278c1a8"; private static String PROJECT_ID = "632c633155e2947b0278c999";
@Before @Before
public void getClient() { public void getClient() {
@ -90,6 +91,19 @@ public class Project_Tests {
} }
@Test
public void getResultDocumentForID() {
try {
ProjectsCaller projects = GeoportalClientCaller.projects();
Project project = projects.getProjectByID(PROFILE_ID, PROJECT_ID);
ResultDocumentDV documentDV = ConvertToDataValueObjectModel.toResultDocumentDV(project);
System.out.println("returning: " + documentDV);
} catch (Exception e) {
e.printStackTrace();
}
}
// @Test // @Test
public void getListProjectsDVFiltered() throws Exception { public void getListProjectsDVFiltered() throws Exception {
// List<Project> listOfProjects = client.getListForProfileID(PROFILE_ID); // List<Project> listOfProjects = client.getListForProfileID(PROFILE_ID);