You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by is...@apache.org on 2020/03/18 13:35:26 UTC

[airavata-custos] branch develop updated: Fix user profile creation

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

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


The following commit(s) were added to refs/heads/develop by this push:
     new d77ce73  Fix user profile creation
     new e6745d5  Merge pull request #27 from isururanawaka/microservices_based_impl
d77ce73 is described below

commit d77ce73e8b87171e5979afa579f879b3824c3548
Author: Isuru Ranawaka <ir...@gmail.com>
AuthorDate: Wed Mar 18 09:31:33 2020 -0400

    Fix user profile creation
---
 .../user/management/service/UserManagementService.java   | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/custos-integration-services/user-management-service-parent/user-management-service/src/main/java/org/apache/custos/user/management/service/UserManagementService.java b/custos-integration-services/user-management-service-parent/user-management-service/src/main/java/org/apache/custos/user/management/service/UserManagementService.java
index bc97821..af483b9 100644
--- a/custos-integration-services/user-management-service-parent/user-management-service/src/main/java/org/apache/custos/user/management/service/UserManagementService.java
+++ b/custos-integration-services/user-management-service-parent/user-management-service/src/main/java/org/apache/custos/user/management/service/UserManagementService.java
@@ -226,7 +226,14 @@ public class UserManagementService extends UserManagementServiceGrpc.UserManagem
                                     .build();
 
 
-                    userProfileClient.updateUserProfile(req);
+                    UserProfile existingProfile = userProfileClient.getUser(req);
+
+                    if (existingProfile == null || existingProfile.getUsername().trim().equals("")) {
+                        userProfileClient.createUserProfile(req);
+                    } else {
+
+                        userProfileClient.updateUserProfile(req);
+                    }
 
 
                 }
@@ -550,9 +557,14 @@ public class UserManagementService extends UserManagementServiceGrpc.UserManagem
                                     .build();
 
 
-                    userProfileClient.updateUserProfile(req);
+                    UserProfile exsistingProfile = userProfileClient.getUser(req);
 
+                    if (exsistingProfile == null || exsistingProfile.getUsername().trim().equals("")) {
+                        userProfileClient.createUserProfile(req);
+                    } else {
 
+                        userProfileClient.updateUserProfile(req);
+                    }
                 }
 
             }