ChrisM
ChrisM

Reputation: 2248

Grails XML upload

I am experimenting with Grails, and in my app I want to restrict things so that data is only entered 'in bulk' from an XML file (I know how to upload/parse the XML). How can I do this? Do I simply remove or overwrite create in the controller?

Upvotes: 0

Views: 398

Answers (1)

Jeff Beck
Jeff Beck

Reputation: 3938

If you want to restrict even single item creation then yes start by overwriting your create action and view. You will want to allow the user to upload the file from the create then have that form either submit back to the modified create action or to a new action such as bulkCreate that deals with the XML file.

When you are parsing the XML file to create the domain objects you may find these items helpful Using Attributes for Domain Objects and Groovy's XML Slurper

Another area to think about is how you are going to handle domain objects that don't validate will you load everything but the ones that don't validate or not load anything?

Upvotes: 1

Related Questions