Skip to content

Instantly share code, notes, and snippets.

@CorneAussems
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CorneAussems/9923285 to your computer and use it in GitHub Desktop.
Save CorneAussems/9923285 to your computer and use it in GitHub Desktop.
import com.liferay.portal.service.ServiceContext
import com.liferay.portlet.journal.service.*
import com.liferay.portlet.journal.service.persistence.JournalArticleUtil
try {
// long companyId
companyId = 10155
// long groupId
groupId = 143401
// 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 = 'DETAILS-PAGE-STRUCTURE'
// 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
structures = JournalStructureLocalServiceUtil.getStructures(groupId );
for( i=0; i<structures.size();i++){
try{
structure = structures [i]
println('structure found:'+structure.getStructureId()+structure.getCreateDate()+structure.getUserName() );
} catch (Exception e) {
//println(e)
}
}
} catch (Exception e) {
println('Fatal Exception'+e)
}
####################### UPDATE STRUCTURE ID
import com.liferay.portal.service.ServiceContext
import com.liferay.portlet.journal.service.*
import com.liferay.portlet.journal.service.persistence.JournalArticleUtil
try {
// long groupId
groupId = 143401
str = JournalStructureLocalServiceUtil.getStructure(groupId,'DETAILS-PAGE-STRUCTURE' );
str.setStructureId("DETAILS-PAGE-STRUCTURE_WEG");
println('PK='+str.getPrimaryKey()+' structureId='+str.getStructureId()+' group'+str.getGroupId())
JournalStructureLocalServiceUtil.updateJournalStructure(str);
} 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