Last active
January 23, 2025 05:43
-
-
Save CorneAussems/7951319 to your computer and use it in GitHub Desktop.
Groovy Liferay Regenerate All Thumbnail Images
This file contains hidden or 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
| ############### two scripts inside ####### | |
| ############### One group only ############## | |
| import com.liferay.portlet.documentlibrary.util.* | |
| import com.liferay.portlet.documentlibrary.lar.* | |
| import com.liferay.portlet.documentlibrary.service.* | |
| import com.liferay.portal.service.* | |
| import com.liferay.portlet.documentlibrary.model.* | |
| import com.liferay.portal.kernel.dao.orm.* | |
| try{ | |
| ######## get groupID from Site detail ########## | |
| groupId = | |
| allFiles = DLAppServiceUtil.getGroupFileEntries(groupId, 0, QueryUtil.ALL_POS, QueryUtil.ALL_POS) | |
| println('groupId='+groupId+'-'+QueryUtil.ALL_POS+'-'+QueryUtil.ALL_POS+' mountFolders'+allFiles) | |
| for(ii=0;ii<allFiles.size();ii++){ | |
| file = allFiles.get(ii) | |
| fileVersion = file.getFileVersion() | |
| println('file='+file.getTitle()+' fileVersion='+fileVersion.getTitle()+' verion='+fileVersion.getVersion()) | |
| ImageProcessorUtil.generateImages(fileVersion); | |
| } | |
| }catch ( e ){ | |
| println('Exception='+e) | |
| } | |
| ########## All groups #################### | |
| import com.liferay.portlet.documentlibrary.util.* | |
| import com.liferay.portlet.documentlibrary.lar.* | |
| import com.liferay.portlet.documentlibrary.service.* | |
| import com.liferay.portal.service.* | |
| import com.liferay.portlet.documentlibrary.model.* | |
| import com.liferay.portal.kernel.dao.orm.* | |
| try{ | |
| groups = GroupLocalServiceUtil.getGroups(QueryUtil.ALL_POS, QueryUtil.ALL_POS) | |
| for(i=0;i<groups.size();i++){ | |
| group = groups.get(i) | |
| groupId = group.getGroupId() | |
| allFiles = DLAppServiceUtil.getGroupFileEntries(groupId, 0, QueryUtil.ALL_POS, QueryUtil.ALL_POS) | |
| println('groupId='+groupId+'-'+QueryUtil.ALL_POS+'-'+QueryUtil.ALL_POS+' mountFolders'+allFiles) | |
| for(ii=0;ii<allFiles.size();ii++){ | |
| file = allFiles.get(ii) | |
| fileVersion = file.getFileVersion() | |
| println('file='+file.getTitle()+' fileVersion='+fileVersion.getTitle()+' verion='+fileVersion.getVersion()) | |
| // ImageProcessorUtil.hasImages(fileVersion) | |
| ImageProcessorUtil.generateImages(fileVersion); | |
| } | |
| } | |
| }catch ( e ){ | |
| println('Exception='+e) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment