Foros de discusión

How to get assets/webcontents between date intervals.

ruchi sharma, modificado hace 11 años.

How to get assets/webcontents between date intervals.

Junior Member Mensajes: 95 Fecha de incorporación: 24/03/11 Mensajes recientes
Hello
I want to display assets/webcontents between two dates.
And I was looking around the AssetEntryQuery their is no method from which I can get some result.
Could anyone outline the solution??how can I customise the AssetPublisher plugin ??
Any suggestions would be appreciated.
Thanks
Ruchi
thumbnail
Hitoshi Ozawa, modificado hace 11 años.

RE: How to get assets/webcontents between date intervals.

Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
Seems you'll have to customize asset publisher portlet. Which dates are you going to use? Create date, publish date, ....?
ruchi sharma, modificado hace 11 años.

RE: How to get assets/webcontents between date intervals.

Junior Member Mensajes: 95 Fecha de incorporación: 24/03/11 Mensajes recientes
Hi Hitoshi,

Yes I also thought so about customising the asset publisher ??
Well in my project with the help of hook, overiding of asset publisher jsps and configuration jsp is implemented earlier.
But I am not getting how should I modify the the AssetPubliser Query to get articles/assets/webcontent between two publishing date .
What class do I need to customise or anything else??

Thanks
Ruchi
thumbnail
Prakash Khanchandani, modificado hace 11 años.

RE: How to get assets/webcontents between date intervals.

Expert Mensajes: 329 Fecha de incorporación: 10/02/11 Mensajes recientes
I think you can create your own service classes and have a method which retrieves asset entries based on your logic. You can either use custom-sql or liferay's dynamicQuery API. And then call this method from the JSP in your assetPublisher hook.

Alternatively I think you can create the method in the JSP of your hook if you plan to use Dynamic Query (may be not the best practice emoticon )
ruchi sharma, modificado hace 11 años.

RE: How to get assets/webcontents between date intervals.

Junior Member Mensajes: 95 Fecha de incorporación: 24/03/11 Mensajes recientes
Thanks Prakash
I'll try to use dynamic query.

Regards
Ruchi
ruchi sharma, modificado hace 11 años.

RE: How to get assets/webcontents between date intervals.

Junior Member Mensajes: 95 Fecha de incorporación: 24/03/11 Mensajes recientes
Finally, I made it working with the dynamic query.
Below is the code snippet for those are also stuck in the same sort of problem,
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(AssetEntry.class);
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
Date date1 = dateFormat.parse("2007/09/26");
Date date2 = dateFormat.parse("2007/10/26");
Criterion criterion = null;
// this is used to get query between date interval
criterion = RestrictionsFactoryUtil.between("createDate",date1,date2);
dynamicQuery.add(criterion);
assetEntryList = AssetEntryLocalServiceUtil.dynamicQuery(dynamicQuery);
Hope this helps.
Regards
Ruchi
ruchi sharma, modificado hace 11 años.

RE: How to get assets/webcontents between date intervals.

Junior Member Mensajes: 95 Fecha de incorporación: 24/03/11 Mensajes recientes
Hello friends,
As i have posted the dynamic query for getting the webcontents between the date interval, which is working fine.
But I want to more stuff to do... dynamic query is not fullfilling my requiement. Is their anything else i can do??
I got the following forum
http://www.liferay.com/community/forums/-/message_boards/message/5208445
is their any proper documentation for implementing the overriding the default implementation as mentioned in the above forum.
After reading this forum its not clear to me where to keep the entries and the overridden classes.
Please let me know if anybody knows the answer.
Thanks
Ruchi
thumbnail
Prakash Khanchandani, modificado hace 11 años.

RE: How to get assets/webcontents between date intervals.

Expert Mensajes: 329 Fecha de incorporación: 10/02/11 Mensajes recientes
In that post he clearly mentions just above your comment:

A hook does not allow overriding core classes, only services. Therefore my solution is implemented using ext plugin. It consists of three files:


So it is EXT plugin that he is using.
ruchi sharma, modificado hace 11 años.

RE: How to get assets/webcontents between date intervals.

Junior Member Mensajes: 95 Fecha de incorporación: 24/03/11 Mensajes recientes
Hello Prakash
I did follow the forum i mentioned did everything mentioned in that
1- defining bean definations
2- overiding the the two class AssetEntryFinderImpl.java and AssetEntryQuery.java
and i have pretty much written the functions in AssetEntryQuery(getters and setters for date field)
and function (getArticlesBetweenDateInterval())for calling the custom query in AssetEntryFinderImpl.java .
But I am stuck how should i call the function from AssetEntryFinderImpl class.
(Normally for finder class we have local util class by which we call the functions defined in finder class, in my case how to do that)
What should I do?? any help??
Is their any documentation where I can find how to override the ext plugin and implement it??
Thanks
Ruchi
thumbnail
Prakash Khanchandani, modificado hace 11 años.

RE: How to get assets/webcontents between date intervals.

Expert Mensajes: 329 Fecha de incorporación: 10/02/11 Mensajes recientes
1) Better would be to build a plugin portlet (instead of an EXT) with your custom services, custom-sql and finderImpl to retrieve what you want.
2) Put the my-portlet-service.jar which is generated when you build the service in the [tomcat-home]/lib/ext so that the methods can be accessed from anywhere within Liferay.
3) Deploy the portlet.
4) Create a hook to modify the JSPs to call the methods (MyPortletLocalServiceUtil.getWhatMyWantfFinderMethod()) from this my-portlet (you can also include the hook inside the my-portlet itself if you want).

For creating your own custom-sql and finders, you can refer to the following links:
1) Service Builder Finders
2) Custom sql step by step

Hope this helps.
ruchi sharma, modificado hace 11 años.

RE: How to get assets/webcontents between date intervals.

Junior Member Mensajes: 95 Fecha de incorporación: 24/03/11 Mensajes recientes
Hello Prakash,
Thanks for your help, and learned something new ... that was really helpful.
But I did it in other way around , as i have created the dynamic query , I created a method (which execute my dynamic query) in XlocalserviceImpl class and then built service .
As the result of build service I have got the method definations in XLocalServiceUtil class which is then I have used to call my method from jsp.
Regards
Ruchi
thumbnail
Prakash Khanchandani, modificado hace 11 años.

RE: How to get assets/webcontents between date intervals.

Expert Mensajes: 329 Fecha de incorporación: 10/02/11 Mensajes recientes
I am glad it helped. emoticon
ruchi sharma, modificado hace 11 años.

RE: How to get assets/webcontents between date intervals.

Junior Member Mensajes: 95 Fecha de incorporación: 24/03/11 Mensajes recientes
Hello Prakash ,
Can you please have a look at the following issue
http://www.liferay.com/community/forums/-/message_boards/message/13763983
If you know anything, it would be great??
thanks
Ruchi
thumbnail
Prakash Khanchandani, modificado hace 11 años.

RE: How to get assets/webcontents between date intervals.

Expert Mensajes: 329 Fecha de incorporación: 10/02/11 Mensajes recientes
When accessing this URL I get an error: "Message could not be found". Can you check if you have entered the correct URL.
ruchi sharma, modificado hace 11 años.

RE: How to get assets/webcontents between date intervals.

Junior Member Mensajes: 95 Fecha de incorporación: 24/03/11 Mensajes recientes
Prakash Khanchandani:
When accessing this URL I get an error: "Message could not be found". Can you check if you have entered the correct URL.


Sorry , can you please try this one emoticon
http://www.liferay.com/community/forums/-/message_boards/message/13768171
Thanks
Ruchi