List of usage examples for com.liferay.portal.kernel.language LanguageUtil getAvailableLocales
public static Set<Locale> getAvailableLocales()
From source file:org.kisti.edison.multiboard.service.impl.BoardLocalServiceImpl.java
License:Open Source License
@Transactional public Board addBoard(Map<String, Object> params) throws SystemException, ParseException, NoSuchModelException { User user = userPersistence.findByPrimaryKey((Long) params.get("userId")); long boardSeq = counterLocalService.increment(Board.class.getName()); Locale locale = (Locale) params.get("locale"); Date now = new Date(); Board board = boardPersistence.create(boardSeq); board.setGroupId((Long) params.get("groupId")); board.setCustomId(CustomUtil.strNull(params.get("customId"))); Locale[] availLocal = LanguageUtil.getAvailableLocales(); for (int i = 0; i < availLocal.length; i++) { board.setTitle(CustomUtil.strNull(params.get("title")), availLocal[i], Locale.US); board.setContent(CustomUtil.strNull(params.get("content")), availLocal[i], Locale.US); }// w w w. j a v a 2 s. c om board.setWriterId(user.getUserId()); board.setWriterDate( CustomUtil.StringToDateFormat(CustomUtil.strNull(params.get("writerDate")), "yyyy-MM-dd")); board.setGroupBoardSeq( Integer.parseInt(CustomUtil.strNull(params.get("groupBoardSeq"), String.valueOf(boardSeq)))); board.setGroupBoardTurn( Integer.parseInt(CustomUtil.strNull(params.get("groupBoardTurn"), String.valueOf(boardSeq)))); board.setReplyDepth(Integer.parseInt(CustomUtil.strNull(params.get("replyDepth"), String.valueOf(0)))); board.setPopupYn((Boolean) params.get("popupYn")); board.setSiteGroup(CustomUtil.strNull(params.get("siteGroup"))); board.setPopupStartDt( CustomUtil.StringToDateFormat(CustomUtil.strNull(params.get("popupStartDt")), "yyyy-MM-dd")); board.setPopupEndDt( CustomUtil.StringToDateFormat(CustomUtil.strNull(params.get("popupEndDt")), "yyyy-MM-dd")); board.setInsertId(user.getUserId()); board.setInsertDt(now); board.setSiteGroup(CustomUtil.strNull(params.get("siteGroup"))); super.addBoard(board); super.addBoardDivBoard((Long) params.get("divCd"), board); return board; }
From source file:org.kisti.edison.science.service.impl.ScienceAppLocalServiceImpl.java
License:Open Source License
/** * /*from w w w . java 2s. c o m*/ * @param appName * @param appVersion * @param userId * @param sc * @return * @throws ScienceAppException * @throws SystemException */ public ScienceApp createScienceApp(ServiceContext sc, Map params) throws SystemException { ScienceApp newApp = null; long newAppId = CounterLocalServiceUtil.increment(ScienceApp.class.getName()); newApp = super.scienceAppPersistence.create(newAppId); newApp.setGroupId(sc.getScopeGroupId()); newApp.setCompanyId(sc.getCompanyId()); newApp.setUserId(sc.getUserId()); newApp.setCreateDate(new Date()); newApp.setModifiedDate(new Date()); newApp.setName(CustomUtil.strNull(params.get("name"))); newApp.setVersion(CustomUtil.strNull(params.get("version"))); newApp.setTitleMap(CustomUtil.getLocalizationNotSetLocaleMap(params, "title")); // newApp.setPreviousVersionId(previousVersionId); newApp.setAuthorId(sc.getUserId()); newApp.setStage(ScienceAppConstants.EMPTY); newApp.setRecentModifierId(sc.getUserId()); newApp.setLicense(CustomUtil.strNull(params.get("license"))); if (CustomUtil.strNull(params.get("targetLanguage")).equals("")) { String localeStr = ""; for (Locale locale : LanguageUtil.getAvailableLocales()) { if (localeStr.equals("")) { localeStr = LocaleUtil.toLanguageId(locale); } else { localeStr += "," + LocaleUtil.toLanguageId(locale); } } newApp.setTargetLanguage(localeStr); } else { newApp.setTargetLanguage(CustomUtil.strNull(params.get("targetLanguage"))); } newApp.setStatus(1901001); //? newApp.setDevelopersMap(CustomUtil.getLocalizationNotSetLocaleMap(params, "developers")); newApp.setSwTest(GetterUtil.getBoolean(params.get("swTest"), false)); try { //Description ? long descriptionId = CounterLocalServiceUtil.increment(ScienceAppDescription.class.getName()); ScienceAppDescription scienceAppDescription = ScienceAppDescriptionLocalServiceUtil .createScienceAppDescription(descriptionId); Locale[] locales = LanguageUtil.getAvailableLocales(); for (Locale aLocale : locales) { String languageId = LocaleUtil.toLanguageId(aLocale); String description = CustomUtil.strNull(params.get("description_" + languageId)); if (!description.equals("")) { scienceAppDescription.setContent(description, aLocale); } } scienceAppDescription.setInsertDt(new Date()); scienceAppDescription.setInsertId(sc.getUserId()); ScienceAppDescriptionLocalServiceUtil.updateScienceAppDescription(scienceAppDescription); newApp.setDescriptionId(descriptionId); UploadPortletRequest upload = PortalUtil.getUploadPortletRequest(sc.getLiferayPortletRequest()); //icon ? String appIconStr = CustomUtil.strNull(upload.getFileName("app_icon"), ""); if (!appIconStr.equals("")) { //?? List<FileEntry> appIcons = EdisonFileUtil.insertEdisonFile(sc.getLiferayPortletRequest(), upload, sc.getUserId(), sc.getScopeGroupId(), "", String.valueOf(newAppId), "app_icon", EdisonFileConstants.SCIENCE_APPS); FileEntry appEntry = appIcons.get(0); newApp.setIconId(appEntry.getFileEntryId()); } //Manual ? for (Locale locale : locales) { String languageId = LocaleUtil.toLanguageId(locale); String fileParamsNm = "app_manual" + languageId; String manualStr = CustomUtil.strNull(upload.getFileName(fileParamsNm), ""); if (!manualStr.equals("")) { List<FileEntry> manuals = EdisonFileUtil.insertEdisonFile(sc.getLiferayPortletRequest(), upload, sc.getUserId(), sc.getScopeGroupId(), "", String.valueOf(newAppId), fileParamsNm, EdisonFileConstants.SCIENCE_APPS); FileEntry manualsEntry = manuals.get(0); newApp.setManualId(String.valueOf(manualsEntry.getFileEntryId()), locale); } else { newApp.setManualId("0", locale); } } newApp.setProjectCategoryId(0); // ? List<String[]> categoryList = new ArrayList<String[]>(); if (params.get("childrenCategoryCheckbox") instanceof String[]) { String[] childrenCategoryArray = (String[]) params.get("childrenCategoryCheckbox"); for (String childrenCategory : childrenCategoryArray) { String[] childrenCategoryValue = childrenCategory.split("_"); categoryList.add(childrenCategoryValue); } } else if (params.get("childrenCategoryCheckbox") instanceof String) { String[] childrenCategoryValue = CustomUtil.strNull(params.get("childrenCategoryCheckbox")) .split("_"); categoryList.add(childrenCategoryValue); } for (String[] categoryArray : categoryList) { long parentCategoryId = GetterUtil.getLong(categoryArray[0], 0l); long categoryId = GetterUtil.getLong(categoryArray[1], 0l); ScienceAppCategoryLink appCategory = ScienceAppCategoryLinkLocalServiceUtil .addScienceAppCategory(categoryId, newAppId); appCategory.setGroupId(sc.getScopeGroupId()); appCategory.setParentCategoryId(parentCategoryId); appCategory.setCompanyId(sc.getCompanyId()); appCategory.setUserId(sc.getUserId()); appCategory.setCreateDate(new Date()); ScienceAppCategoryLinkLocalServiceUtil.update(appCategory); } } catch (Exception e) { throw new SystemException(e); } scienceAppLocalService.updateScienceApp(newApp); return newApp; }
From source file:org.kisti.edison.science.service.impl.ScienceAppLocalServiceImpl.java
License:Open Source License
public void updateScienceApp(ServiceContext sc, Map params, long scienceAppId) throws NoSuchScienceAppException, SystemException { ScienceApp scienceApp = super.scienceAppPersistence.findByPrimaryKey(scienceAppId); scienceApp.setModifiedDate(new Date()); scienceApp.setVersion(CustomUtil.strNull(params.get("version"))); scienceApp.setTitleMap(CustomUtil.getLocalizationNotSetLocaleMap(params, "title")); String duplicationCheck = CustomUtil.strNull(params.get("duplicationCheck")); if (!duplicationCheck.equals("")) { scienceApp.setPreviousVersionId(GetterUtil.getLong(params.get("previousVersion"), 0)); }/*w ww.j av a 2s. c om*/ scienceApp.setRecentModifierId(sc.getUserId()); scienceApp.setLicense(CustomUtil.strNull(params.get("license"))); if (CustomUtil.strNull(params.get("targetLanguage")).equals("")) { String localeStr = ""; for (Locale locale : LanguageUtil.getAvailableLocales()) { if (localeStr.equals("")) { localeStr = LocaleUtil.toLanguageId(locale); } else { localeStr += "," + LocaleUtil.toLanguageId(locale); } } scienceApp.setTargetLanguage(localeStr); } else { scienceApp.setTargetLanguage(CustomUtil.strNull(params.get("targetLanguage"))); } scienceApp.setDevelopersMap(CustomUtil.getLocalizationNotSetLocaleMap(params, "developers")); try { //Description ScienceAppDescription scienceAppDescription = ScienceAppDescriptionLocalServiceUtil .getScienceAppDescription(scienceApp.getDescriptionId()); Locale[] locales = LanguageUtil.getAvailableLocales(); for (Locale aLocale : locales) { String languageId = LocaleUtil.toLanguageId(aLocale); String description = CustomUtil.strNull(params.get("description_" + languageId)); if (!description.equals("")) { scienceAppDescription.setContent(description, aLocale); } } scienceAppDescription.setUpdateDt(new Date()); scienceAppDescription.setUpdateId(sc.getUserId()); ScienceAppDescriptionLocalServiceUtil.updateScienceAppDescription(scienceAppDescription); UploadPortletRequest upload = PortalUtil.getUploadPortletRequest(sc.getLiferayPortletRequest()); //icon ? String appIconStr = CustomUtil.strNull(upload.getFileName("app_icon"), ""); if (!appIconStr.equals("")) { //?? long iconId = scienceApp.getIconId(); if (iconId != 0) { // ? DLFileEntryLocalServiceUtil.deleteDLFileEntry(iconId); } // APP ? ? ? ScienceApp ? ? ? GROUPID List<FileEntry> appIcons = EdisonFileUtil.insertEdisonFile(sc.getLiferayPortletRequest(), upload, sc.getUserId(), scienceApp.getGroupId(), "", String.valueOf(scienceAppId), "app_icon", EdisonFileConstants.SCIENCE_APPS); FileEntry appEntry = appIcons.get(0); scienceApp.setIconId(appEntry.getFileEntryId()); } //Manual ? for (Locale locale : locales) { String languageId = LocaleUtil.toLanguageId(locale); String fileParamsNm = "app_manual" + languageId; String manualStr = CustomUtil.strNull(upload.getFileName(fileParamsNm), ""); if (!manualStr.equals("")) { //Manual long manualId = GetterUtil.getLong(scienceApp.getManualId(locale), 0); if (manualId != 0) { // ? DLFileEntryLocalServiceUtil.deleteDLFileEntry(manualId); } List<FileEntry> manuals = EdisonFileUtil.insertEdisonFile(sc.getLiferayPortletRequest(), upload, sc.getUserId(), scienceApp.getGroupId(), "", String.valueOf(scienceAppId), fileParamsNm, EdisonFileConstants.SCIENCE_APPS); FileEntry manualsEntry = manuals.get(0); scienceApp.setManualId(String.valueOf(manualsEntry.getFileEntryId()), locale); } else { long manualId = GetterUtil.getLong(scienceApp.getManualId(locale), 0); if (manualId == 0) { scienceApp.setManualId("0", locale); } } } // List<ScienceAppCategoryLink> categoryDataList = ScienceAppCategoryLinkLocalServiceUtil .getScienceAppCategorysByscienceAppId(scienceAppId); for (ScienceAppCategoryLink scienceAppCategoryLink : categoryDataList) { ScienceAppCategoryLinkLocalServiceUtil.deleteScienceAppCategoryLink(scienceAppCategoryLink); } // ? List<String[]> categoryList = new ArrayList<String[]>(); if (params.get("childrenCategoryCheckbox") instanceof String[]) { String[] childrenCategoryArray = (String[]) params.get("childrenCategoryCheckbox"); for (String childrenCategory : childrenCategoryArray) { String[] childrenCategoryValue = childrenCategory.split("_"); categoryList.add(childrenCategoryValue); } } else if (params.get("childrenCategoryCheckbox") instanceof String) { String[] childrenCategoryValue = CustomUtil.strNull(params.get("childrenCategoryCheckbox")) .split("_"); categoryList.add(childrenCategoryValue); } for (String[] categoryArray : categoryList) { long parentCategoryId = GetterUtil.getLong(categoryArray[0], 0l); long categoryId = GetterUtil.getLong(categoryArray[1], 0l); ScienceAppCategoryLink appCategory = ScienceAppCategoryLinkLocalServiceUtil .addScienceAppCategory(categoryId, scienceAppId); appCategory.setGroupId(sc.getScopeGroupId()); appCategory.setParentCategoryId(parentCategoryId); appCategory.setCompanyId(sc.getCompanyId()); appCategory.setUserId(sc.getUserId()); appCategory.setCreateDate(new Date()); ScienceAppCategoryLinkLocalServiceUtil.update(appCategory); } } catch (Exception e) { throw new SystemException(e); } scienceAppLocalService.updateScienceApp(scienceApp); }
From source file:org.kisti.edison.science.service.impl.ScienceAppLocalServiceImpl.java
License:Open Source License
public Map<String, Object> getScienceAppReturnObject(long scienceAppId, Locale locale) throws PortalException, SystemException, ParseException { Map<String, Object> returnMap = new HashMap<String, Object>(); ScienceApp scienceApp = super.getScienceApp(scienceAppId); returnMap.put("scienceAppId", scienceApp.getScienceAppId()); returnMap.put("name", scienceApp.getName()); returnMap.put("version", scienceApp.getVersion()); returnMap.put("title", scienceApp.getTitle()); returnMap.put("currentTitle", scienceApp.getTitle(locale)); returnMap.put("swTest", scienceApp.getSwTest()); returnMap.put("targetLanguage", scienceApp.getTargetLanguage()); returnMap.put("license", scienceApp.getLicense()); returnMap.put("groupId", scienceApp.getGroupId()); returnMap.put("authorId", scienceApp.getAuthorId()); returnMap.put("srcFileName", scienceApp.getSrcFileName()); returnMap.put("openLevel", scienceApp.getOpenLevel()); returnMap.put("status", scienceApp.getStatus()); DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); df.setTimeZone(TimeZoneUtil.getDefault()); returnMap.put("createDate", df.format(scienceApp.getCreateDate())); returnMap.put("descriptionId", scienceApp.getDescriptionId()); //?/*from w w w . j a v a2 s .c o m*/ boolean project = false; if (scienceApp.getProjectCategoryId() != 0) { project = true; } returnMap.put("project", project); // & ? List<ScienceAppCategoryLink> categoryList = ScienceAppCategoryLinkLocalServiceUtil .getScienceAppCategorysByscienceAppId(scienceAppId); String parentCategory = ""; String childrenCategory = ""; for (ScienceAppCategoryLink categoryLink : categoryList) { if (childrenCategory.equals("")) { childrenCategory += categoryLink.getParentCategoryId() + "_" + categoryLink.getCategoryId(); } else { childrenCategory += "," + categoryLink.getParentCategoryId() + "_" + categoryLink.getCategoryId(); } if (parentCategory.equals("")) { parentCategory += categoryLink.getParentCategoryId(); } else { parentCategory += "," + categoryLink.getParentCategoryId(); } } returnMap.put("childrenCategory", childrenCategory); returnMap.put("parentCategory", parentCategory); //User User appUser = UserLocalServiceUtil.getUser(scienceApp.getAuthorId()); returnMap.put("userId", appUser.getUserId()); returnMap.put("userName", appUser.getFirstName()); returnMap.put("userScreenName", appUser.getScreenName()); long classPK = GetterUtil.getLong(appUser.getExpandoBridge().getAttribute(EdisonExpando.USER_UNIVERSITY), 0); String affiliation = EdisonExpndoUtil.getCommonCdSearchFieldValue(classPK, EdisonExpando.CDNM, locale); returnMap.put("affiliation", affiliation); returnMap.put("developers", StringUtil.split(scienceApp.getDevelopers(locale), StringPool.NEW_LINE)); returnMap.put("developersTextArea", scienceApp.getDevelopers()); //? - icon if (scienceApp.getIconId() != 0) { returnMap.put("iconId", scienceApp.getIconId()); DLFileEntry iconDl = DLFileEntryLocalServiceUtil.getDLFileEntry(scienceApp.getIconId()); returnMap.put("iconRepositoryId", iconDl.getRepositoryId()); returnMap.put("iconUuid", iconDl.getUuid()); returnMap.put("iconTitle", iconDl.getTitle()); } // for (Locale aLocale : LanguageUtil.getAvailableLocales()) { long manualId = GetterUtil.getLong(scienceApp.getManualId(aLocale), 0l); String languageId = LocaleUtil.toLanguageId(aLocale); if (manualId != 0) { returnMap.put("manualId_" + languageId, manualId); DLFileEntry manualDl = DLFileEntryLocalServiceUtil.getDLFileEntry(manualId); returnMap.put("manualRepositoryId_" + languageId, manualDl.getRepositoryId()); returnMap.put("manualUuid_" + languageId, manualDl.getUuid()); returnMap.put("manualTitle_" + languageId, manualDl.getTitle()); } } returnMap.put("manualIds", scienceApp.getManualId()); //? long srcFileId = Long.parseLong(CustomUtil.strNull(scienceApp.getSrcFileName(), "0")); if (srcFileId != 0) { returnMap.put("srcFileId", srcFileId); DLFileEntry srcFileDl = DLFileEntryLocalServiceUtil.getDLFileEntry(srcFileId); returnMap.put("srcFileTitle", srcFileDl.getTitle()); } ScienceAppDescription description = ScienceAppDescriptionLocalServiceUtil .getScienceAppDescription(scienceApp.getDescriptionId()); Locale[] availableLocales = LanguageUtil.getAvailableLocales(); String selectLocaleId = LocaleUtil.toLanguageId(locale); Map<String, Object> descriptionMap = new HashMap<String, Object>(); for (Locale alocale : availableLocales) { String languageId = LocaleUtil.toLanguageId(alocale); descriptionMap.put("description_" + languageId, description.getContent(alocale)); } returnMap.put("description", descriptionMap); returnMap.put("selectLocaleId", selectLocaleId); //ScienceApp ? List<ScienceAppManager> mList = ScienceAppManagerLocalServiceUtil.getManagersByScienceAppId(scienceAppId); List<Map<String, Object>> managerList = new ArrayList<Map<String, Object>>(); for (ScienceAppManager manager : mList) { Map<String, Object> managerMap = new HashMap<String, Object>(); User managerUser = UserLocalServiceUtil.getUser(manager.getUserId()); managerMap.put("screenName", managerUser.getScreenName()); managerMap.put("firstName", managerUser.getFirstName()); managerMap.put("email", managerUser.getEmailAddress()); managerMap.put("createDate", manager.getCreateDate()); managerList.add(managerMap); } returnMap.put("managerList", managerList); return returnMap; }
From source file:org.kisti.edison.virtuallaboratory.service.impl.SurveyLocalServiceImpl.java
License:Open Source License
public Survey insertSurvey(Map<String, String> params, Locale locale) throws SystemException { long surveySeqNo = Long.parseLong(params.get("surveySeqNo")); Survey survey = null;//from w w w . j av a 2 s .co m if (surveySeqNo > 0) { survey = surveyPersistence.fetchByPrimaryKey(surveySeqNo); survey.setSurveyTitle(CustomUtil.strNull(params.get("surveyTitle")), locale, Locale.US); } else { survey = surveyPersistence.create(CounterLocalServiceUtil.increment(Survey.class.getName())); survey.setSurveyStatus(CustomUtil.strNull(params.get("surveyStatus"))); if (locale == Locale.US) { Locale[] availLocal = LanguageUtil.getAvailableLocales(); for (int i = 0; i < availLocal.length; i++) { if (!availLocal[i].equals("en_US")) { survey.setSurveyTitle(CustomUtil.strNull(params.get("surveyTitle")), availLocal[i]); } } } else { survey.setSurveyTitle(CustomUtil.strNull(params.get("surveyTitle")), locale); } survey.setSurveyTitle(CustomUtil.strNull(params.get("surveyTitle")), Locale.US); } if (survey != null) { survey.setSurveyStartDate(CustomUtil.strNull(params.get("surveyStartDate"))); survey.setSurveyEndDate(CustomUtil.strNull(params.get("surveyEndDate"))); survey.setSurveyUseYn("Y"); survey.setSurveyCreateDate(new Date()); survey = surveyPersistence.update(survey); } return survey; }
From source file:org.kisti.edison.virtuallaboratory.service.impl.SurveyQuestionLocalServiceImpl.java
License:Open Source License
public SurveyQuestion insertSurveyQuestion(Map params, Locale locale) throws SystemException { long questionSeqNo = GetterUtil.get(params.get("questionSeqNo"), 0L); SurveyQuestion surveyQuestion = null; if (questionSeqNo > 0) { surveyQuestion = surveyQuestionPersistence.fetchByPrimaryKey(questionSeqNo); surveyQuestion.setQuestionTitle(CustomUtil.strNull(params.get("questionTitle")), locale); // surveyQuestion.setQuestionTitle(CustomUtil.strNull(params.get("questionTitle")), Locale.US); surveyQuestion.setQuestionDivCd(CustomUtil.strNull(params.get("questionDivCd"))); if (surveyQuestion.getQuestion1().equals("")) { surveyQuestion.setQuestion1(CustomUtil.strNull(params.get("question1")), locale); surveyQuestion.setQuestion1(CustomUtil.strNull(params.get("question1")), Locale.US); } else if (CustomUtil.strNull(params.get("question1")).equals("")) { surveyQuestion.setQuestion1(""); } else {/*from ww w .j a va 2s . c o m*/ surveyQuestion.setQuestion1(CustomUtil.strNull(params.get("question1")), locale); } if (surveyQuestion.getQuestion2().equals("")) { surveyQuestion.setQuestion2(CustomUtil.strNull(params.get("question2")), locale); surveyQuestion.setQuestion2(CustomUtil.strNull(params.get("question2")), Locale.US); } else if (CustomUtil.strNull(params.get("question2")).equals("")) { surveyQuestion.setQuestion2(""); } else { surveyQuestion.setQuestion2(CustomUtil.strNull(params.get("question2")), locale); } if (surveyQuestion.getQuestion3().equals("")) { surveyQuestion.setQuestion3(CustomUtil.strNull(params.get("question3")), locale); surveyQuestion.setQuestion3(CustomUtil.strNull(params.get("question3")), Locale.US); } else if (CustomUtil.strNull(params.get("question3")).equals("")) { surveyQuestion.setQuestion3(""); } else { surveyQuestion.setQuestion3(CustomUtil.strNull(params.get("question3")), locale); } if (surveyQuestion.getQuestion4().equals("")) { surveyQuestion.setQuestion4(CustomUtil.strNull(params.get("question4")), locale); surveyQuestion.setQuestion4(CustomUtil.strNull(params.get("question4")), Locale.US); } else if (CustomUtil.strNull(params.get("question4")).equals("")) { surveyQuestion.setQuestion4(""); } else { surveyQuestion.setQuestion4(CustomUtil.strNull(params.get("question4")), locale); } if (surveyQuestion.getQuestion5().equals("")) { surveyQuestion.setQuestion5(CustomUtil.strNull(params.get("question5")), locale); surveyQuestion.setQuestion5(CustomUtil.strNull(params.get("question5")), Locale.US); } else if (CustomUtil.strNull(params.get("question5")).equals("")) { surveyQuestion.setQuestion5(""); } else { surveyQuestion.setQuestion5(CustomUtil.strNull(params.get("question5")), locale); } if (surveyQuestion.getQuestion6().equals("")) { surveyQuestion.setQuestion6(CustomUtil.strNull(params.get("question6")), locale); surveyQuestion.setQuestion6(CustomUtil.strNull(params.get("question6")), Locale.US); } else if (CustomUtil.strNull(params.get("question6")).equals("")) { surveyQuestion.setQuestion6(""); } else { surveyQuestion.setQuestion6(CustomUtil.strNull(params.get("question6")), locale); } if (surveyQuestion.getQuestion7().equals("")) { surveyQuestion.setQuestion7(CustomUtil.strNull(params.get("question7")), locale); surveyQuestion.setQuestion7(CustomUtil.strNull(params.get("question7")), Locale.US); } else if (CustomUtil.strNull(params.get("question7")).equals("")) { surveyQuestion.setQuestion7(""); } else { surveyQuestion.setQuestion7(CustomUtil.strNull(params.get("question7")), locale); } if (surveyQuestion.getQuestion8().equals("")) { surveyQuestion.setQuestion8(CustomUtil.strNull(params.get("question8")), locale); surveyQuestion.setQuestion8(CustomUtil.strNull(params.get("question8")), Locale.US); } else if (CustomUtil.strNull(params.get("question8")).equals("")) { surveyQuestion.setQuestion8(""); } else { surveyQuestion.setQuestion8(CustomUtil.strNull(params.get("question8")), locale); } if (surveyQuestion.getQuestion9().equals("")) { surveyQuestion.setQuestion9(CustomUtil.strNull(params.get("question9")), locale); surveyQuestion.setQuestion9(CustomUtil.strNull(params.get("question9")), Locale.US); } else if (CustomUtil.strNull(params.get("question9")).equals("")) { surveyQuestion.setQuestion9(""); } else { surveyQuestion.setQuestion9(CustomUtil.strNull(params.get("question9")), locale); } if (surveyQuestion.getQuestion10().equals("")) { surveyQuestion.setQuestion10(CustomUtil.strNull(params.get("question10")), locale); surveyQuestion.setQuestion10(CustomUtil.strNull(params.get("question10")), Locale.US); } else if (CustomUtil.strNull(params.get("question10")).equals("")) { surveyQuestion.setQuestion10(""); } else { surveyQuestion.setQuestion10(CustomUtil.strNull(params.get("question10")), locale); } } else { surveyQuestion = surveyQuestionPersistence .create(CounterLocalServiceUtil.increment(SurveyQuestion.class.getName())); Locale[] availLocal = LanguageUtil.getAvailableLocales(); for (int i = 0; i < availLocal.length; i++) { surveyQuestion.setQuestionTitle(CustomUtil.strNull(params.get("questionTitle")), availLocal[i]); surveyQuestion.setQuestion1(CustomUtil.strNull(params.get("question1")), availLocal[i]); surveyQuestion.setQuestion2(CustomUtil.strNull(params.get("question2")), availLocal[i]); surveyQuestion.setQuestion3(CustomUtil.strNull(params.get("question3")), availLocal[i]); surveyQuestion.setQuestion4(CustomUtil.strNull(params.get("question4")), availLocal[i]); surveyQuestion.setQuestion5(CustomUtil.strNull(params.get("question5")), availLocal[i]); surveyQuestion.setQuestion6(CustomUtil.strNull(params.get("question6")), availLocal[i]); surveyQuestion.setQuestion7(CustomUtil.strNull(params.get("question7")), availLocal[i]); surveyQuestion.setQuestion8(CustomUtil.strNull(params.get("question8")), availLocal[i]); surveyQuestion.setQuestion9(CustomUtil.strNull(params.get("question9")), availLocal[i]); surveyQuestion.setQuestion10(CustomUtil.strNull(params.get("question10")), availLocal[i]); } surveyQuestion.setQuestionDivCd(CustomUtil.strNull(params.get("questionDivCd"))); // surveyQuestion.setQuestionTitle(CustomUtil.strNull(params.get("questionTitle")), locale); // surveyQuestion.setQuestionTitle(CustomUtil.strNull(params.get("questionTitle")), Locale.US); // surveyQuestion.setQuestionDivCd(CustomUtil.strNull(params.get("questionDivCd"))); // surveyQuestion.setQuestion1(CustomUtil.strNull(params.get("question1")), locale); // surveyQuestion.setQuestion1(CustomUtil.strNull(params.get("question1")), Locale.US); // surveyQuestion.setQuestion2(CustomUtil.strNull(params.get("question2")), locale); // surveyQuestion.setQuestion2(CustomUtil.strNull(params.get("question2")), Locale.US); // surveyQuestion.setQuestion3(CustomUtil.strNull(params.get("question3")), locale); // surveyQuestion.setQuestion3(CustomUtil.strNull(params.get("question3")), Locale.US); // surveyQuestion.setQuestion4(CustomUtil.strNull(params.get("question4")), locale); // surveyQuestion.setQuestion4(CustomUtil.strNull(params.get("question4")), Locale.US); // surveyQuestion.setQuestion5(CustomUtil.strNull(params.get("question5")), locale); // surveyQuestion.setQuestion5(CustomUtil.strNull(params.get("question5")), Locale.US); // surveyQuestion.setQuestion6(CustomUtil.strNull(params.get("question6")), locale); // surveyQuestion.setQuestion6(CustomUtil.strNull(params.get("question6")), Locale.US); // surveyQuestion.setQuestion7(CustomUtil.strNull(params.get("question7")), locale); // surveyQuestion.setQuestion7(CustomUtil.strNull(params.get("question7")), Locale.US); // surveyQuestion.setQuestion8(CustomUtil.strNull(params.get("question8")), locale); // surveyQuestion.setQuestion8(CustomUtil.strNull(params.get("question8")), Locale.US); // surveyQuestion.setQuestion9(CustomUtil.strNull(params.get("question9")), locale); // surveyQuestion.setQuestion9(CustomUtil.strNull(params.get("question9")), Locale.US); // surveyQuestion.setQuestion10(CustomUtil.strNull(params.get("question10")), locale); // surveyQuestion.setQuestion10(CustomUtil.strNull(params.get("question10")), Locale.US); } surveyQuestion = surveyQuestionPersistence.update(surveyQuestion); surveyQuestionPersistence.addSurvey(surveyQuestion.getPrimaryKey(), (Long) params.get("surveySeqNo")); return surveyQuestion; }
From source file:org.un.ldcportal.jargon.model.impl.LDCJargonImpl.java
License:Open Source License
public void setNameMap(Map<Locale, String> nameMap, Locale defaultLocale) { if (nameMap == null) { return;/*w w w. ja v a 2 s. c o m*/ } Locale[] locales = LanguageUtil.getAvailableLocales(); for (Locale locale : locales) { String title = nameMap.get(locale); setName(title, locale, defaultLocale); } }
From source file:org.un.ldcportal.jargon.model.impl.LDCJargonImpl.java
License:Open Source License
public void setDefinitionMap(Map<Locale, String> definitionMap, Locale defaultLocale) { if (definitionMap == null) { return;// w ww . j a va2s. c o m } Locale[] locales = LanguageUtil.getAvailableLocales(); for (Locale locale : locales) { String definition = definitionMap.get(locale); setDefinition(definition, locale, defaultLocale); } }