Index: trunk/src/grails-app/controllers/TaskModificationTypeController.groovy
===================================================================
--- trunk/src/grails-app/controllers/ModificationTypeController.groovy	(revision 89)
+++ trunk/src/grails-app/controllers/TaskModificationTypeController.groovy	(revision 93)
@@ -1,5 +1,5 @@
 import org.codehaus.groovy.grails.plugins.springsecurity.Secured
 
-class ModificationTypeController extends BaseController {
+class TaskModificationTypeController extends BaseController {
     
     def index = { redirect(action:list,params:params) }
@@ -9,27 +9,33 @@
 
     def list = {
-        if(!params.max) params.max = 10
-        [ modificationTypeInstanceList: ModificationType.list( params ) ]
+        params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
+        [ taskModificationTypeInstanceList: TaskModificationType.list( params ), taskModificationTypeInstanceTotal: TaskModificationType.count() ]
     }
 
     def show = {
-        def modificationTypeInstance = ModificationType.get( params.id )
+        def taskModificationTypeInstance = TaskModificationType.get( params.id )
 
-        if(!modificationTypeInstance) {
-            flash.message = "ModificationType not found with id ${params.id}"
+        if(!taskModificationTypeInstance) {
+            flash.message = "TaskModificationType not found with id ${params.id}"
             redirect(action:list)
         }
-        else { return [ modificationTypeInstance : modificationTypeInstance ] }
+        else { return [ taskModificationTypeInstance : taskModificationTypeInstance ] }
     }
 
     def delete = {
-        def modificationTypeInstance = ModificationType.get( params.id )
-        if(modificationTypeInstance) {
-            modificationTypeInstance.delete()
-            flash.message = "ModificationType ${params.id} deleted"
-            redirect(action:list)
+        def taskModificationTypeInstance = TaskModificationType.get( params.id )
+        if(taskModificationTypeInstance) {
+            try {
+                taskModificationTypeInstance.delete()
+                flash.message = "TaskModificationType ${params.id} deleted"
+                redirect(action:list)
+            }
+            catch(org.springframework.dao.DataIntegrityViolationException e) {
+                flash.message = "TaskModificationType ${params.id} could not be deleted"
+                redirect(action:show,id:params.id)
+            }
         }
         else {
-            flash.message = "ModificationType not found with id ${params.id}"
+            flash.message = "TaskModificationType not found with id ${params.id}"
             redirect(action:list)
         }
@@ -37,29 +43,38 @@
 
     def edit = {
-        def modificationTypeInstance = ModificationType.get( params.id )
+        def taskModificationTypeInstance = TaskModificationType.get( params.id )
 
-        if(!modificationTypeInstance) {
-            flash.message = "ModificationType not found with id ${params.id}"
+        if(!taskModificationTypeInstance) {
+            flash.message = "TaskModificationType not found with id ${params.id}"
             redirect(action:list)
         }
         else {
-            return [ modificationTypeInstance : modificationTypeInstance ]
+            return [ taskModificationTypeInstance : taskModificationTypeInstance ]
         }
     }
 
     def update = {
-        def modificationTypeInstance = ModificationType.get( params.id )
-        if(modificationTypeInstance) {
-            modificationTypeInstance.properties = params
-            if(!modificationTypeInstance.hasErrors() && modificationTypeInstance.save()) {
-                flash.message = "ModificationType ${params.id} updated"
-                redirect(action:show,id:modificationTypeInstance.id)
+        def taskModificationTypeInstance = TaskModificationType.get( params.id )
+        if(taskModificationTypeInstance) {
+            if(params.version) {
+                def version = params.version.toLong()
+                if(taskModificationTypeInstance.version > version) {
+                    
+                    taskModificationTypeInstance.errors.rejectValue("version", "taskModificationType.optimistic.locking.failure", "Another user has updated this TaskModificationType while you were editing.")
+                    render(view:'edit',model:[taskModificationTypeInstance:taskModificationTypeInstance])
+                    return
+                }
+            }
+            taskModificationTypeInstance.properties = params
+            if(!taskModificationTypeInstance.hasErrors() && taskModificationTypeInstance.save()) {
+                flash.message = "TaskModificationType ${params.id} updated"
+                redirect(action:show,id:taskModificationTypeInstance.id)
             }
             else {
-                render(view:'edit',model:[modificationTypeInstance:modificationTypeInstance])
+                render(view:'edit',model:[taskModificationTypeInstance:taskModificationTypeInstance])
             }
         }
         else {
-            flash.message = "ModificationType not found with id ${params.id}"
+            flash.message = "TaskModificationType not found with id ${params.id}"
             redirect(action:edit,id:params.id)
         }
@@ -67,17 +82,17 @@
 
     def create = {
-        def modificationTypeInstance = new ModificationType()
-        modificationTypeInstance.properties = params
-        return ['modificationTypeInstance':modificationTypeInstance]
+        def taskModificationTypeInstance = new TaskModificationType()
+        taskModificationTypeInstance.properties = params
+        return ['taskModificationTypeInstance':taskModificationTypeInstance]
     }
 
     def save = {
-        def modificationTypeInstance = new ModificationType(params)
-        if(!modificationTypeInstance.hasErrors() && modificationTypeInstance.save()) {
-            flash.message = "ModificationType ${modificationTypeInstance.id} created"
-            redirect(action:show,id:modificationTypeInstance.id)
+        def taskModificationTypeInstance = new TaskModificationType(params)
+        if(!taskModificationTypeInstance.hasErrors() && taskModificationTypeInstance.save()) {
+            flash.message = "TaskModificationType ${taskModificationTypeInstance.id} created"
+            redirect(action:show,id:taskModificationTypeInstance.id)
         }
         else {
-            render(view:'create',model:[modificationTypeInstance:modificationTypeInstance])
+            render(view:'create',model:[taskModificationTypeInstance:taskModificationTypeInstance])
         }
     }
