[Building Sakai] Web service and Samigo (repost)

Karen Tsao ktsao at stanford.edu
Mon Jul 12 17:16:19 PDT 2010


Hi Earle,

There is no API for you to use in current Samigo. You can either create a
JIRA under Samigo, or, if you would like to implement this yourself, you can
try to add overloaded methods with additional siteId parameter in following
places:

1. In AssessmentFacadeQueries.java, add overloaded methods
for*registerWithCurrentSite
* and *createAssessmentWithoutDefaultSection*.
2. In AssessmentService.java, add an overloaded method for *
createAssessmentWithoutDefaultSection*.
3. In AuthoringHelper.java, add an overloaded method for *
createImportedAssessment* .
4. In QTIService.java, add an overloaded method for *
createImportedAssessment*.

And now you can make a call to the new qtiService.createImportedAssessment.
Please let me know what you think.

Thanks,
Karen

On Mon, Jul 12, 2010 at 9:31 AM, Stephen Marquard <
stephen.marquard at uct.ac.za> wrote:

> Hi Earle,
>
> I don't know if there's a way around it in the current code, but generally
> speaking I'd consider referencing tool placement (and therefore site
> context) in service code to be a design flaw. I'd suggest filing a JIRA
> about it.
>
> Regards
> Stephen
>
> >>> Earle Nietzel <Earle.Nietzel at marist.edu> 7/12/2010 5:47 PM >>>
> Just sending this again since I sent it on the holiday weekend!
>
> Hi,
>
> I am trying to expose samlite via a web service but have run into an
> issue. I have combed over the code for half a day now and have not come up
> with a good solution so i need pick someone's brain.
>
> I have not located an api that allows you to import an assessment directly
> to a specific site in samigo, your location in sakai is managed via the
> servlets (tool placement id, url) and i can't duplicate that in a web
> service.
>
> Does anyone have any insight?
>
> Thanks for any help,
> Earle
>
> To help I am including the web service method as psuedo code:
>
>
>       public boolean createAssessment(String sessionid, String siteid,
> String siteproperty, String name, String description, String data) throws
> AxisFault {
>
>                Session session = establishSession(sessionid);
>
>                Site site = null;
>
>                if (siteproperty != null && siteproperty.length() > 0) {
>                        // find sakai site id using enterprise
> siteproperty=siteid
>                        site = findSite(siteproperty, siteid);
>                } else {
>                        try {
>                                // use siteid as the sakai site id
>                                site = SiteService.getSite(siteid);
>                        } catch (IdUnusedException ieu) {
>                                site = null;
>                        }
>                }
>
>                if (site != null) {
>                        //siteToolReference(site.getId(), "sakai.samigo");
>
>
>                        SamLiteService samLiteService = (SamLiteService)
> ComponentManager.get(SamLiteService.class);
>
>                        QuestionGroup questionGroup =
> samLiteService.parse(name, description, data);
>                        Document document =
> samLiteService.createDocument(questionGroup);
>
>                        QTIService qtiService = new QTIService();
>                        AssessmentFacade asessment =
> qtiService.createImportedAssessment(document, QTIVersion.VERSION_1_2,
> null, AssessmentTemplateFacade.DEFAULTTEMPLATE.toString());
>
>
>
> //EventTrackingService.post(EventTrackingService.newEvent("sam.assessment.create",
> "assessmentId=" + assessment.getAssessmentId(), true));
>                        return true;
>                } else {
>                        LOG.warn("WS SiteArchive.createAssessment(): Site
> not found - " + siteid);
>                        throw new AxisFault("WS
> SiteArchive.createAssessment(): Site not found - "+ siteid);
>                }
>        }
>
>
>
>
>
> ###
> UNIVERSITY OF CAPE TOWN
>
> This e-mail is subject to the UCT ICT policies and e-mail disclaimer
> published on our website at
> http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from
> +27 21 650 4500. This e-mail is intended only for the person(s) to whom it
> is addressed. If the e-mail has reached you in error, please notify the
> author. If you are not the intended recipient of the e-mail you may not use,
> disclose, copy, redirect or print the content. If this e-mail is not related
> to the business of UCT it is sent by the sender in the sender's individual
> capacity.
>
> ###
>
> _______________________________________________
> 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/20100712/7c92f90e/attachment.html 


More information about the sakai-dev mailing list