Created
March 11, 2014 05:31
-
-
Save iporsut/9480002 to your computer and use it in GitHub Desktop.
Add Liferay Article
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RenderMapping | |
public String main(RenderRequest request, RenderResponse response, Model model) throws SystemException, PortalException { | |
model.addAttribute("messages", messageToMDService.listMessageToMD()); | |
if (request.getRemoteUser() != null) { | |
User user = UserLocalServiceUtil.getUserById(Long.parseLong(request.getRemoteUser())); | |
ThemeDisplay themeDisplay= (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); | |
ServiceContext serviceContext = new ServiceContext(); | |
serviceContext.setScopeGroupId(themeDisplay.getScopeGroupId()); | |
JournalArticleLocalServiceUtil.addArticle( | |
themeDisplay.getUserId(), | |
themeDisplay.getScopeGroupId(), | |
"test", | |
true, | |
"ทดสอบภาษาไทย", | |
"Add Article from Programming", | |
"<h1>สวัสดี</h1>", | |
"general", | |
"", | |
"", | |
3, | |
11, | |
2014, | |
0, | |
0, | |
0, | |
0, | |
0, | |
0, | |
0, | |
true, | |
0, | |
0, | |
0, | |
0, | |
0, | |
true, | |
true, | |
false, | |
StringPool.BLANK, | |
null, | |
null, | |
StringPool.BLANK, | |
serviceContext); | |
System.out.println(user.getFullName()); | |
} | |
return "list"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment