Planned maintenance is scheduled for the week of June 15th - the exact date and time will be announced soon.
See More Details
Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Error after update. Velocity.
Jamie Sammons, geändert vor 4 Jahren.
Regular Member
Beiträge: 158
Beitrittsdatum: 12.12.11
Neueste Beiträge
Hi!
#set($assetEntryLocalService = $serviceLocator.findService("com.liferay.portlet.asset.service.AssetEntryLocalService"))
#set($assetEntryQuery = $portal.getClass().forName('com.liferay.portlet.asset.service.persistence.AssetEntryQuery').newInstance())
#set($V = $assetEntryQuery.setAttribute("isNews", true))
#set($V = $assetEntryQuery.setAttribute('startDate', $startDate))
#set($V = $assetEntryQuery.setAttribute('endDate', $endDate))
#set($V = $assetEntryQuery.setAnyCategoryIds($getterUtil.getLong($categoryId.getData())))
#set($V = $assetEntryQuery.setOrderByCol1('expirationDate'))
#set($V = $assetEntryQuery.setOrderByType1('ASC'))
#set($V = $assetEntryQuery.setOrderByCol2('title'))
#set($V = $assetEntryQuery.setOrderByType2('ASC'))
#set($eventCount = $assetEntryLocalService.getEntriesCount($assetEntryQuery))
#set($entries = $assetEntryLocalService.getEntries($assetEntryQuery))
${entries.size()}
This piece of code worked in Liferay 6.2 GA3
But he doesn't
want to work in 6.2 GA6 in any way, after updating the version
Will not throw errors. It just writes the name of the variable "$
{entries.size ()}" in the browser.
Any ideas please?
ildar sl, geändert vor 4 Jahren.
Regular Member
Beiträge: 158
Beitrittsdatum: 12.12.11
Neueste Beiträge
<#assign
assetEntryLocalService = serviceLocator.findService("com.liferay.portlet.asset.service.AssetEntryLocalService")
assetEntryQuery = objectUtil('com.liferay.portlet.asset.service.persistence.AssetEntryQuery')
V = assetEntryQuery.setAttribute("isNews", true)
V = assetEntryQuery.setAttribute('startDate', startDate?date)
V = assetEntryQuery.setAttribute('endDate', endDate?date)
V = assetEntryQuery.setAnyCategoryIds([getterUtil.getLong(categoryId.getData())])
V = assetEntryQuery.setOrderByCol1('expirationDate')
V = assetEntryQuery.setOrderByType1('ASC')
V = assetEntryQuery.setOrderByCol2('title')
V = assetEntryQuery.setOrderByType2('ASC')
eventCount = assetEntryLocalService.getEntriesCount(assetEntryQuery)
entries = assetEntryLocalService.getEntries(assetEntryQuery)
/>
it almost works like that. But date limitation doesn't work
ildar sl, geändert vor 4 Jahren.
Regular Member
Beiträge: 158
Beitrittsdatum: 12.12.11
Neueste Beiträge
Calendar startDate = Calendar.getInstance();
startDate.add(Calendar.MONTH, -8);
Calendar endDate = Calendar.getInstance();
endDate.add(Calendar.MONTH, -1);
System.out.println(startDate.getTime());
System.out.println(endDate.getTime());
DynamicQuery dynamicQuery2 =
DynamicQueryFactoryUtil.forClass(AssetEntry.class, PortalClassLoaderUtil.getClassLoader());
dynamicQuery2.add(PropertyFactoryUtil.forName("groupId").eq(themeDisplay.getScopeGroupId()));
dynamicQuery2.add(RestrictionsFactoryUtil.between("createDate", startDate.getTime(),endDate.getTime()));
dynamicQuery2.addOrder(OrderFactoryUtil.asc("createDate"));
Remained only assetEntryQuery.setAnyCategoryIds([getterUtil.getLong(categoryId.getData())])
Community
Company
Feedback