protected void updateAction(ActionRequest actionRequest) throws Exception { long actionId = ParamUtil.getLong(actionRequest, "actionId"); long ruleGroupInstanceId = ParamUtil.getLong(actionRequest, "ruleGroupInstanceId"); Map<Locale, String> nameMap = LocalizationUtil.getLocalizationMap(actionRequest, "name"); Map<Locale, String> descriptionMap = LocalizationUtil.getLocalizationMap(actionRequest, "description"); String type = ParamUtil.getString(actionRequest, "type"); ActionHandler actionHandler = ActionHandlerManagerUtil.getActionHandler(type); if (actionHandler == null) { throw new ActionTypeException(); } UnicodeProperties typeSettingsProperties = getTypeSettingsProperties(actionRequest, actionHandler.getPropertyNames()); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); if (actionId <= 0) { MDRActionServiceUtil.addAction( ruleGroupInstanceId, nameMap, descriptionMap, type, typeSettingsProperties, serviceContext); } else { MDRActionServiceUtil.updateAction( actionId, nameMap, descriptionMap, type, typeSettingsProperties, serviceContext); } }
protected Activity getActivity(ThemeDisplay themeDisplay, SocialActivity socialActivity) throws Exception { Activity activity = null; String className = socialActivity.getClassName(); if (className.equals(Activity.class.getName())) { activity = getExternalActivity(socialActivity); } else { activity = new ActivityImpl( String.valueOf(socialActivity.getClassPK()), String.valueOf(socialActivity.getUserId())); HttpServletRequest request = HttpServletRequestThreadLocal.getHttpServletRequest(); request.setAttribute(WebKeys.THEME_DISPLAY, themeDisplay); ServiceContext serviceContext = ServiceContextFactory.getInstance(request); serviceContext.setCompanyId(themeDisplay.getCompanyId()); serviceContext.setUserId(themeDisplay.getUserId()); SocialActivityFeedEntry socialActivityFeedEntry = null; SocialActivityInterpreterLocalServiceUtil.interpret( StringPool.BLANK, socialActivity, serviceContext); activity.setBody(socialActivityFeedEntry.getBody()); activity.setTitle(socialActivityFeedEntry.getTitle()); activity.setUrl(socialActivityFeedEntry.getLink()); } return activity; }
protected void updateNode(ActionRequest actionRequest) throws Exception { long nodeId = ParamUtil.getLong(actionRequest, "nodeId"); String name = ParamUtil.getString(actionRequest, "name"); String description = ParamUtil.getString(actionRequest, "description"); ServiceContext serviceContext = ServiceContextFactory.getInstance(WikiNode.class.getName(), actionRequest); if (nodeId <= 0) { // Add node WikiNodeServiceUtil.addNode(name, description, serviceContext); } else { // Update node WikiNode wikiNode = WikiNodeServiceUtil.getNode(nodeId); String oldName = wikiNode.getName(); WikiNodeServiceUtil.updateNode(nodeId, name, description, serviceContext); WikiPortletInstanceSettings wikiPortletInstanceSettings = getWikiPortletInstanceSettings(actionRequest); updateSettings(wikiPortletInstanceSettings, oldName, name); } }
public static void sendPassword( ActionRequest actionRequest, String fromName, String fromAddress, String toAddress, String subject, String body) throws Exception { HttpServletRequest request = PortalUtil.getHttpServletRequest(actionRequest); ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); Company company = themeDisplay.getCompany(); if (!company.isSendPassword() && !company.isSendPasswordResetLink()) { return; } ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(), actionRequest); UserLocalServiceUtil.sendPassword( company.getCompanyId(), toAddress, fromName, fromAddress, subject, body, serviceContext); SessionMessages.add(actionRequest, "request_processed", toAddress); }
protected void copyTemplates(ActionRequest actionRequest, long structureId, long newStructureId) throws Exception { long classNameId = PortalUtil.getClassNameId(DDMStructure.class); ServiceContext serviceContext = ServiceContextFactory.getInstance(DDMTemplate.class.getName(), actionRequest); boolean copyDisplayTemplates = ParamUtil.getBoolean(actionRequest, "copyDisplayTemplates"); if (copyDisplayTemplates) { DDMTemplateServiceUtil.copyTemplates( classNameId, structureId, newStructureId, DDMTemplateConstants.TEMPLATE_TYPE_DISPLAY, serviceContext); } boolean copyFormTemplates = ParamUtil.getBoolean(actionRequest, "copyFormTemplates"); if (copyFormTemplates) { DDMTemplateServiceUtil.copyTemplates( classNameId, structureId, newStructureId, DDMTemplateConstants.TEMPLATE_TYPE_FORM, serviceContext); } }
public void updateKBComment(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); if (!themeDisplay.isSignedIn()) { return; } String cmd = ParamUtil.getString(actionRequest, Constants.CMD); long kbCommentId = ParamUtil.getLong(actionRequest, "kbCommentId"); long classNameId = ParamUtil.getLong(actionRequest, "classNameId"); long classPK = ParamUtil.getLong(actionRequest, "classPK"); String content = ParamUtil.getString(actionRequest, "content"); boolean helpful = ParamUtil.getBoolean(actionRequest, "helpful"); ServiceContext serviceContext = ServiceContextFactory.getInstance(KBComment.class.getName(), actionRequest); if (cmd.equals(Constants.ADD)) { KBCommentLocalServiceUtil.addKBComment( themeDisplay.getUserId(), classNameId, classPK, content, helpful, serviceContext); } else if (cmd.equals(Constants.UPDATE)) { KBCommentLocalServiceUtil.updateKBComment( kbCommentId, classNameId, classPK, content, helpful, serviceContext); } }
public void updateSAPEntry(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { long sapEntryId = ParamUtil.getLong(actionRequest, "sapEntryId"); String allowedServiceSignatures = ParamUtil.getString(actionRequest, "allowedServiceSignatures"); boolean defaultSAPEntry = ParamUtil.getBoolean(actionRequest, "defaultSAPEntry"); boolean enabled = ParamUtil.getBoolean(actionRequest, "enabled"); String name = ParamUtil.getString(actionRequest, "name"); Map<Locale, String> titleMap = LocalizationUtil.getLocalizationMap(actionRequest, "title"); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); if (sapEntryId > 0) { _sapEntryService.updateSAPEntry( sapEntryId, allowedServiceSignatures, defaultSAPEntry, enabled, name, titleMap, serviceContext); } else { _sapEntryService.addSAPEntry( allowedServiceSignatures, defaultSAPEntry, enabled, name, titleMap, serviceContext); } }
@Override protected byte[] getRSS(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception { String feedTitle = ParamUtil.getString(resourceRequest, "feedTitle"); String format = ParamUtil.getString(resourceRequest, "type", RSSUtil.FORMAT_DEFAULT); double version = ParamUtil.getDouble(resourceRequest, "version", RSSUtil.VERSION_DEFAULT); String displayStyle = ParamUtil.getString(resourceRequest, "displayStyle", RSSUtil.DISPLAY_STYLE_DEFAULT); int max = ParamUtil.getInteger(resourceRequest, "max", SearchContainer.DEFAULT_DELTA); List<SocialActivity> socialActivities = getSocialActivities(resourceRequest, max); ServiceContext serviceContext = ServiceContextFactory.getInstance(resourceRequest); String rss = exportToRSS( resourceRequest, resourceResponse, feedTitle, null, format, version, displayStyle, socialActivities, serviceContext); return rss.getBytes(StringPool.UTF8); }
public void addAttachment(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(actionRequest); String portletId = PortalUtil.getPortletId(actionRequest); long resourcePrimKey = ParamUtil.getLong(uploadPortletRequest, "resourcePrimKey"); String dirName = ParamUtil.getString(uploadPortletRequest, "dirName"); String fileName = uploadPortletRequest.getFileName("file"); InputStream inputStream = null; try { inputStream = uploadPortletRequest.getFileAsStream("file"); ServiceContext serviceContext = ServiceContextFactory.getInstance(KBArticle.class.getName(), actionRequest); KBArticleServiceUtil.addAttachment( portletId, resourcePrimKey, dirName, fileName, inputStream, serviceContext); } finally { StreamUtil.cleanUp(inputStream); } }
public void updateConfiguration(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { try { ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); long scopeGroupId = serviceContext.getScopeGroupId(); Group scopeGroup = GroupLocalServiceUtil.getGroup(scopeGroupId); if (scopeGroup.isStagingGroup()) { scopeGroup = scopeGroup.getLiveGroup(); } UnicodeProperties typeSettingsProperties = scopeGroup.getTypeSettingsProperties(); UnicodeProperties properties = PropertiesParamUtil.getProperties(actionRequest, "settings--"); typeSettingsProperties.putAll(properties); GroupServiceUtil.updateGroup(scopeGroup.getGroupId(), scopeGroup.getTypeSettings()); } catch (Exception e) { SessionErrors.add(actionRequest, e.getClass().getName()); } }
protected void updateActive(ActionRequest actionRequest, String cmd) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long groupId = ParamUtil.getLong(actionRequest, "groupId"); if ((groupId == themeDisplay.getDoAsGroupId()) || (groupId == themeDisplay.getScopeGroupId()) || (groupId == getRefererGroupId(themeDisplay))) { throw new RequiredGroupException( String.valueOf(groupId), RequiredGroupException.CURRENT_GROUP); } Group group = GroupServiceUtil.getGroup(groupId); boolean active = false; if (cmd.equals(Constants.RESTORE)) { active = true; } ServiceContext serviceContext = ServiceContextFactory.getInstance(Group.class.getName(), actionRequest); GroupServiceUtil.updateGroup( groupId, group.getParentGroupId(), group.getName(), group.getDescription(), group.getType(), group.getFriendlyURL(), active, serviceContext); }
protected void updateFileShortcut(ActionRequest actionRequest) throws Exception { long fileShortcutId = ParamUtil.getLong(actionRequest, "fileShortcutId"); long repositoryId = ParamUtil.getLong(actionRequest, "repositoryId"); long folderId = ParamUtil.getLong(actionRequest, "folderId"); long toFileEntryId = ParamUtil.getLong(actionRequest, "toFileEntryId"); ServiceContext serviceContext = ServiceContextFactory.getInstance(DLFileShortcut.class.getName(), actionRequest); if (fileShortcutId <= 0) { // Add file shortcut DLFileShortcut fileShortcut = DLAppServiceUtil.addFileShortcut(repositoryId, folderId, toFileEntryId, serviceContext); AssetPublisherUtil.addAndStoreSelection( actionRequest, DLFileShortcut.class.getName(), fileShortcut.getFileShortcutId(), -1); } else { // Update file shortcut DLAppServiceUtil.updateFileShortcut(fileShortcutId, folderId, toFileEntryId, serviceContext); AssetPublisherUtil.addRecentFolderId(actionRequest, DLFileShortcut.class.getName(), folderId); } }
public Role editRole(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { long roleId = ParamUtil.getLong(actionRequest, "roleId"); String name = ParamUtil.getString(actionRequest, "name"); Map<Locale, String> titleMap = LocalizationUtil.getLocalizationMap(actionRequest, "title"); Map<Locale, String> descriptionMap = LocalizationUtil.getLocalizationMap(actionRequest, "description"); int type = ParamUtil.getInteger(actionRequest, "type", RoleConstants.TYPE_REGULAR); String subtype = ParamUtil.getString(actionRequest, "subtype"); ServiceContext serviceContext = ServiceContextFactory.getInstance(Role.class.getName(), actionRequest); if (roleId <= 0) { // Add role return RoleServiceUtil.addRole( null, 0, name, titleMap, descriptionMap, type, subtype, serviceContext); } else { // Update role return RoleServiceUtil.updateRole( roleId, name, titleMap, descriptionMap, subtype, serviceContext); } }
protected void moveEntries(ActionRequest actionRequest) throws Exception { long newFolderId = ParamUtil.getLong(actionRequest, "newFolderId"); ServiceContext serviceContext = ServiceContextFactory.getInstance(DLFileEntry.class.getName(), actionRequest); long[] folderIds = ParamUtil.getLongValues(actionRequest, "rowIdsFolder"); for (long folderId : folderIds) { _dlAppService.moveFolder(folderId, newFolderId, serviceContext); } long[] fileEntryIds = ParamUtil.getLongValues(actionRequest, "rowIdsFileEntry"); for (long fileEntryId : fileEntryIds) { _dlAppService.moveFileEntry(fileEntryId, newFolderId, serviceContext); } long[] fileShortcutIds = ParamUtil.getLongValues(actionRequest, "rowIdsDLFileShortcut"); for (long fileShortcutId : fileShortcutIds) { if (fileShortcutId == 0) { continue; } FileShortcut fileShortcut = _dlAppService.getFileShortcut(fileShortcutId); _dlAppService.updateFileShortcut( fileShortcutId, newFolderId, fileShortcut.getToFileEntryId(), serviceContext); } }
protected void unbanUser(ActionRequest actionRequest) throws Exception { long banUserId = ParamUtil.getLong(actionRequest, "banUserId"); ServiceContext serviceContext = ServiceContextFactory.getInstance(MBBan.class.getName(), actionRequest); MBBanServiceUtil.deleteBan(banUserId, serviceContext); }
protected void checkOutEntries(ActionRequest actionRequest) throws Exception { long[] fileEntryIds = ParamUtil.getLongValues(actionRequest, "rowIdsFileEntry"); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); for (long fileEntryId : fileEntryIds) { _dlAppService.checkOutFileEntry(fileEntryId, serviceContext); } }
protected void revertFileEntry(ActionRequest actionRequest) throws Exception { long fileEntryId = ParamUtil.getLong(actionRequest, "fileEntryId"); String version = ParamUtil.getString(actionRequest, "version"); ServiceContext serviceContext = ServiceContextFactory.getInstance(DLFileEntry.class.getName(), actionRequest); _dlAppService.revertFileEntry(fileEntryId, version, serviceContext); }
protected void moveFolder(ActionRequest actionRequest) throws Exception { long folderId = ParamUtil.getLong(actionRequest, "folderId"); long parentFolderId = ParamUtil.getLong(actionRequest, "parentFolderId"); ServiceContext serviceContext = ServiceContextFactory.getInstance(JournalFolder.class.getName(), actionRequest); JournalFolderServiceUtil.moveFolder(folderId, parentFolderId, serviceContext); }
public void leaveGroup(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); _userLocalService.unsetGroupUsers( themeDisplay.getScopeGroupId(), new long[] {themeDisplay.getUserId()}, serviceContext); }
public void processAction( ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest); String fileLogoParam = "file"; File file = uploadRequest.getFile(fileLogoParam); ServiceContext sc; try { sc = ServiceContextFactory.getInstance(this.getClass().getName(), actionRequest); // Make sure the uploaded images can be view by any one; sc.setAddCommunityPermissions(true); sc.setAddGuestPermissions(true); IGFolder folder = Functions.getIGFolder(sc); // String fileName = uploadRequest.getFileName(fileLogoParam); String contentType = uploadRequest.getContentType(fileLogoParam); IGImage image = IGImageLocalServiceUtil.addImage( sc.getUserId(), folder.getFolderId(), file.getName() + (new Time()).toString(), file.getName(), file, contentType, sc); HttpServletRequest servletRequest = PortalUtil.getHttpServletRequest(actionRequest); String res = image.getImageId() + "|" + ProGateUtil.getImageURL(image.getSmallImageId(), servletRequest) + "|" + ProGateUtil.getImageURL(image.getLargeImageId(), servletRequest); ProGateUtil.servletPrint(actionResponse, res); } catch (PortalException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SystemException se) { se.printStackTrace(); } catch (NullPointerException e2) { e2.printStackTrace(); } }
@Override protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { long structureId = ParamUtil.getLong(actionRequest, "structureId"); String version = ParamUtil.getString(actionRequest, "version"); ServiceContext serviceContext = ServiceContextFactory.getInstance(DDMStructure.class.getName(), actionRequest); _ddmStructureService.revertStructure(structureId, version, serviceContext); }
protected void updateEmailAddress(HttpServletRequest request) throws Exception { long userId = PortalUtil.getUserId(request); String password = AdminUtil.getUpdateUserPassword(request, userId); String emailAddress1 = ParamUtil.getString(request, "emailAddress1"); String emailAddress2 = ParamUtil.getString(request, "emailAddress2"); ServiceContext serviceContext = ServiceContextFactory.getInstance(request); UserServiceUtil.updateEmailAddress( userId, password, emailAddress1, emailAddress2, serviceContext); }
@Override public void processAction( ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { try { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long membershipRequestId = ParamUtil.getLong(actionRequest, "membershipRequestId"); int statusId = ParamUtil.getInteger(actionRequest, "statusId"); String replyComments = ParamUtil.getString(actionRequest, "replyComments"); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); MembershipRequestServiceUtil.updateStatus( membershipRequestId, replyComments, statusId, serviceContext); if (statusId == MembershipRequestConstants.STATUS_APPROVED) { MembershipRequest membershipRequest = MembershipRequestServiceUtil.getMembershipRequest(membershipRequestId); LiveUsers.joinGroup( themeDisplay.getCompanyId(), membershipRequest.getGroupId(), new long[] {membershipRequest.getUserId()}); } SessionMessages.add(actionRequest, "membership_reply_sent"); sendRedirect(actionRequest, actionResponse); } catch (Exception e) { if (e instanceof NoSuchGroupException || e instanceof PrincipalException) { SessionErrors.add(actionRequest, e.getClass()); setForward(actionRequest, "portlet.sites_admin.error"); } else if (e instanceof MembershipRequestCommentsException) { SessionErrors.add(actionRequest, e.getClass()); setForward(actionRequest, "portlet.sites_admin.reply_membership_request"); } else { throw e; } } }
public void moveEntries(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { long newFolderId = ParamUtil.getLong(actionRequest, "newFolderId"); long[] folderIds = StringUtil.split(ParamUtil.getString(actionRequest, "folderIds"), 0L); ServiceContext serviceContext = ServiceContextFactory.getInstance(JournalArticle.class.getName(), actionRequest); for (long folderId : folderIds) { _journalFolderService.moveFolder(folderId, newFolderId, serviceContext); } List<String> invalidArticleIds = new ArrayList<>(); ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); String[] articleIds = StringUtil.split(ParamUtil.getString(actionRequest, "articleIds")); for (String articleId : articleIds) { try { _journalArticleService.moveArticle( themeDisplay.getScopeGroupId(), HtmlUtil.unescape(articleId), newFolderId, serviceContext); } catch (InvalidDDMStructureException idse) { if (_log.isWarnEnabled()) { _log.warn(idse.getMessage()); } invalidArticleIds.add(articleId); } } if (!invalidArticleIds.isEmpty()) { StringBundler sb = new StringBundler(4); sb.append("Folder "); sb.append(newFolderId); sb.append(" does not allow the structures for articles: "); sb.append(StringUtil.merge(invalidArticleIds)); throw new InvalidDDMStructureException(sb.toString()); } sendEditEntryRedirect(actionRequest, actionResponse); }
public void postMembershipRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { long groupId = ParamUtil.getLong(actionRequest, "groupId"); String comments = ParamUtil.getString(actionRequest, "comments"); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); _membershipRequestService.addMembershipRequest(groupId, comments, serviceContext); SessionMessages.add(actionRequest, "membershipRequestSent"); addSuccessMessage(actionRequest, actionResponse); sendRedirect(actionRequest, actionResponse); }
protected DDMStructure copyStructure(ActionRequest actionRequest) throws Exception { long classPK = ParamUtil.getLong(actionRequest, "classPK"); Map<Locale, String> nameMap = LocalizationUtil.getLocalizationMap(actionRequest, "name"); ServiceContext serviceContext = ServiceContextFactory.getInstance(DDMStructure.class.getName(), actionRequest); DDMStructure structure = DDMStructureServiceUtil.copyStructure(classPK, nameMap, null, serviceContext); copyTemplates(actionRequest, classPK, structure.getStructureId()); return structure; }
protected void checkOutFileEntries(ActionRequest actionRequest) throws Exception { long fileEntryId = ParamUtil.getLong(actionRequest, "fileEntryId"); ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); if (fileEntryId > 0) { _dlAppService.checkOutFileEntry(fileEntryId, serviceContext); } else { long[] fileEntryIds = StringUtil.split(ParamUtil.getString(actionRequest, "fileEntryIds"), 0L); for (int i = 0; i < fileEntryIds.length; i++) { _dlAppService.checkOutFileEntry(fileEntryIds[i], serviceContext); } } }
protected void forwardCheckout( ActionRequest actionRequest, ActionResponse actionResponse, ShoppingOrder order) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); ShoppingCart cart = ShoppingUtil.getCart(actionRequest); ShoppingWebComponentProvider shoppingWebComponentProvider = ShoppingWebComponentProvider.getShoppingWebComponentProvider(); SettingsFactory settingsFactory = shoppingWebComponentProvider.getSettingsFactory(); ShoppingGroupServiceSettings shoppingGroupServiceSettings = settingsFactory.getSettings( ShoppingGroupServiceSettings.class, new GroupServiceSettingsLocator( themeDisplay.getScopeGroupId(), ShoppingConstants.SERVICE_NAME)); String returnURL = ShoppingUtil.getPayPalReturnURL( ((ActionResponseImpl) actionResponse).createActionURL(), order); String notifyURL = ShoppingUtil.getPayPalNotifyURL(themeDisplay); if (shoppingGroupServiceSettings.usePayPal()) { double total = ShoppingUtil.calculateTotal( cart.getItems(), order.getBillingState(), cart.getCoupon(), cart.getAltShipping(), cart.isInsure()); String redirectURL = ShoppingUtil.getPayPalRedirectURL( shoppingGroupServiceSettings, order, total, returnURL, notifyURL); actionResponse.sendRedirect(redirectURL); } else { ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest); ShoppingOrderLocalServiceUtil.sendEmail(order, "confirmation", serviceContext); actionResponse.sendRedirect(returnURL); } }
protected void expireEntries(ActionRequest actionRequest) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); long[] expireFolderIds = StringUtil.split(ParamUtil.getString(actionRequest, "folderIds"), 0L); ServiceContext serviceContext = ServiceContextFactory.getInstance(JournalArticle.class.getName(), actionRequest); for (long expireFolderId : expireFolderIds) { ActionUtil.expireFolder(themeDisplay.getScopeGroupId(), expireFolderId, serviceContext); } String[] expireArticleIds = StringUtil.split(ParamUtil.getString(actionRequest, "articleIds")); for (String expireArticleId : expireArticleIds) { ActionUtil.expireArticle(actionRequest, expireArticleId); } }
public void addAttachment(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(actionRequest); String portletId = PortalUtil.getPortletId(actionRequest); long resourcePrimKey = ParamUtil.getLong(uploadPortletRequest, "resourcePrimKey"); String dirName = ParamUtil.getString(uploadPortletRequest, "dirName"); File file = uploadPortletRequest.getFile("file"); String fileName = uploadPortletRequest.getFileName("file"); ServiceContext serviceContext = ServiceContextFactory.getInstance(KBArticle.class.getName(), actionRequest); KBArticleServiceUtil.addAttachment( portletId, resourcePrimKey, dirName, fileName, FileUtil.getBytes(file), serviceContext); }