Forum LAMS for Tech-Heads - General Forum: Getting organisationID after creating lesson


 
You may request notification for Getting organisationID after creating lesson.
Search: 

1: Getting organisationID after creating lesson
01/07/10 07:12 PM
[ Reply | Forward ]
Hello all,

I am working on an integration whereby LAMS invokes methods in a WCF service that I've written. One of the places I call this web service is when a new lesson is added by an Author or Monitor and have been able to get this invocation working using the Metro web services framework for J2EE.

I have added code to the initializeLesson() method in '/lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java'.

The methods called is as follows --> initializeLesson() --> createNewLesson() --> createNewLessonWithoutClass() --> saveLesson(). The OrganisationID is not passed in, yet the correct value IS saved in the database (lams_lesson table) once the lesson has been added.

After createNewLesson() is called, I am able to extract a number of properties from 'Lesson' object that I need for my web services call, such as LessonId, LearningDesignId, etc. However, I am not able to get the OrganisationId, despite trying several ways, such as:

- lesson.getLessonData.getOrganisationID()
- lesson.getLessonDetails.getOrganisationID()

If the OrganisationID doesn't appear to be passed in, how is it still saved in the database. Is there some other logic that is deriving the OrganisationID, just before it is commited to the database or indeed, done as an update?

Is there some other place I need to make this call or another approach to take to retrieve the OrganisationID from the Lesson object.

Please let me know if you need any clarifications.

Thanks and regards,
Praveen.

Posted by Praveen Pawar

2: Re: Getting organisationID after creating lesson
In response to 1 01/18/10 09:48 PM
[ Reply | Forward ]
Hi,

You can do lesson.getOrganisation().getOrganisationId() if lesson is a java org.lamsfoundation.lams.lesson.Lesson object.

Normally when a lesson is added by a Monitor via the Add Lesson wizard, the wizard (a flash movie) will pass in the organisation id to the LAMS InitializeLessonServlet. When a lesson is created in Author for previewing, no organisation id is saved (it doesn't make sense in this case to have an organisation).

Posted by Jun-Dir Liew

3: Re: Getting organisationID after creating lesson
In response to 1 01/18/10 09:49 PM
[ Reply | Forward ]
Hi Praveen

If you look at the access logs when you start a lesson, you will see there is actually several calls to the server - this is because lams needs to handle different class sizes and what not. So a sample log is like so:

115.64.23.19 - test1 [18/Jan/2010:21:56:37 -0600] "POST /lams/monitoring/initializeLesson HTTP/1.1" 200 299
115.64.23.19 - test1 [18/Jan/2010:21:56:37 -0600] "POST /lams/monitoring/createLessonClass?userID=5 HTTP/1.1" 200 298
115.64.23.19 - test1 [18/Jan/2010:21:56:37 -0600] "GET /lams/monitoring/monitoring.do?method=startLesson&lessonID=2&userID=5 HTTP/1.1" 200 297
115.64.23.19 - test1 [18/Jan/2010:21:56:39 -0600] "GET /lams/Presence.do?method=createXmppRoom&lessonId=2 HTTP/1.1" 200 301

The first call (initializeLesson) does not link the lesson to an organisation or class, its the second call (createLessonClass) that does so.

So I think the reason your not getting info about the organisation is because it hasnt been linked yet, try doing it after the second call, perhaps after "startLesson" is the best call.

Luke

Posted by Luke Foxton

Reply to first post on this page
Back to LAMS for Tech-Heads - General Forum