Relationship testing

This commit is contained in:
Fabio Sinibaldi 2022-09-29 16:07:55 +02:00
parent 702f32dfa1
commit 80459d5546
6 changed files with 45 additions and 2 deletions

View File

@ -63,6 +63,7 @@
<dependency> <dependency>
<groupId>org.gcube.application.cms</groupId> <groupId>org.gcube.application.cms</groupId>
<artifactId>cms-plugin-framework</artifactId> <artifactId>cms-plugin-framework</artifactId>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -311,7 +311,7 @@ public class DefaultDocumentsClient<T extends Project> implements Projects<T> {
queryParam(InterfaceConstants.Parameters.TARGET_ID,request.getTargetId()). queryParam(InterfaceConstants.Parameters.TARGET_ID,request.getTargetId()).
queryParam(InterfaceConstants.Parameters.TARGET_UCD,request.getTargetUCD()). queryParam(InterfaceConstants.Parameters.TARGET_UCD,request.getTargetUCD()).
request(MediaType.APPLICATION_JSON). request(MediaType.APPLICATION_JSON).
put(Entity.entity(null, MediaType.APPLICATION_JSON)),getManagedClass()); put(Entity.json("")),getManagedClass());
}; };
T toReturn=delegate.make(call); T toReturn=delegate.make(call);
log.info("Set relationship {}:{} --{}--> {}:{}", log.info("Set relationship {}:{} --{}--> {}:{}",

View File

@ -48,6 +48,11 @@ public class UseCaseDescriptors {
System.out.println(h); System.out.println(h);
validate(h); validate(h);
}); });
if(useCaseDescriptor.getRelationshipDefinitions()!=null)
useCaseDescriptor.getRelationshipDefinitions().forEach(relationshipDefinition -> {
System.out.println(relationshipDefinition);});
} }
} }

View File

@ -0,0 +1,25 @@
package org.gcube.application.geoportal.common.model.useCaseDescriptor;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import javax.xml.bind.annotation.XmlRootElement;
@Data
@NoArgsConstructor
public class RelationshipDefinition {
public static final String ID="_id";
public static final String LABEL="_label";
public static final String REVERSE_RELATION_ID="_reverseRelationId";
@JsonProperty(ID)
private String id;
@JsonProperty(LABEL)
private String label;
@JsonProperty(REVERSE_RELATION_ID)
private String reverseRelationId;
}

View File

@ -34,6 +34,7 @@ public class UseCaseDescriptor implements Serializable {
public static final String HANDLERS="_handlers"; public static final String HANDLERS="_handlers";
public static final String DATA_ACCESS_POLICIES="_dataAccessPolicies"; public static final String DATA_ACCESS_POLICIES="_dataAccessPolicies";
public static final String RELATIONSHIP_DEFINITIONS="_relationshipDefinitions";
@JsonProperty(MONGO_ID) @JsonProperty(MONGO_ID)
private ObjectId mongoId; private ObjectId mongoId;
@ -56,10 +57,14 @@ public class UseCaseDescriptor implements Serializable {
@JsonProperty(HANDLERS) @JsonProperty(HANDLERS)
private List<HandlerDeclaration> handlers; private List<HandlerDeclaration> handlers;
@JsonProperty(DATA_ACCESS_POLICIES) @JsonProperty(DATA_ACCESS_POLICIES)
private List<DataAccessPolicy> dataAccessPolicies; private List<DataAccessPolicy> dataAccessPolicies;
@JsonProperty(RELATIONSHIP_DEFINITIONS)
private List<RelationshipDefinition> relationshipDefinitions;
/** /**
* Returns map Type -> Handler Declaration * Returns map Type -> Handler Declaration
* @return * @return

View File

@ -26,6 +26,13 @@
{"_policy" : {"_read" : "any", "_write" : "any"}, "_roles":["Admin"]} {"_policy" : {"_read" : "any", "_write" : "any"}, "_roles":["Admin"]}
], ],
"_relationshipDefinitions" : [
{"_id": "precedes", "_label" : "Precedes",
"_reverseRelationId" : "follows"},
{"_id": "follows", "_label" : "Follows",
"_reverseRelationId" : "precedes"}
],
"_handlers" : [ "_handlers" : [
{ {