Foros de discusión

Journal Article added Programatically but not appearing in Content add pane

thumbnail
Abbas Malick, modificado hace 8 años.

Journal Article added Programatically but not appearing in Content add pane

New Member Mensajes: 21 Fecha de incorporación: 10/02/14 Mensajes recientes
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 hace 8 años.

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

Expert Mensajes: 493 Fecha de incorporación: 26/05/12 Mensajes recientes
Try to run indexing.

Might be its because of indexing issue
thumbnail
James Falkner, modificado hace 8 años.

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

Liferay Legend Mensajes: 1399 Fecha de incorporación: 17/09/10 Mensajes recientes
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 hace 8 años.

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

New Member Mensajes: 21 Fecha de incorporación: 10/02/14 Mensajes recientes
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.