Skip to content

Instantly share code, notes, and snippets.

@olivermt
Created March 6, 2012 12:30
Show Gist options
  • Select an option

  • Save olivermt/1986019 to your computer and use it in GitHub Desktop.

Select an option

Save olivermt/1986019 to your computer and use it in GitHub Desktop.
def doAddEntity() {
withStandard { StandardVersion standard ->
StandardEntity entity = new StandardEntity()
entity.initialPopulation(params.entity.name, params.entity.description, params.list("attribute.name"), params.list("attribute.description"), params.list("attribute.required"), params.list("attribute.dataType"), standard)
if (entity.validate()) {
entity.save(flush: true)
entity.updateEntityChildren(params.list('standardEntity.id'), params.list('standardEntity.required'), params.list('standardEntity.plurality'))
entity.updateEnumChildren(params.list('standardEnum.id'), params.list('standardEnum.required'),)
redirect(action: "showEntity", id: entity.id)
return
}
// println entity.errors
def model = populateEntityModel(standard)
model.standard = standard
model.entity = entity
render(view: "addEntity", model: model)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment