Created
April 2, 2014 09:06
-
-
Save CorneAussems/9930560 to your computer and use it in GitHub Desktop.
This file contains 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
import com.liferay.portal.service.ServiceContext | |
import com.liferay.portlet.journal.service.JournalArticleServiceUtil | |
import com.liferay.portlet.journal.service.persistence.JournalArticleUtil | |
try { | |
// long companyId | |
companyId = 10154 | |
// long groupId | |
groupId = 10192 | |
// long classNameId | |
classNameId = 0 | |
// java.lang.String articleId | |
articleId = null | |
// java.lang.Double version | |
version = null | |
// java.lang.String title | |
title = null | |
// java.lang.String description | |
description = null | |
// java.lang.String content | |
content = null | |
// java.lang.String type | |
type = null | |
// java.lang.String structureId | |
String structureId = 'LOCATIES' | |
// java.lang.String templateId | |
String templateId = '' | |
// java.util.Date displayDateGT | |
displayDateGT = null | |
// java.util.Date displayDateLT | |
displayDateLT = null | |
// int status | |
status = 0 | |
//java.util.Date reviewDate | |
reviewDate = null | |
// boolean andOperator | |
andOperator = true | |
// int start | |
start = -1 | |
// int end | |
end = -1 | |
// com.liferay.portal.kernel.util.OrderByComparator obc | |
obc = null | |
articles = JournalArticleServiceUtil.search(companyId,groupId,classNameId,articleId,version,title,description,content,type,structureId,templateId,displayDateGT,displayDateLT,status,reviewDate, andOperator,start,end,obc) | |
println('articles found:'+articles.size()) | |
sc = new com.liferay.portal.service.ServiceContext() | |
for( i=0; i<articles.size();i++){ | |
try{ | |
article = articles[i] | |
println('found:'+article.getArticleId()+' version:' +article.getVersion()+ article.getGroupId() + article.getUrlTitle()) | |
JournalArticleServiceUtil.updateContent(article.getGroupId(), article.getArticleId(), article.getVersion(), article.getContent()) | |
} catch (Exception e) { | |
//println(e) | |
} | |
article3 = JournalArticleServiceUtil.getLatestArticle(article.getResourcePrimKey()); | |
println('processed:'+article3.getArticleId()+' version:' +article.getVersion()) | |
} | |
} catch (Exception e) { | |
println('Fatal Exception'+e) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment