summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-common/src
diff options
context:
space:
mode:
authorManoop Talasila <talasila@research.att.com>2019-05-02 12:29:41 +0000
committerGerrit Code Review <gerrit@onap.org>2019-05-02 12:29:41 +0000
commit3ae49aa2258be96fca2ff34e4dc87dd0e0bae161 (patch)
treef65bf5cf7f7ef66d8952a7f20fa0ba16f915d9cd /ecomp-portal-BE-common/src
parent64c7491aa9208ed3024b81ab78a73751c1cc859e (diff)
parent3b08ba8bbe81c5615c9be6090e3092598aa85f35 (diff)
Merge "Fix no name language option bug"
Diffstat (limited to 'ecomp-portal-BE-common/src')
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/LanguageServiceImpl.java38
1 files changed, 27 insertions, 11 deletions
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/LanguageServiceImpl.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/LanguageServiceImpl.java
index 13d7097b..1aa12b21 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/LanguageServiceImpl.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/service/LanguageServiceImpl.java
@@ -16,6 +16,9 @@
package org.onap.portalapp.portal.service;
import com.alibaba.fastjson.JSONObject;
+
+import antlr.StringUtils;
+
import org.onap.portalapp.portal.domain.EPUser;
import org.onap.portalapp.portal.domain.Language;
import org.onap.portalsdk.core.service.DataAccessService;
@@ -53,18 +56,31 @@ public class LanguageServiceImpl implements LanguageService {
public JSONObject getUserLanguage(String loginId) {
// get language_id from fn_user by loginId
JSONObject result = new com.alibaba.fastjson.JSONObject();
- HashMap params = new HashMap();
- params.put("login_id",loginId);
-
- EPUser user = (EPUser) dataAccessService.executeNamedQuery("getEPUserByLoginId",params,new HashMap()).get(0);
- int languageId = user.getLanguageId();
- HashMap<String,String> params1 = new HashMap();
- params1.put("language_id", String.valueOf(languageId));
- Language language = (Language) dataAccessService.executeNamedQuery("queryLanguageByLanguageId",params1,new HashMap());
- result.put("languageId",languageId);
- result.put("languageName",language.getLanguageName());
- result.put("languageAlias",language.getLanguageAlias());
+ HashMap getUserParams = new HashMap();
+ getUserParams.put("login_id", loginId);
+ List<EPUser> userList= null;
+
+ try {
+ userList = dataAccessService.executeNamedQuery("getEPUserByLoginId", getUserParams, new HashMap());
+ if (userList != null && userList.size() > 0) {
+ EPUser user = userList.get(0);
+ int languageId = user.getLanguageId();
+ result.put("languageId", languageId);
+
+ // get language name and alias from fn_language by languageId
+ HashMap<String,String> getLangParams = new HashMap();
+ getLangParams.put("language_id", String.valueOf(languageId));
+ List<Language> languageList = null;
+ languageList = dataAccessService.executeNamedQuery("queryLanguageByLanguageId", getLangParams, new HashMap());
+ if (languageList != null && languageList.size() > 0) {
+ result.put("languageName", languageList.get(0).getLanguageName());
+ result.put("languageAlias", languageList.get(0).getLanguageAlias());
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
return result;
}
}