Fórum

Journal Article added Programatically but not appearing in Content add pane

thumbnail
Abbas Malick, modificado 8 Anos atrás.

Journal Article added Programatically but not appearing in Content add pane

New Member Postagens: 21 Data de Entrada: 10/02/14 Postagens Recentes
Hi All,

I wrote a custom portlet to add a content after reading a bulk of file, Once the content is created , it does't appear in add panel nor it appears in the content view list. I checked the table from database , content fields being populated in the same way as content being created using standard liferay portlet. Below API I am using and here is code. Any one have experienced and can help ?

JournalArticle journal = JournalArticleLocalServiceUtil.addArticle(

themeDisplay.getUserId(),
themeDisplay.getLayout().getGroupId(),
0l, //classNameId
classNameId, //classPK
classPK, "", // articleId -> ne peut pas être null
true, //autoArticleId
1D, //version
titleMap, // hashmap titre défini au dessus
null, //descriptionMap
createdContentXml, // content en xml généré plus haut
"general", // type, ne peut pas être null ou vide
"", // structure de l'article, je ne sais pas si peut être null ou vide...
"", // template de l'article, je ne sais pas si peut être null ou vide...
themeDisplay.getLayout().getLayoutPrototypeUuid(), // layoutUuid
date.get(Calendar.MONTH), // |
date.get(Calendar.DAY_OF_MONTH), // |
date.get(Calendar.YEAR), // | --> displayDate
date.get(Calendar.HOUR), // |
date.get(Calendar.MINUTE), // |
0, // |
0, // |
0, // |--> expireDate, peut être null, vide ou 0 si neverExpire = true, sinon Attention aux contraintes!
0, // |
0, // |
true, // neverExpire
0, // |
0, // |
0, // |--> ReviewDate, peut être null, vide ou 0 si neverReview = true, sinon Attention aux contraintes!
0, // |
0, // |
true, // neverReview
true, // indexable
false, // smallImage
null, // null |
null, // null | ==> arguments concernant les images.
null, // null |
null, // null |
serviceContext //serviceContexte obligatoire, avec au moins scopeGroupId (= groupId de l'article)
);


Thanks
Abbas
thumbnail
Manish Yadav, modificado 8 Anos atrás.

RE: Journal Article added Programatically but not appearing in Content add

Expert Postagens: 493 Data de Entrada: 26/05/12 Postagens Recentes
Try to run indexing.

Might be its because of indexing issue
thumbnail
James Falkner, modificado 8 Anos atrás.

RE: Journal Article added Programatically but not appearing in Content add

Liferay Legend Postagens: 1399 Data de Entrada: 17/09/10 Postagens Recentes
You could also try to setup your serviceContext a bit before passing it in:

serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH) because without it I think the article ends up in Draft state. At least it did in 6.1.
thumbnail
Abbas Malick, modificado 8 Anos atrás.

RE: Journal Article added Programatically but not appearing in Content add

New Member Postagens: 21 Data de Entrada: 10/02/14 Postagens Recentes
Thanks Manish, Thanks James.
The issue get resolved by two below parameters

long classNameId =0l;//PortalUtil.getClassNameId(JournalArticleConstants.class) ;
long classPK = 0l;

I initilized them with 0 instead of getting their values from PortalUtil, and it works fine now. Dont know exactly whats the purpose of these. However new created content is appearing in add pane.


Thanks again for replying
Ghulam.