@Override public JournalFeed updateFeed( long groupId, String feedId, String name, String description, String type, String structureId, String templateId, String rendererTemplateId, int delta, String orderByCol, String orderByType, String targetLayoutFriendlyUrl, String targetPortletId, String contentField, String feedFormat, double feedVersion, ServiceContext serviceContext) throws PortalException, SystemException { // Feed JournalFeed feed = journalFeedPersistence.findByG_F(groupId, feedId); validate( feed.getCompanyId(), groupId, name, structureId, targetLayoutFriendlyUrl, contentField); feed.setModifiedDate(serviceContext.getModifiedDate(null)); feed.setName(name); feed.setDescription(description); feed.setType(type); feed.setStructureId(structureId); feed.setTemplateId(templateId); feed.setRendererTemplateId(rendererTemplateId); feed.setDelta(delta); feed.setOrderByCol(orderByCol); feed.setOrderByType(orderByType); feed.setTargetLayoutFriendlyUrl(targetLayoutFriendlyUrl); feed.setTargetPortletId(targetPortletId); feed.setContentField(contentField); if (Validator.isNull(feedFormat)) { feed.setFeedFormat(RSSUtil.FORMAT_DEFAULT); feed.setFeedVersion(RSSUtil.VERSION_DEFAULT); } else { feed.setFeedFormat(feedFormat); feed.setFeedVersion(feedVersion); } feed.setExpandoBridgeAttributes(serviceContext); journalFeedPersistence.update(feed); return feed; }
@Override public JournalFeed addFeed( long userId, long groupId, String feedId, boolean autoFeedId, String name, String description, String type, String structureId, String templateId, String rendererTemplateId, int delta, String orderByCol, String orderByType, String targetLayoutFriendlyUrl, String targetPortletId, String contentField, String feedFormat, double feedVersion, ServiceContext serviceContext) throws PortalException, SystemException { // Feed User user = userPersistence.findByPrimaryKey(userId); feedId = StringUtil.toUpperCase(feedId.trim()); Date now = new Date(); validate( user.getCompanyId(), groupId, feedId, autoFeedId, name, structureId, targetLayoutFriendlyUrl, contentField); if (autoFeedId) { feedId = String.valueOf(counterLocalService.increment()); } long id = counterLocalService.increment(); JournalFeed feed = journalFeedPersistence.create(id); feed.setUuid(serviceContext.getUuid()); feed.setGroupId(groupId); feed.setCompanyId(user.getCompanyId()); feed.setUserId(user.getUserId()); feed.setUserName(user.getFullName()); feed.setCreateDate(serviceContext.getCreateDate(now)); feed.setModifiedDate(serviceContext.getModifiedDate(now)); feed.setFeedId(feedId); feed.setName(name); feed.setDescription(description); feed.setType(type); feed.setStructureId(structureId); feed.setTemplateId(templateId); feed.setRendererTemplateId(rendererTemplateId); feed.setDelta(delta); feed.setOrderByCol(orderByCol); feed.setOrderByType(orderByType); feed.setTargetLayoutFriendlyUrl(targetLayoutFriendlyUrl); feed.setTargetPortletId(targetPortletId); feed.setContentField(contentField); if (Validator.isNull(feedFormat)) { feed.setFeedFormat(RSSUtil.FORMAT_DEFAULT); feed.setFeedVersion(RSSUtil.VERSION_DEFAULT); } else { feed.setFeedFormat(feedFormat); feed.setFeedVersion(feedVersion); } feed.setExpandoBridgeAttributes(serviceContext); journalFeedPersistence.update(feed); // Resources if (serviceContext.isAddGroupPermissions() || serviceContext.isAddGuestPermissions()) { addFeedResources( feed, serviceContext.isAddGroupPermissions(), serviceContext.isAddGuestPermissions()); } else { addFeedResources( feed, serviceContext.getGroupPermissions(), serviceContext.getGuestPermissions()); } return feed; }