List of usage examples for com.liferay.portal.kernel.util StringPool NEW_LINE
String NEW_LINE
To view the source code for com.liferay.portal.kernel.util StringPool NEW_LINE.
Click Source Link
From source file:com.liferay.wol.model.impl.SVNRevisionImpl.java
License:Open Source License
public Object[] getJIRAIssueAndComments() { JIRAIssue jiraIssue = null;//from w ww. j a va2 s. c o m String comments = getComments(); if ( // LEP comments.startsWith(_LEP_PREFIX_1) || comments.startsWith(_LEP_PREFIX_2) || comments.startsWith(_LEP_PREFIX_3) || // LPE comments.startsWith(_LPE_PREFIX_1) || comments.startsWith(_LPE_PREFIX_2) || comments.startsWith(_LPE_PREFIX_3) || // LPS comments.startsWith(_LPS_PREFIX_1) || comments.startsWith(_LPS_PREFIX_2) || comments.startsWith(_LPS_PREFIX_3)) { comments = StringUtil.replace(comments, StringPool.NEW_LINE, StringPool.SPACE); int pos = comments.indexOf(StringPool.SPACE); if (pos == -1) { pos = comments.length(); } String keyPrefix = null; String keyId = null; // LPE if (comments.startsWith(_LEP_PREFIX_1)) { keyPrefix = "LEP"; keyId = comments.substring(_LEP_PREFIX_1.length(), pos); } else if (comments.startsWith(_LEP_PREFIX_2)) { keyPrefix = "LEP"; keyId = comments.substring(_LEP_PREFIX_2.length(), pos); } else if (comments.startsWith(_LEP_PREFIX_3)) { keyPrefix = "LEP"; keyId = comments.substring(_LEP_PREFIX_3.length(), pos); } // LPE if (comments.startsWith(_LPE_PREFIX_1)) { keyPrefix = "LPE"; keyId = comments.substring(_LPE_PREFIX_1.length(), pos); } else if (comments.startsWith(_LPE_PREFIX_2)) { keyPrefix = "LPE"; keyId = comments.substring(_LPE_PREFIX_2.length(), pos); } else if (comments.startsWith(_LPE_PREFIX_3)) { keyPrefix = "LPE"; keyId = comments.substring(_LPE_PREFIX_3.length(), pos); } // LPS if (comments.startsWith(_LPS_PREFIX_1)) { keyPrefix = "LPS"; keyId = comments.substring(_LPS_PREFIX_1.length(), pos); } else if (comments.startsWith(_LPS_PREFIX_2)) { keyPrefix = "LPS"; keyId = comments.substring(_LPS_PREFIX_2.length(), pos); } else if (comments.startsWith(_LPS_PREFIX_3)) { keyPrefix = "LPS"; keyId = comments.substring(_LPS_PREFIX_3.length(), pos); } comments = comments.substring(pos).trim(); if (Validator.isNumber(keyId)) { try { jiraIssue = JIRAIssueLocalServiceUtil.getJIRAIssue(keyPrefix + "-" + keyId); } catch (Exception e) { } } if (jiraIssue != null) { return new Object[] { jiraIssue, comments }; } } return null; }
From source file:hu.borkutip.lfrnevnapp.data.service.impl.DayEntityLocalServiceImpl.java
License:Open Source License
public boolean fillDatabase(URL resource) { boolean success = false; try {/*from www. j a v a 2 s . com*/ if (dayEntityPersistence.countAll() > 0) { _log.error("table exists, remove all"); dayEntityPersistence.removeAll(); } } catch (Exception e) { _log.error(e); } try { String dates = HttpUtil.URLtoString(resource); String[] lines = dates.split(StringPool.NEW_LINE); for (String l : lines) { String[] parts = l.split(","); if (parts.length < 3) { _log.error("error when adding line :" + l); continue; } Long nameId; Integer month; Integer day; try { nameId = Long.parseLong(parts[0]); month = Integer.parseInt(parts[1]); day = Integer.parseInt(parts[2]); } catch (Exception e) { _log.error(e); continue; } DayEntity de = dayEntityPersistence .create(counterLocalService.increment(DayEntity.class.getName())); de.setDay(day); de.setMonth(month); de.setNameId(nameId); dayEntityLocalService.addDayEntity(de); // _log.error("added:" + l); } success = true; } catch (MalformedURLException e) { _log.error(e); } catch (IOException e) { _log.error(e); } catch (SystemException e) { _log.error(e); } return success; }
From source file:hu.borkutip.lfrnevnapp.data.service.impl.NameEntityLocalServiceImpl.java
License:Open Source License
public boolean fillDatabase(URL resource) { boolean success = false; try {/*from ww w. j av a 2 s . com*/ if (nameEntityPersistence.countAll() > 0) { _log.error("table exists, remove all"); nameEntityPersistence.removeAll(); } } catch (Exception e) { _log.error(e); } try { String dates = HttpUtil.URLtoString(resource); String[] lines = dates.split(StringPool.NEW_LINE); for (String l : lines) { String[] parts = l.split(","); if (parts.length < 2) { _log.error("error when adding line :" + l); continue; } Long nameId; try { nameId = Long.parseLong(parts[0]); } catch (Exception e) { _log.error(e); continue; } String name = parts[1]; NameEntity ne = nameEntityPersistence.create(nameId); ne.setGender(3); ne.setName(name); nameEntityLocalService.addNameEntity(ne); _log.error("added:" + l); } success = true; } catch (MalformedURLException e) { _log.error(e); } catch (IOException e) { _log.error(e); } catch (SystemException e) { _log.error(e); } return success; }
From source file:it.dontesta.liferay.messagebus.example.mvc.SendEmail.java
License:Open Source License
/** * //from w w w . j ava2s.c o m * @param userList * @return */ protected String getEmailBody(List<User> userList) { StringBundler emailBody = new StringBundler(); emailBody.append("Below is the list of disabled users:"); emailBody.append(StringPool.NEW_LINE); for (User detailUser : userList) { emailBody.append(StringPool.POUND); emailBody.append(StringPool.SPACE); emailBody.append(detailUser.getFullName()); emailBody.append(StringPool.SPACE); emailBody.append(" last login on: "); emailBody.append((Validator.isNotNull(detailUser.getLastLoginDate())) ? detailUser.getLastLoginDate() : StringPool.BLANK); emailBody.append(StringPool.NEW_LINE); } return emailBody.toString(); }
From source file:it.sysdata.mqtt.service.impl.MqttLocalServiceImpl.java
License:Open Source License
@Override public void applySubscriptionsList() throws MqttException, SystemException { String[] subscriptions = PrefsPropsUtil.getStringArray(PortletPropsKeys.MQTT_SUBSCRIPTIONS_LIST, StringPool.NEW_LINE, PortletPropsValues.MQTT_SUBSCRIPTIONS_ARRAY); if (_getInstance().isConnected()) { String[] topics = ConfigUtil.properties2topic(subscriptions); int[] qos = ConfigUtil.properties2qos(subscriptions); for (int i = 0; i < topics.length; i++) { subscribe(topics[i], qos[i]); }// w ww. j av a 2 s.c om } }
From source file:it.sysdata.mqtt.service.impl.MqttLocalServiceImpl.java
License:Open Source License
@Override public void resetSubscriptionsList() throws MqttException, SystemException { String[] subscriptions = PrefsPropsUtil.getStringArray(PortletPropsKeys.MQTT_SUBSCRIPTIONS_LIST, StringPool.NEW_LINE, PortletPropsValues.MQTT_SUBSCRIPTIONS_ARRAY); if (_getInstance().isConnected()) { String[] topics = ConfigUtil.properties2topic(subscriptions); _getInstance().unsubscribe(topics); }/*from w w w .j av a 2 s. co m*/ }
From source file:it.webscience.kpeople.web.portlet.report.action.ConfigurationActionImpl.java
License:Open Source License
public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { String cmd = ParamUtil.getString(actionRequest, Constants.CMD); if (!cmd.equals(Constants.UPDATE)) { return;/*w ww .ja v a 2s . c o m*/ } // String src = ParamUtil.getString(actionRequest, "src"); // if (!src.startsWith("/") && !StringUtil.startsWith(src, "http://") // && !StringUtil.startsWith(src, "https://") // && !StringUtil.startsWith(src, "mhtml://")) { // // src = HttpUtil.getProtocol(actionRequest) + "://" + src; // } String showFilter = ParamUtil.getString(actionRequest, ReportBrowserConstants.SHOW_FILTER); String reportType = ParamUtil.getString(actionRequest, "reportType"); String style = ParamUtil.getString(actionRequest, "style"); String widthChart = ParamUtil.getString(actionRequest, "widthChart"); String heightChart = ParamUtil.getString(actionRequest, "heightChart"); boolean relative = ParamUtil.getBoolean(actionRequest, "relative"); boolean auth = ParamUtil.getBoolean(actionRequest, "auth"); String authType = ParamUtil.getString(actionRequest, "authType"); String formMethod = ParamUtil.getString(actionRequest, "formMethod"); String userName = ParamUtil.getString(actionRequest, "userName"); String userNameField = ParamUtil.getString(actionRequest, "userNameField"); String password = ParamUtil.getString(actionRequest, "password"); String passwordField = ParamUtil.getString(actionRequest, "passwordField"); String hiddenVariables = ParamUtil.getString(actionRequest, "hiddenVariables"); String[] htmlAttributes = StringUtil.split(ParamUtil.getString(actionRequest, "htmlAttributes"), StringPool.NEW_LINE); String portletResource = ParamUtil.getString(actionRequest, "portletResource"); PortletPreferences preferences = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource); // preferences.setValue("src", src); preferences.setValue("relative", String.valueOf(relative)); preferences.setValue("auth", String.valueOf(auth)); preferences.setValue("auth-type", authType); preferences.setValue("form-method", formMethod); preferences.setValue("user-name", userName); preferences.setValue("user-name-field", userNameField); preferences.setValue("password", password); preferences.setValue("password-field", passwordField); preferences.setValue("hidden-variables", hiddenVariables); preferences.setValue("reportType", reportType); preferences.setValue("widthChart", widthChart); preferences.setValue("heightChart", heightChart); preferences.setValue("style", style); preferences.setValue(ReportBrowserConstants.SHOW_FILTER, showFilter); for (String htmlAttribute : htmlAttributes) { int pos = htmlAttribute.indexOf(StringPool.EQUAL); if (pos == -1) { continue; } String key = htmlAttribute.substring(0, pos); String value = htmlAttribute.substring(pos + 1, htmlAttribute.length()); preferences.setValue(key, value); } preferences.store(); SessionMessages.add(actionRequest, portletConfig.getPortletName() + ".doConfigure"); }
From source file:jorgediazest.util.output.OutputUtils.java
License:Open Source License
public static String listStringToString(List<String> out) { if (Validator.isNull(out)) { return null; }/* w w w . j a va2 s . c o m*/ StringBundler stringBundler = new StringBundler(out.size() * 2); for (String s : out) { stringBundler.append(s); stringBundler.append(StringPool.NEW_LINE); } return stringBundler.toString(); }
From source file:org.kisti.edison.science.service.impl.ScienceAppFavoriteLocalServiceImpl.java
License:Open Source License
public List<Map<String, Object>> getFavoriteAppList(long companyId, long groupId, long userId, Locale locale, boolean widthFile) throws SystemException { List<Map<String, Object>> returnList = new ArrayList<Map<String, Object>>(); try {//from www . j a v a 2 s. c o m long entryId = 0; ExpandoTable table = ExpandoTableLocalServiceUtil.getTable(companyId, User.class.getName(), ExpandoTableConstants.DEFAULT_TABLE_NAME); long columnId = ExpandoColumnLocalServiceUtil .getColumn(table.getTableId(), EdisonExpando.USER_UNIVERSITY).getColumnId(); Company company = CompanyLocalServiceUtil.getCompany(companyId); long companyGroupId = company.getGroupId(); long vocabularyId = AssetVocabularyLocalServiceUtil .getGroupVocabulary(companyGroupId, EdisonAssetCategory.GLOBAL_DOMAIN).getVocabularyId(); long parentGroupId = GroupLocalServiceUtil.getGroup(groupId).getParentGroupId(); if (parentGroupId != 0) { entryId = AssetEntryLocalServiceUtil.fetchEntry(Group.class.getName(), groupId).getEntryId(); } List<Object[]> resultList = scienceAppFinder.getFavoriteAppList(entryId, vocabularyId, columnId, userId, locale); if (resultList != null) { for (int i = 0; i < resultList.size(); i++) { Object[] resultArray = resultList.get(i); ScienceApp scienceApp = (ScienceApp) resultArray[0]; long universityId = (Long) resultArray[1]; Map<String, Object> resultRow = new HashMap<String, Object>(); resultRow.put("scienceAppId", scienceApp.getScienceAppId()); resultRow.put("userId", scienceApp.getUserId()); resultRow.put("groupId", scienceApp.getGroupId()); resultRow.put("name", scienceApp.getName()); resultRow.put("title", scienceApp.getTitle(locale)); resultRow.put("version", scienceApp.getVersion()); resultRow.put("createDate", CustomUtil.StringToDateFormat( CustomUtil.strNull(scienceApp.getCreateDate()), "yyyy-MM-dd HH:mm:ss")); resultRow.put("developersTextArea", scienceApp.getDevelopers()); resultRow.put("developers", StringUtil.split(scienceApp.getDevelopers(locale), StringPool.NEW_LINE)); User user = userPersistence.fetchByPrimaryKey(scienceApp.getUserId()); if (user != null) { resultRow.put("screenName", user.getScreenName()); resultRow.put("userFirstName", user.getFirstName()); resultRow.put("affiliationId", universityId); resultRow.put("affiliation", EdisonExpndoUtil.getCommonCdSearchFieldValue(universityId, EdisonExpando.CDNM, locale)); } if (widthFile) { //? - icon if (scienceApp.getIconId() != 0) { resultRow.put("iconId", scienceApp.getIconId()); DLFileEntry iconDl = DLFileEntryLocalServiceUtil.getDLFileEntry(scienceApp.getIconId()); resultRow.put("iconRepositoryId", iconDl.getRepositoryId()); resultRow.put("iconUuid", iconDl.getUuid()); resultRow.put("iconTitle", iconDl.getTitle()); } // long manualId = GetterUtil.getLong(scienceApp.getManualId(locale), 0l); if (manualId != 0) { resultRow.put("manualId", manualId); DLFileEntry manualDl = DLFileEntryLocalServiceUtil.getDLFileEntry(manualId); resultRow.put("manualRepositoryId", manualDl.getRepositoryId()); resultRow.put("manualUuid", manualDl.getUuid()); resultRow.put("manualTitle", manualDl.getTitle()); } } returnList.add(resultRow); } } } catch (PortalException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return returnList; }
From source file:org.kisti.edison.science.service.impl.ScienceAppLocalServiceImpl.java
License:Open Source License
/** * ? ? ? APP ? (EX_EDITOR)//w ww . j a v a 2 s. c o m * @param groupId * @param locale * @param searchParam * @return * @throws PortalException * @throws SystemException */ public List<Map<String, Object>> retrieveListScienceEditorApp(long companyId, Locale locale, Map<String, Object> searchParam) throws PortalException, SystemException { String targetLanguage = LocaleUtil.toLanguageId(locale); searchParam.put("targetLanguage", targetLanguage); searchParam.put("companyId", companyId); //User ExpandoTable table = ExpandoTableLocalServiceUtil.getTable(companyId, User.class.getName(), ExpandoTableConstants.DEFAULT_TABLE_NAME); ExpandoColumn column = ExpandoColumnLocalServiceUtil.getColumn(table.getTableId(), EdisonExpando.USER_UNIVERSITY); searchParam.put("columnId", column.getColumnId()); // ? ? ? String searchOption = CustomUtil.strNull(searchParam.get("searchOption")); if (!searchOption.equals("")) { searchParam.put(searchOption, "Y"); if (StringUtil.equalsIgnoreCase(searchOption, "APP_MANAGER_SEARCH_ALL")) { String searchValue = CustomUtil.strNull(searchParam.get("searchValue")); String searchOrgCodeStr = ""; //? Like List<Map<String, String>> commonCodeList = EdisonExpndoUtil.getCodeListByUpCode(1501, locale); for (Map<String, String> codeMap : commonCodeList) { String codeName = codeMap.get(EdisonExpando.CDNM); if (codeName.indexOf(searchValue) > -1) { String codeValue = codeMap.get(EdisonExpando.CD); if (searchOrgCodeStr.equals("")) { searchOrgCodeStr += codeValue; } else { searchOrgCodeStr += "," + codeValue; } } } if (searchOrgCodeStr.equals("")) { searchParam.put("searchOrgCode", searchValue); } else { long[] searchOrgCode = StringUtil.split(searchOrgCodeStr, 0l); searchParam.put("searchOrgCode", searchOrgCode); } } } List<Map<String, Object>> returnList = new ArrayList<Map<String, Object>>(); try { List<ScienceApp> scienceAppList = scienceAppFinder.retrieveListScienceEditorApp(searchParam); for (ScienceApp scienceApp : scienceAppList) { Map<String, Object> resultRow = new HashMap<String, Object>(); User user = UserLocalServiceUtil.getUser(scienceApp.getAuthorId()); resultRow.put("scienceAppId", scienceApp.getScienceAppId()); resultRow.put("createDate", scienceApp.getCreateDate()); resultRow.put("name", scienceApp.getName()); resultRow.put("version", scienceApp.getVersion()); resultRow.put("title", scienceApp.getTitle(locale)); resultRow.put("status", scienceApp.getStatus()); resultRow.put("modifiedDate", CustomUtil.StringToDateFormat( CustomUtil.strNull(scienceApp.getModifiedDate()), "yyyy-MM-dd HH:mm:ss")); resultRow.put("developers", StringUtil.split(scienceApp.getDevelopers(locale), StringPool.NEW_LINE)); resultRow.put("appType", scienceApp.getAppType()); resultRow.put("editorType", scienceApp.getEditorType()); resultRow.put("firstName", user.getFirstName()); resultRow.put("screenName", user.getScreenName()); resultRow.put("userId", user.getUserId()); long classPK = GetterUtil .getLong(user.getExpandoBridge().getAttribute(EdisonExpando.USER_UNIVERSITY), 0); String affiliation = EdisonExpndoUtil.getCommonCdSearchFieldValue(classPK, EdisonExpando.CDNM, locale); resultRow.put("affiliation", affiliation); returnList.add(resultRow); } } catch (Exception e) { throw new SystemException(e); } return returnList; }