#23834 Integrated with the create/view/delete Relationship facility

This commit is contained in:
Francesco Mangiacrapa 2022-10-05 14:43:16 +02:00
parent fa2e46af79
commit b49c1c1e21
2 changed files with 35 additions and 10 deletions

View File

@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- [#23909] Declared lombok required for JDK_11
- [#23913] Integrated with GUI presentation configurations read from IS
- [#23927] Integrated with Relationship definition in UCD
- [#23834] Integrated with the create/view/delete Relationship facility
## [v1.4.0] - 2022-06-08

View File

@ -19,6 +19,7 @@ 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.rest.CreateRelationshipRequest;
import org.gcube.application.geoportal.common.model.rest.DeleteRelationshipRequest;
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,30 +325,53 @@ public class ProjectsCaller {
return client.updateDocument(projectID, updatedDocument);
}
/**
* Creates the relationship.
*
* @param fromProfileID the from profile ID
* @param fromProjectID the from project ID
* @param fromProfileID the from profile ID
* @param fromProjectID the from project ID
* @param relationshipName the relationship name
* @param toProfileID the to profile ID
* @param toProjectID the to project ID
* @param toProfileID the to profile ID
* @param toProjectID the to project ID
* @throws RemoteException the remote exception
*/
public void createRelationship(String fromProfileID, String fromProjectID, String relationshipName,
public void createRelationship(String fromProfileID, String fromProjectID, String relationshipId,
String toProfileID, String toProjectID) throws RemoteException {
LOG.info("createRelationship called for fromProfileID {} and fromProjectID {}", fromProfileID, fromProjectID);
LOG.info("create relationshipName {}", relationshipName);
LOG.info("create relationshipName {}", relationshipId);
LOG.info("to toProfileID {} and toProjectID {}", toProfileID, toProjectID);
Projects<Project> client = (Projects<Project>) getClient(fromProfileID);
CreateRelationshipRequest request = new CreateRelationshipRequest(fromProjectID, relationshipName, toProjectID, toProfileID);
CreateRelationshipRequest request = new CreateRelationshipRequest(fromProjectID, relationshipId, toProjectID,
toProfileID);
client.setRelation(request);
return;
}
/**
* Delete relationship.
*
* @param fromProfileID the from profile ID
* @param fromProjectID the from project ID
* @param relationshipId the relationship id
* @param toProfileID the to profile ID
* @param toProjectID the to project ID
* @throws RemoteException the remote exception
*/
public void deleteRelationship(String fromProfileID, String fromProjectID, String relationshipId,
String toProfileID, String toProjectID) throws RemoteException {
LOG.info("deleteRelationship called for fromProfileID {} and fromProjectID {}", fromProfileID, fromProjectID);
LOG.info("deleteRelationship relationshipName {}", relationshipId);
LOG.info("to toProfileID {} and toProjectID {}", toProfileID, toProjectID);
Projects<Project> client = (Projects<Project>) getClient(fromProfileID);
DeleteRelationshipRequest request = new DeleteRelationshipRequest(fromProjectID, relationshipId, toProjectID,
toProfileID);
client.deleteRelation(request);
}
/**
* Query on mongo.
*