Search in sources :

Example 56 with ServiceContext

use of com.liferay.portal.service.ServiceContext in project liferay-ide by liferay.

the class AdminPortlet method updateKBFolder.

public void updateKBFolder(ActionRequest actionRequest, ActionResponse actionResponse) throws PortalException, SystemException {
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
    long kbFolderId = ParamUtil.getLong(actionRequest, "kbFolderId");
    long parentResourceClassNameId = ParamUtil.getLong(actionRequest, "parentResourceClassNameId");
    long parentResourcePrimKey = ParamUtil.getLong(actionRequest, "parentResourcePrimKey");
    String name = ParamUtil.getString(actionRequest, "name");
    String description = ParamUtil.getString(actionRequest, "description");
    ServiceContext serviceContext = ServiceContextFactory.getInstance(KBFolder.class.getName(), actionRequest);
    if (cmd.equals(Constants.ADD)) {
        KBFolderServiceUtil.addKBFolder(themeDisplay.getScopeGroupId(), parentResourceClassNameId, parentResourcePrimKey, name, description, serviceContext);
    } else if (cmd.equals(Constants.UPDATE)) {
        KBFolderServiceUtil.updateKBFolder(parentResourceClassNameId, parentResourcePrimKey, kbFolderId, name, description);
    }
}
Also used : KBFolder(com.liferay.knowledgebase.model.KBFolder) ServiceContext(com.liferay.portal.service.ServiceContext) ThemeDisplay(com.liferay.portal.theme.ThemeDisplay)

Example 57 with ServiceContext

use of com.liferay.portal.service.ServiceContext in project liferay-ide by liferay.

the class MicroblogsPortlet method updateMicroblogsEntry.

public void updateMicroblogsEntry(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
    long microblogsEntryId = ParamUtil.getLong(actionRequest, "microblogsEntryId");
    String content = ParamUtil.getString(actionRequest, "content");
    int type = ParamUtil.getInteger(actionRequest, "type");
    long receiverUserId = ParamUtil.getLong(actionRequest, "receiverUserId");
    long receiverMicroblogsEntryId = ParamUtil.getLong(actionRequest, "receiverMicroblogsEntryId");
    int socialRelationType = ParamUtil.getInteger(actionRequest, "socialRelationType");
    ServiceContext serviceContext = ServiceContextFactory.getInstance(MicroblogsEntry.class.getName(), actionRequest);
    String[] assetTagNames = getAssetTagNames(content);
    serviceContext.setAssetTagNames(assetTagNames);
    if (microblogsEntryId > 0) {
        MicroblogsEntryServiceUtil.updateMicroblogsEntry(microblogsEntryId, content, socialRelationType, serviceContext);
    } else {
        MicroblogsEntryServiceUtil.addMicroblogsEntry(themeDisplay.getUserId(), content, type, receiverUserId, receiverMicroblogsEntryId, socialRelationType, serviceContext);
    }
}
Also used : MicroblogsEntry(com.liferay.microblogs.model.MicroblogsEntry) ServiceContext(com.liferay.portal.service.ServiceContext) ThemeDisplay(com.liferay.portal.theme.ThemeDisplay)

Aggregations

ServiceContext (com.liferay.portal.service.ServiceContext)57 User (com.liferay.portal.model.User)11 PrincipalException (com.liferay.portal.security.auth.PrincipalException)11 InputStream (java.io.InputStream)11 AlbumNameException (org.liferay.jukebox.AlbumNameException)9 ArtistNameException (org.liferay.jukebox.ArtistNameException)9 DuplicatedSongException (org.liferay.jukebox.DuplicatedSongException)9 SongNameException (org.liferay.jukebox.SongNameException)9 UploadPortletRequest (com.liferay.portal.kernel.upload.UploadPortletRequest)8 Song (org.liferay.jukebox.model.Song)8 ThemeDisplay (com.liferay.portal.theme.ThemeDisplay)7 Date (java.util.Date)7 SystemException (com.liferay.portal.kernel.exception.SystemException)6 FileEntry (com.liferay.portal.kernel.repository.model.FileEntry)6 PortalException (com.liferay.portal.kernel.exception.PortalException)5 JSONObject (com.liferay.portal.kernel.json.JSONObject)5 Artist (org.liferay.jukebox.model.Artist)5 Gadget (com.liferay.opensocial.model.Gadget)4 Folder (com.liferay.portal.kernel.repository.model.Folder)4 Element (com.liferay.portal.kernel.xml.Element)4