You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2018/11/02 15:52:26 UTC

[airavata] branch develop updated: AIRAVATA-2932 Fix saving data movement protocol

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/develop by this push:
     new 12fbb59  AIRAVATA-2932 Fix saving data movement protocol
12fbb59 is described below

commit 12fbb593ed85763b3aa8d05de75f4185a9f72d21
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Fri Nov 2 11:51:27 2018 -0400

    AIRAVATA-2932 Fix saving data movement protocol
---
 .../core/entities/appcatalog/DataMovementInterfaceEntity.java         | 4 ++--
 .../registry/core/repositories/appcatalog/DataMovementRepository.java | 3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/DataMovementInterfaceEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/DataMovementInterfaceEntity.java
index b8f0936..efae53f 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/DataMovementInterfaceEntity.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/DataMovementInterfaceEntity.java
@@ -56,8 +56,8 @@ public class DataMovementInterfaceEntity implements Serializable {
     @Column(name = "UPDATE_TIME")
     private Timestamp updateTime;
 
-    @ManyToOne(targetEntity = ComputeResourceEntity.class, cascade = CascadeType.MERGE)
-    @JoinColumn(name = "COMPUTE_RESOURCE_ID")
+    @ManyToOne(targetEntity = ComputeResourceEntity.class)
+    @JoinColumn(name = "COMPUTE_RESOURCE_ID", nullable = false, updatable = false)
     private ComputeResourceEntity computeResource;
 
     public DataMovementInterfaceEntity() {
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/DataMovementRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/DataMovementRepository.java
index ade815d..f6ec3d5 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/DataMovementRepository.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/DataMovementRepository.java
@@ -20,7 +20,6 @@
 package org.apache.airavata.registry.core.repositories.appcatalog;
 
 import org.apache.airavata.model.data.movement.DataMovementInterface;
-import org.apache.airavata.registry.core.entities.appcatalog.ComputeResourceEntity;
 import org.apache.airavata.registry.core.entities.appcatalog.DataMovementInterfaceEntity;
 import org.apache.airavata.registry.core.entities.appcatalog.DataMovementInterfacePK;
 import org.apache.airavata.registry.core.utils.ObjectMapperSingleton;
@@ -35,8 +34,6 @@ public class DataMovementRepository extends AppCatAbstractRepository<DataMovemen
     public String addDataMovementProtocol(String resourceId, DataMovementInterface dataMovementInterface) {
         Mapper mapper = ObjectMapperSingleton.getInstance();
         DataMovementInterfaceEntity dataMovementInterfaceEntity = mapper.map(dataMovementInterface, DataMovementInterfaceEntity.class);
-        ComputeResourceEntity computeResourceEntity = mapper.map(new ComputeResourceRepository().get(resourceId), ComputeResourceEntity.class);
-        dataMovementInterfaceEntity.setComputeResource(computeResourceEntity);
         dataMovementInterfaceEntity.setComputeResourceId(resourceId);
         execute(entityManager -> entityManager.merge(dataMovementInterfaceEntity));
         return dataMovementInterfaceEntity.getDataMovementInterfaceId();