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);
}
}
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);
}
}
Aggregations