praekelt/xforms-service — pull request #19 by skibz (2014-09-10 09:10:33+00:00)
Title: Rosafactory

this pull request consists of changes to the `rosafactory` class. it has been rewritten from scratch.
currently, it's able to iteratively append data to an xform.

**NB**: it doesn't yet support `select` or `select1` data types, and it's also likely that `rosafactory` will crash if you try to input a `string` type into a question that expects an `integer` type (for instance) but those fixes and additions are on the way.

`rosafactory` has been designed to be used as follows:

- initialise `rosafactory`.
- invoke `#setUp()` using a xform string.
- invoke `#answerQuestion()` to add data to the xform.
- serialise the `rosafactory` instance to a byte array using `#persist()`
- store the byte array in redis
- to answer more questions: we pull the byte array out of redis
- run `rosafactory#rebuild()` and then invoke `#setUp()` to restore the instance's state
- now we're free to continue where we left off, running `#answerQuestion()` to append data for the next question, for example.