[Building Sakai] Events

Steve Swinsburg steve.swinsburg at gmail.com
Wed Feb 24 21:40:47 PST 2010


Ah, I didn't even see that constructor:
newEvent

Event newEvent(String event,
               String resource,
               String context,
               boolean modify,
               int priority)
Construct a Event object.

Parameters:
event - The Event id.
resource - The resource reference.
context - The Event's context (may be null).
modify - Set to true if this event caused a resource modification, false if it was just an access.
priority - The Event's notification priority. Use NotificationService.NOTI_OPTIONAL as default.
Returns:
A new Event object that can be used with this service.

cheers,
Steve



On 25/02/2010, at 4:35 PM, Stephen Marquard wrote:

> In 2.6+, you can explicitly pass the context when posting the event.
> 
> Regards
> Stephen 
> 
>>>> Steve Swinsburg <steve.swinsburg at gmail.com> 2/25/2010 1:12 AM >>> 
> Hi Adrian,
> 
> It looks like it's set in BaseEvent which implements Event:
> 
> kernel-impl/src/main/java/org/sakaiproject/event/impl/BaseEventTrackingService.java
> 
> // Find the context using the reference (let the service that it belongs to parse it) 
> 			if (resource != null && !"".equals(resource)) {
> 				Reference ref = entityManager().newReference(resource);
> 				if (ref != null) {
> 					m_context = ref.getContext();
> 				}
> 			}
> 			
> 			// If we still need to find the context, try the tool placement 
> 			if (m_context == null) {
> 				Placement placement = toolManager().getCurrentPlacement();
> 				if (placement != null) {
> 					m_context = placement.getContext();
> 				}
> 			}
> 
> 
> So the context comes from either the entity reference or from the tool placement. I'll take a stab and assume you are working on events for the system wide chat? You probably don't have either so its null and SiteStats can't determine where they came from. Might need to extend Event to take a context parameter in its constructor, or run a regular quartz job over it to fix all of the null context events (any from <2.5 will be null also) so they can be collected in SiteStats.
> 
> cheers,
> Steve
> 
> 
> 
> On 25/02/2010, at 4:09 AM, Adrian Fish wrote:
> 
>> I'm hoping someone can shed some light on a little problem I'm having. The events generated by my tool (snigger) are getting rejected by site stats due to Event.getContext returning null.
>> 
>> Does anybody know how the EventTrackingService populates the context field in the Events that it creates?
>> 
>> Cheers,
>> 
>> Adrian.
>> 
>> -- 
>> ==================================
>> Adrian Fish
>> Software Engineer
>> Centre for e-Science
>> Bowland Tower South C Floor
>> Lancaster University
>> Lancaster
>> LA1 4YW
>> email: a.fish at lancaster.ac.uk
>> 
>> http://confluence.sakaiproject.org/display/YAFT/Yaft
>> http://confluence.sakaiproject.org/display/BLOG/Home
>> http://confluence.sakaiproject.org/display/AGORA/Home
>> 
>> <a_fish.vcf>_______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>> 
>> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20100225/4eaf7a56/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3689 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20100225/4eaf7a56/attachment.bin 


More information about the sakai-dev mailing list