留言板

Hook to catch polls expiration date

Ben Longi,修改在12 年前。

Hook to catch polls expiration date

New Member 帖子: 17 加入日期: 11-11-17 最近的帖子
Hi there,

I would like to grab poll results when expiration date happened ?

I thought of a wrapper service hook to extends checkEvents function to verify if an event for a poll is coming and if this event is an expiration date. But I'm not really sure I could achieve my goal like that...

Do you have an idea how I could achieve this ? Is there any way to intercept an expiration date event and process an action ?

Regards,
Benoit
thumbnail
Sandeep Nair,修改在12 年前。

RE: Hook to catch polls expiration date

Liferay Legend 帖子: 1744 加入日期: 08-11-6 最近的帖子
One of the options could be to create a scheduler and check every midnight for the same. More about how to create schedulers in liferay is here http://www.liferaying.com/job-scheduling-in-liferay-6/
Ben Longi,修改在12 年前。

RE: Hook to catch polls expiration date

New Member 帖子: 17 加入日期: 11-11-17 最近的帖子
Thank you, you're right It could work ! Issue is that it is not in live but we could accept that delay if nothing else is possible emoticon
thumbnail
Sandeep Nair,修改在12 年前。

RE: Hook to catch polls expiration date

Liferay Legend 帖子: 1744 加入日期: 08-11-6 最近的帖子
In that case if you want live data. You can create a small portlet which fetches polls those are expired using Dynamic query

Regards,
Sandeep
Ben Longi,修改在12 年前。

RE: Hook to catch polls expiration date

New Member 帖子: 17 加入日期: 11-11-17 最近的帖子
OK so to sum up I need to make a Scheduler (already done, It works fine !).
Then I need to inject CalEventLocalServiceUtil in order to make a dynamic query and grab the expired events.
In these events I need to figure out if they are poll event and if they are, process polls result.

Am I right ?
thumbnail
Sandeep Nair,修改在12 年前。

RE: Hook to catch polls expiration date

Liferay Legend 帖子: 1744 加入日期: 08-11-6 最近的帖子
Scheduler was just meant for fetching Polls, iterating over them and then filtering all the results whose expiry date is supposed to be today.

The second post was not related to scheduler at all. It was to fetch u data in real time. You could create a utility portlet which in background uses Dynamicy query to do the filtering.

I dont think Caleventlocalservice has anything to do with polls portlet. All the entities of polls can be found from portal-impl\src\com\liferay\portlet\polls\service.xml

You may want to look at PollsQuestion Entity which has expiryDate

Regards,
Sandeep
Ben Longi,修改在12 年前。

RE: Hook to catch polls expiration date

New Member 帖子: 17 加入日期: 11-11-17 最近的帖子
Sure It's what I just found. I'm trying to querying it.
I don't really understand the second option, you mean I will need to run this portlet manually when a poll expired ? Otherwise I don't know how It could work without the scheduler.

Thank you Sandeep !
thumbnail
Sandeep Nair,修改在12 年前。

RE: Hook to catch polls expiration date

Liferay Legend 帖子: 1744 加入日期: 08-11-6 最近的帖子
No the second option is a portlet that you will create which shows you the following.

1)Whenever you place the portlet it list all the poll questions that are expired --> To achieve this you will write a dynamic query on PollsQuestion table where expiredDate is current date

2) When user clicks on polls question you would show the result for that particular question -- See polls vote which has results for a particular question

Regards,
Sandeep