留言板
Adding Article via Web Service with Published Status
Chris Buley,修改在13 年前。
Adding Article via Web Service with Published Status
New Member 帖子: 4 加入日期: 10-10-21 最近的帖子
Using Liferay 6 with Tomcat Bundle.
I am successfully adding journal articles to my liferay system and then adding categories to the associated Asset. All of that is going well, and I am about 90% to where I need to be. One last stumbling block is how I can make the posted articles have a published status after I have added them rather than draft status. Any help would be greatly appreciated.
Here is the basic code snippet I am using:
I am successfully adding journal articles to my liferay system and then adding categories to the associated Asset. All of that is going well, and I am about 90% to where I need to be. One last stumbling block is how I can make the posted articles have a published status after I have added them rather than draft status. Any help would be greatly appreciated.
Here is the basic code snippet I am using:
ServiceContext context = new ServiceContext();
JournalArticleSoap newArticle = jasssSoap.addArticle(
groupId,
"", // articleId, or blank string if using auto
true, // autoArticleId?
title,
abstractText,
body,
"news", // type
"", // structureId
"", // templateId
cal.get(Calendar.MONTH), //displayDateMonthInt
cal.get(Calendar.DAY_OF_MONTH), //displayDateDayInt
cal.get(Calendar.YEAR), //displayDateYearInt
cal.get(Calendar.HOUR_OF_DAY), //displayDateHourInt
cal.get(Calendar.MINUTE), //displayDateMinuteInt
1, //expirationDateMonthInt
1, //expirationDateDayInt
1, //expirationDateYearInt
1, //expirationDateHourInt
1, //expirationDateMinuteInt
true, //neverExpireBool
1, //reviewDateMonthInt
1, //reviewDateDayInt
1, //reviewDateYearInt
1, //reviewDateHourInt
1, //reviewDateMinuteInt
true, //neverReview
true, //indexable
null, //articleUrl
context //serviceContextProbablyNull
);
AssetEntryServiceSoap aesssSoap = aesssLocator.getPortlet_Asset_AssetEntryService(generateUrl(userId, password,"Portlet_Asset_AssetEntryService"));
long[] categoryIds = new long[] {catId};
String[] tagNames = new String[0];
// This call is modeled on a call in AssetEntryLocalServiceImpl for just updating the cats
aesssSoap.updateEntry(
newArticle.getGroupId(),
"com.liferay.portlet.journal.model.JournalArticle",
newArticle.getResourcePrimKey(),
null, // classUuid
categoryIds,
tagNames,
true, // visible
null, // start date
null, // endDate
null, // publishDate
null, // expirationDate
null, // mimeType
null, // title
null, // description
null, // summary
null, // url
0, // height
0, // width
0, // priority
false //sync
);
Fabien Fabien,修改在12 年前。
RE: Adding Article via Web Service with Published Status
New Member 帖子: 5 加入日期: 11-5-17 最近的帖子
Hi.
I am actually having the same problem. Do you find an issue to published an article by webservice ?
Sincerely
I am actually having the same problem. Do you find an issue to published an article by webservice ?
Sincerely
Hitoshi Ozawa,修改在12 年前。
RE: Adding Article via Web Service with Published Status
Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
The easiest way if you're not using workflow, is to just disable a workflow from the control panel.
Control Panel -> Workflor Configuration -> set Web Content to "Default: No workflow" and save the change.
Control Panel -> Workflor Configuration -> set Web Content to "Default: No workflow" and save the change.
Kousik Kumar Das,修改在11 年前。
RE: Adding Article via Web Service with Published Status
New Member 帖子: 7 加入日期: 11-5-9 最近的帖子
I'm working with LF 6.1.10 server, and have no workflow (kaleo) enabled.
While trying to publish the newly created article through webservice (soap api) implementation, its creating article with DRAFT status.
Code snippet, I tried:
Any help
While trying to publish the newly created article through webservice (soap api) implementation, its creating article with DRAFT status.
Code snippet, I tried:
articleSoap = journalArticleServiceSoap.addArticle(groupId, classNameId, classPK, articleId, autoArticleId, titleMapLanguageIds, titleMapValues, descriptionMapLanguageIds, descriptionMapValues, webContent, type, structureId, templateId, layoutUuid, displayDateMonth, displayDateDay, displayDateYear, displayDateHour, displayDateMinute, expirationDateMonth, expirationDateDay, expirationDateYear, expirationDateHour, expirationDateMinute, neverExpire, reviewDateMonth, reviewDateDay, reviewDateYear, reviewDateHour, reviewDateMinute, neverReview, indexable, articleURL, serviceContext);
articleSoap.setStatus(WorkflowConstants.STATUS_APPROVED);
articleSoap.setStatusByUserId(userId);
articleSoap.setStatusByUserName(username);
articleSoap.setStatusDate(GregorianCalendar.getInstance());
serviceContext.setUserId(userId);
serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH);
updateArticle(groupId, articleSoap.getArticleId(), new Double("1.0").doubleValue(), webContent, serviceContext);
Any help
Kousik Kumar Das,修改在11 年前。
RE: Adding Article via Web Service with Published Status
New Member 帖子: 7 加入日期: 11-5-9 最近的帖子
Here I made it to work !!!
All we need to prepare the ServiceContext properly before the call journalArticleServiceSoap.addArticle(...) method.
code:
The above bold line will create your journal article with APPROVED status.
Happy learning !!! folks !!!
All we need to prepare the ServiceContext properly before the call journalArticleServiceSoap.addArticle(...) method.
code:
ServiceContext serviceContext = new ServiceContext();
serviceContext.setAddGuestPermissions(true);
serviceContext.setAddGroupPermissions(true);
serviceContext.setScopeGroupId(groupId);
serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH);
The above bold line will create your journal article with APPROVED status.
Happy learning !!! folks !!!