Add fname, lname, mname, prefix, suffix to userprofileentity
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/b1ed4caa Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/b1ed4caa Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/b1ed4caa Branch: refs/heads/registry-refactoring Commit: b1ed4caacbfe5b24fab48b778553e2e8fc5cd734 Parents: f5a4e9d Author: Gourav Shenoy <[email protected]> Authored: Tue May 9 12:26:30 2017 -0400 Committer: Gourav Shenoy <[email protected]> Committed: Tue May 9 12:26:30 2017 -0400 ---------------------------------------------------------------------- .../client/samples/UserProfileSample.java | 1 + .../user/entities/NSFDemographicsEntity.java | 1 - .../user/entities/UserProfileEntity.java | 58 +++++++++++++++++--- .../service/profile/commons/utils/JPAUtils.java | 4 +- .../repositories/UserProfileRepository.java | 2 - .../main/resources/airavata-server.properties | 4 +- 6 files changed, 57 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/b1ed4caa/airavata-services/profile-service/profile-service-client-sdks/java-client-samples/src/main/java/org/apache/airavata/service/profile/client/samples/UserProfileSample.java ---------------------------------------------------------------------- diff --git a/airavata-services/profile-service/profile-service-client-sdks/java-client-samples/src/main/java/org/apache/airavata/service/profile/client/samples/UserProfileSample.java b/airavata-services/profile-service/profile-service-client-sdks/java-client-samples/src/main/java/org/apache/airavata/service/profile/client/samples/UserProfileSample.java index 90ace42..d2660d0 100644 --- a/airavata-services/profile-service/profile-service-client-sdks/java-client-samples/src/main/java/org/apache/airavata/service/profile/client/samples/UserProfileSample.java +++ b/airavata-services/profile-service/profile-service-client-sdks/java-client-samples/src/main/java/org/apache/airavata/service/profile/client/samples/UserProfileSample.java @@ -81,6 +81,7 @@ public class UserProfileSample { System.out.println("User was deleted, hence does not exist!"); System.out.println("*** DONE ***"); } catch (Exception ex) { + ex.printStackTrace(); logger.error("UserProfile client-sample Exception: " + ex, ex); } } http://git-wip-us.apache.org/repos/asf/airavata/blob/b1ed4caa/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/user/entities/NSFDemographicsEntity.java ---------------------------------------------------------------------- diff --git a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/user/entities/NSFDemographicsEntity.java b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/user/entities/NSFDemographicsEntity.java index 1651cbd..80d0656 100644 --- a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/user/entities/NSFDemographicsEntity.java +++ b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/user/entities/NSFDemographicsEntity.java @@ -103,7 +103,6 @@ public class NSFDemographicsEntity { ", ethnicities=" + ethnicities + ", races=" + races + ", disabilities=" + disabilities + - ", userProfile=" + userProfile + '}'; } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/b1ed4caa/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/user/entities/UserProfileEntity.java ---------------------------------------------------------------------- diff --git a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/user/entities/UserProfileEntity.java b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/user/entities/UserProfileEntity.java index 102e12e..e1e3e9e 100644 --- a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/user/entities/UserProfileEntity.java +++ b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/user/entities/UserProfileEntity.java @@ -31,7 +31,11 @@ public class UserProfileEntity { private String userId; private String gatewayId; private String userModelVersion; - private String userName; + private String firstName; + private String lastName; + private String middleName; + private String namePrefix; + private String nameSuffix; private String orcidId; private String country; private String homeOrganization; @@ -98,13 +102,49 @@ public class UserProfileEntity { this.emails = emails; } - @Column(name = "USER_NAME") - public String getUserName() { - return userName; + @Column(name = "FIRST_NAME") + public String getFirstName() { + return firstName; } - public void setUserName(String userName) { - this.userName = userName; + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + @Column(name = "LAST_NAME") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + @Column(name = "MIDDLE_NAME") + public String getMiddleName() { + return middleName; + } + + public void setMiddleName(String middleName) { + this.middleName = middleName; + } + + @Column(name = "NAME_PREFIX") + public String getNamePrefix() { + return namePrefix; + } + + public void setNamePrefix(String namePrefix) { + this.namePrefix = namePrefix; + } + + @Column(name = "NAME_SUFFIX") + public String getNameSuffix() { + return nameSuffix; + } + + public void setNameSuffix(String nameSuffix) { + this.nameSuffix = nameSuffix; } @Column(name = "ORCID_ID") @@ -268,7 +308,11 @@ public class UserProfileEntity { ", userId='" + userId + '\'' + ", gatewayId='" + gatewayId + '\'' + ", userModelVersion='" + userModelVersion + '\'' + - ", userName='" + userName + '\'' + + ", firstName='" + firstName + '\'' + + ", lastName='" + lastName + '\'' + + ", middleName='" + middleName + '\'' + + ", namePrefix='" + namePrefix + '\'' + + ", nameSuffix='" + nameSuffix + '\'' + ", orcidId='" + orcidId + '\'' + ", country='" + country + '\'' + ", homeOrganization='" + homeOrganization + '\'' + http://git-wip-us.apache.org/repos/asf/airavata/blob/b1ed4caa/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/JPAUtils.java ---------------------------------------------------------------------- diff --git a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/JPAUtils.java b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/JPAUtils.java index 9a30370..e3a963d 100644 --- a/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/JPAUtils.java +++ b/airavata-services/profile-service/profile-service-commons/src/main/java/org/apache/airavata/service/profile/commons/utils/JPAUtils.java @@ -38,10 +38,10 @@ public class JPAUtils { EntityManager entityManager; if (factory == null) { + //FIXME: add validation query in connectionProperties after db is initialized during server startup String connectionProperties = "DriverClassName=" + Utils.getJDBCDriver() + "," + "Url=" + Utils.getJDBCURL() + "?autoReconnect=true," + - "Username=" + Utils.getJDBCUser() + "," + "Password=" + Utils.getJDBCPassword() + - ",validationQuery=" + Utils.getValidationQuery(); + "Username=" + Utils.getJDBCUser() + "," + "Password=" + Utils.getJDBCPassword(); logger.info(connectionProperties); Map<String, String> properties = new HashMap<String, String>(); properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource"); http://git-wip-us.apache.org/repos/asf/airavata/blob/b1ed4caa/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/repositories/UserProfileRepository.java ---------------------------------------------------------------------- diff --git a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/repositories/UserProfileRepository.java b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/repositories/UserProfileRepository.java index 5398e27..41823c9 100644 --- a/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/repositories/UserProfileRepository.java +++ b/airavata-services/profile-service/profile-user-core/src/main/java/org/apache/airavata/service/profile/user/core/repositories/UserProfileRepository.java @@ -47,7 +47,6 @@ public class UserProfileRepository extends AbstractRepository<UserProfile, UserP } public UserProfile getUserProfileByIdAndGateWay(String userId, String gatewayId) { - UserProfile userProfile = null; Map<String, Object> queryParam = new HashMap<String, Object>(); @@ -58,7 +57,6 @@ public class UserProfileRepository extends AbstractRepository<UserProfile, UserP if (resultList != null && resultList.size() > 0) userProfile = resultList.get(0); - return userProfile; } http://git-wip-us.apache.org/repos/asf/airavata/blob/b1ed4caa/modules/configuration/server/src/main/resources/airavata-server.properties ---------------------------------------------------------------------- diff --git a/modules/configuration/server/src/main/resources/airavata-server.properties b/modules/configuration/server/src/main/resources/airavata-server.properties index 719eab5..4aeb06c 100644 --- a/modules/configuration/server/src/main/resources/airavata-server.properties +++ b/modules/configuration/server/src/main/resources/airavata-server.properties @@ -341,7 +341,9 @@ profile.service.jdbc.driver=org.apache.derby.jdbc.ClientDriver #profile.service.jdbc.driver=com.mysql.jdbc.Driver profile.service.jdbc.user=airavata profile.service.jdbc.password=airavata -profile.service.validationQuery=SELECT 1 +# add validationquery only if db has been initialized during server startup, +# and tables have been created. for now commenting out. +#profile.service.validationQuery=SELECT 1 ########################################################################### # Iam Admin services Configuration
