Note that there are some explanatory texts on larger screens.

plurals
  1. POChanging createDate on Liferay Journal Article (Web Content) via Liferay API
    text
    copied!<p>So here's the situation. I want to add 'old' news from our previous website in to an asset publisher portlet on our new Liferay 6.1 site. The problem is that I want them to show up as if I had added them in the past.</p> <p>So, I figure, how hard can it be to modify the <code>createDate</code>? I've since been able to directly access the MySQL database and perform updates on the article object's <code>createDate</code> field. However, it doesn't seem to propagate to my Liferay deployment, regardless of clearing caches, reindexing search indices, and restarting Liferay. The web content still maintains it's 'original' <code>createDate</code> even though the database shows it as the value I have changed it to.</p> <p>Here's the query I used:</p> <pre><code>mysql&gt; UPDATE JournalArticle SET createDate='2012-03-08 15:17:12' WHERE ArticleID = 16332; </code></pre> <p>I have since learned that it is a no-no to directly manipulate the database, as the dynamics of database/Liferay isn't as straight forward as Liferay performing lookups. So it looks like I might need to use the Liferay API, namely, <code>setCreateDate</code> as seen <a href="http://docs.liferay.com/portal/6.1/javadocs/com/liferay/portlet/journal/model/JournalArticleModel.html" rel="nofollow">here</a>.</p> <p>But I have absolutely no idea where and how to leverage the API. Do I need to create a dummy portlet with the sole purpose of using this API call? Or can I create a .java file somewhere on the server running my Liferay deployment and run it to leverage this method?</p> <p>I only have like 15 articles I need to do this to. I can find them by referencing the ArticleID and GroupID. </p> <p>Any help would be greatly appreciated. I've <code>grep</code>ped the Liferay deployment and found <code>setCreateDate</code> being used heavily within .java files inside the knowledge-base-portlet, but I can't tell how else to directly use them without creating a portlet.</p> <p>On the other hand, if anybody knows how to get my database to propagate it's changes to the Liferay deployment, even though I know it's a dirty hack, that would probably be the easiest.</p> <p>Thanks; I really appreciate it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload