[gradebook2-dev] GB2 Refactor Question - ImportExportUtility
Thomas Amsler
tpamsler at ucdavis.edu
Mon Jun 28 13:34:11 PDT 2010
Duffy,
Could you provide such a patch against trunk?
Best,
-- Thomas
On Mon, Jun 28, 2010 at 1:07 PM, Duffy Gillman <duffy at rsmart.com> wrote:
> Hey folks,
>
> I've attached a diff against the GB2 1.1.2 codebase for your inspection
> and/or inclusion. Here is a summary of the changes:
>
> In ImportExportUtility:
>
> 1) refactored and changed signature of exportGradebook(...)
> - this method now prepares a RawFile object and makes no output
> - this is now called by either exportGradebookCSV or exportGradebookXLS
> - setting of response headers and generating filename have been pushed
> up to the client objects which call upon ImportExportUtility
> 2) removed the private methods createXLS97File() and createCSVFile(); their
> function has been moved into the two methods below
> 3) created exportGradebookXLS() and exportGradebookCSV(); these are now
> public and should be called where client objects previsously called
> exportGradebook()
>
> In ImportHandler (all in doGet(...)):
>
> 1) Now contains conditional logic to handle xls or csv file export
> 2) Prepends headers to response before calling ImportExportUtility
> 3) calls either exportGradebookCSV() or exportGradebookXLS depending on
> fileType parameter
>
> In GradebookExportController:
>
> 1) see changes made to ImportHandler
>
> * * *
>
> Thanks for supporting this change. Let me know if there is a better way
> for me to submit the modifications, or if there are any tweaks to this
> refactor which ought to be made.
>
> Thanks.
>
> Duffy
>
>
>
>
>
> On Jun 25, 2010, at 11:33 PM, Thomas Amsler wrote:
>
> This makes sense.
>> +1
>>
>> -- Thomas
>> On Fri, Jun 25, 2010 at 1:41 PM, Jon Gorrono <jpgorrono at ucdavis.edu>
>> wrote:
>> Hi, Duffy.
>>
>> Thomas Amsler is the project lead now that James is gone. There is
>> also a collab mailing list: gradebook2-dev at collab.sakaiproject.org...
>>
>> Seems like a reasonable modification... the exportGradebook method
>> already takes a Printwriter param, but it is not used. I suspect that
>> the HttpServletResponse was added later in order to set the Headers
>> for download filetype... but this could be done in two steps, with
>> your server process accessing 'in-between'
>>
>> I'll let other chime in but I would vote for you do go ahead as you say...
>>
>> On Fri, Jun 25, 2010 at 12:43 PM, Duffy Gillman <duffy at rsmart.com> wrote:
>> > Jon,
>> >
>> > I'm not sure to whom I should direct this question. I hope you don't
>> mind
>> > me starting with you. Please let me know if I need to bug someone else.
>> ;)
>> >
>> > I'm trying to build a Quartz job that will loop through all existing
>> > Gradebooks and export them. Looking at the GB2 code it appears my only
>> > option is to work through a Servlet. The ImportExportUtility class
>> which
>> > produces Excel and CSV files expects an HttpResponse object into which
>> it
>> > will stream the file content as the export is generated. It looks like
>> it
>> > would be a very simple matter to refactor the export routine to take a
>> > generic IO class (either PrintWriter or OutputStream) so that it would
>> be
>> > possible to generate grade dumps on the server side. The existing
>> > exportGradebook(...) method could simply call the new method, or the
>> > Servlet-specific code (getting an OutputStream from the HttpResponse,
>> > setting headers, etc.) could be bumped up into whatever code calls
>> > exportGradebook(...)
>> >
>> > Would this be a useful modification that I should contribute back?
>> >
>> > Please let me know.
>> >
>> >
>> > Thanks,
>> >
>> > Duffy
>> >
>> >
>>
>>
>>
>> --
>> Jon Gorrono
>> PGP Key: 0x5434509D -
>> http{pgp.mit.edu:11371/pks/lookup?search=0x5434509D&op=index}
>> GSWoT Introducer - {GSWoT:US75 5434509D Jon P. Gorrono <jpgorrono -
>> gswot.org>}
>> http{ats.ucdavis.edu}
>> _______________________________________________
>> gradebook2-dev mailing list
>> gradebook2-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/gradebook2-dev
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/gradebook2-dev/attachments/20100628/f16e901e/attachment.html
More information about the gradebook2-dev
mailing list