#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
|
||||
- [#23909] Declared lombok required for JDK_11
|
||||
- [#23913] Integrated with GUI presentation configurations read from IS
|
||||
- [#23927] Integrated with Relationship definition in UCD
|
||||
|
||||
## [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.relationships.Relationship;
|
||||
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.geoportalcommon.geoportal.GeoportalConfigUtil;
|
||||
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_DATA_HANDLER;
|
||||
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.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -728,11 +730,11 @@ public class ConvertToDataValueObjectModel {
|
|||
DateTimeFormatter formatter = null;
|
||||
try {
|
||||
|
||||
if(time.contains("T")) {
|
||||
if (time.contains("T")) {
|
||||
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT + " " + TIME_FORMAT);
|
||||
LocalDateTime instant = LocalDateTime.parse(time);
|
||||
return formatter.format(instant);
|
||||
}else {
|
||||
} else {
|
||||
formatter = DateTimeFormatter.ofPattern(DATE_FORMAT);
|
||||
LocalDate instant = LocalDate.parse(time, formatter);
|
||||
return formatter.format(instant);
|
||||
|
@ -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.Configuration;
|
||||
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.OrderedRequest;
|
||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest.OrderedRequest.Direction;
|
||||
|
@ -324,6 +324,7 @@ public class ProjectsCaller {
|
|||
return client.updateDocument(projectID, updatedDocument);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the relationship.
|
||||
*
|
||||
|
@ -332,22 +333,19 @@ public class ProjectsCaller {
|
|||
* @param relationshipName the relationship name
|
||||
* @param toProfileID the to profile ID
|
||||
* @param toProjectID the to project ID
|
||||
* @return the project
|
||||
* @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 {
|
||||
LOG.info("createRelationship called for fromProfileID {} and fromProjectID {}", fromProfileID, fromProjectID);
|
||||
LOG.info("create relationshipName {}", relationshipName);
|
||||
LOG.info("to toProfileID {} and toProjectID {}", toProfileID, toProjectID);
|
||||
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");
|
||||
|
||||
return new Relationship(relationshipName, toProjectID, toProfileID);
|
||||
CreateRelationshipRequest request = new CreateRelationshipRequest(fromProjectID, relationshipName, toProjectID, toProfileID);
|
||||
client.setRelation(request);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.List;
|
|||
import org.bson.Document;
|
||||
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.RelationshipDefinition;
|
||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||
import org.gcube.application.geoportal.common.rest.UseCaseDescriptorsI;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -174,22 +175,18 @@ public class UseCaseDescriptorCaller {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the relationship names.
|
||||
* Gets the relationship definitions.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @return the relationship names
|
||||
* @return the relationship definitions
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
//TODO MUST BE CALLED THE SERVICE
|
||||
public List<String> getRelationshipNames(String profileID) throws Exception {
|
||||
public List<RelationshipDefinition> getRelationshipDefinitions(String profileID) throws Exception {
|
||||
LOG.info("getRelationshipNames called for profileID: {}", profileID);
|
||||
UseCaseDescriptorsI client = useCaseDescriptorsClient();
|
||||
LOG.warn("########### USING MOCK #############");
|
||||
List<String> relationshipNames = new ArrayList<String>();
|
||||
relationshipNames.add("Follows");
|
||||
relationshipNames.add("Procedes");
|
||||
return relationshipNames;
|
||||
UseCaseDescriptor ucd = client.getById(profileID);
|
||||
|
||||
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