airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject airavata git commit: add a check when removing module mappings
Date Thu, 16 Jul 2015 19:58:35 GMT
Repository: airavata
Updated Branches:
  refs/heads/airavata-0.15-release-branch fd4011108 -> 61c2049b5


add a check when removing module mappings


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/61c2049b
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/61c2049b
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/61c2049b

Branch: refs/heads/airavata-0.15-release-branch
Commit: 61c2049b5af1e164213f29c5b9c2ec58ab4c841e
Parents: fd40111
Author: Chathuri Wimalasena <chathuri@apache.org>
Authored: Thu Jul 16 15:58:30 2015 -0400
Committer: Chathuri Wimalasena <chathuri@apache.org>
Committed: Thu Jul 16 15:58:30 2015 -0400

----------------------------------------------------------------------
 .../resources/AppModuleMappingResource.java     | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/61c2049b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleMappingResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleMappingResource.java
b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleMappingResource.java
index 4e38872..baa2227 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleMappingResource.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AppModuleMappingResource.java
@@ -94,16 +94,20 @@ public class AppModuleMappingResource extends AbstractResource {
             em = AppCatalogJPAUtils.getEntityManager();
             em.getTransaction().begin();
             AppCatalogQueryGenerator generator= new AppCatalogQueryGenerator(APP_MODULE_MAPPING);
-            if (ids.get(AppModuleMappingConstants.INTERFACE_ID) != null) {
-                generator.setParameter(AppModuleMappingConstants.INTERFACE_ID, ids.get(AppModuleMappingConstants.INTERFACE_ID));
+            String interfaceId = ids.get(AppModuleMappingConstants.INTERFACE_ID);
+            if (interfaceId != null) {
+                generator.setParameter(AppModuleMappingConstants.INTERFACE_ID, interfaceId);
             }
-            if (ids.get(AppModuleMappingConstants.MODULE_ID) != null){
-                generator.setParameter(AppModuleMappingConstants.MODULE_ID, ids.get(AppModuleMappingConstants.MODULE_ID));
+            String moduleId = ids.get(AppModuleMappingConstants.MODULE_ID);
+            if (moduleId != null){
+                generator.setParameter(AppModuleMappingConstants.MODULE_ID, moduleId);
+            }
+            if ((moduleId != null && !moduleId.equals("")) || (interfaceId != null
&& !interfaceId.equals(""))){
+                Query q = generator.deleteQuery(em);
+                q.executeUpdate();
+                em.getTransaction().commit();
+                em.close();
             }
-            Query q = generator.deleteQuery(em);
-            q.executeUpdate();
-            em.getTransaction().commit();
-            em.close();
         } catch (ApplicationSettingsException e) {
             logger.error(e.getMessage(), e);
             throw new AppCatalogException(e);


Mime
View raw message