Changeset 268 for trunk/grails-app/controllers
- Timestamp:
- Jan 14, 2010, 10:51:03 PM (15 years ago)
- Location:
- trunk/grails-app/controllers
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/AssetSubItemController.groovy
r267 r268 1 1 import org.codehaus.groovy.grails.plugins.springsecurity.Secured 2 2 3 class Asset TypeController extends BaseAppAdminController {3 class AssetSubItemController extends BaseAppAdminController { 4 4 5 5 def index = { redirect(action:list,params:params) } … … 10 10 def list = { 11 11 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 12 [ asset TypeInstanceList: AssetType.list( params ), assetTypeInstanceTotal: AssetType.count() ]12 [ assetSubItemInstanceList: AssetSubItem.list( params ), assetSubItemInstanceTotal: AssetSubItem.count() ] 13 13 } 14 14 15 15 def show = { 16 def asset TypeInstance = AssetType.get( params.id )16 def assetSubItemInstance = AssetSubItem.get( params.id ) 17 17 18 if(!asset TypeInstance) {19 flash.message = "Asset Typenot found with id ${params.id}"18 if(!assetSubItemInstance) { 19 flash.message = "AssetSubItem not found with id ${params.id}" 20 20 redirect(action:list) 21 21 } 22 else { return [ asset TypeInstance : assetTypeInstance ] }22 else { return [ assetSubItemInstance : assetSubItemInstance ] } 23 23 } 24 24 25 25 def delete = { 26 def asset TypeInstance = AssetType.get( params.id )27 if(asset TypeInstance) {26 def assetSubItemInstance = AssetSubItem.get( params.id ) 27 if(assetSubItemInstance) { 28 28 try { 29 asset TypeInstance.delete(flush:true)30 flash.message = "Asset Type${params.id} deleted"29 assetSubItemInstance.delete(flush:true) 30 flash.message = "AssetSubItem ${params.id} deleted" 31 31 redirect(action:list) 32 32 } 33 33 catch(org.springframework.dao.DataIntegrityViolationException e) { 34 flash.message = "Asset Type${params.id} could not be deleted"34 flash.message = "AssetSubItem ${params.id} could not be deleted" 35 35 redirect(action:show,id:params.id) 36 36 } 37 37 } 38 38 else { 39 flash.message = "Asset Typenot found with id ${params.id}"39 flash.message = "AssetSubItem not found with id ${params.id}" 40 40 redirect(action:list) 41 41 } … … 43 43 44 44 def edit = { 45 def asset TypeInstance = AssetType.get( params.id )45 def assetSubItemInstance = AssetSubItem.get( params.id ) 46 46 47 if(!asset TypeInstance) {48 flash.message = "Asset Typenot found with id ${params.id}"47 if(!assetSubItemInstance) { 48 flash.message = "AssetSubItem not found with id ${params.id}" 49 49 redirect(action:list) 50 50 } 51 51 else { 52 return [ asset TypeInstance : assetTypeInstance ]52 return [ assetSubItemInstance : assetSubItemInstance ] 53 53 } 54 54 } 55 55 56 56 def update = { 57 def asset TypeInstance = AssetType.get( params.id )58 if(asset TypeInstance) {57 def assetSubItemInstance = AssetSubItem.get( params.id ) 58 if(assetSubItemInstance) { 59 59 if(params.version) { 60 60 def version = params.version.toLong() 61 if(asset TypeInstance.version > version) {61 if(assetSubItemInstance.version > version) { 62 62 63 asset TypeInstance.errors.rejectValue("version", "assetType.optimistic.locking.failure", "Another user has updated this AssetTypewhile you were editing.")64 render(view:'edit',model:[asset TypeInstance:assetTypeInstance])63 assetSubItemInstance.errors.rejectValue("version", "assetSubItem.optimistic.locking.failure", "Another user has updated this AssetSubItem while you were editing.") 64 render(view:'edit',model:[assetSubItemInstance:assetSubItemInstance]) 65 65 return 66 66 } 67 67 } 68 asset TypeInstance.properties = params69 if(!asset TypeInstance.hasErrors() && assetTypeInstance.save(flush: true)) {70 flash.message = "Asset Type${params.id} updated"71 redirect(action:show,id:asset TypeInstance.id)68 assetSubItemInstance.properties = params 69 if(!assetSubItemInstance.hasErrors() && assetSubItemInstance.save(flush: true)) { 70 flash.message = "AssetSubItem ${params.id} updated" 71 redirect(action:show,id:assetSubItemInstance.id) 72 72 } 73 73 else { 74 render(view:'edit',model:[asset TypeInstance:assetTypeInstance])74 render(view:'edit',model:[assetSubItemInstance:assetSubItemInstance]) 75 75 } 76 76 } 77 77 else { 78 flash.message = "Asset Typenot found with id ${params.id}"78 flash.message = "AssetSubItem not found with id ${params.id}" 79 79 redirect(action:list) 80 80 } … … 82 82 83 83 def create = { 84 def asset TypeInstance = new AssetType()85 asset TypeInstance.properties = params86 return ['asset TypeInstance':assetTypeInstance]84 def assetSubItemInstance = new AssetSubItem() 85 assetSubItemInstance.properties = params 86 return ['assetSubItemInstance':assetSubItemInstance] 87 87 } 88 88 89 89 def save = { 90 def asset TypeInstance = new AssetType(params)91 if(!asset TypeInstance.hasErrors() && assetTypeInstance.save(flush: true)) {92 flash.message = "Asset Type ${assetTypeInstance.id} created"93 redirect(action:show,id:asset TypeInstance.id)90 def assetSubItemInstance = new AssetSubItem(params) 91 if(!assetSubItemInstance.hasErrors() && assetSubItemInstance.save(flush: true)) { 92 flash.message = "AssetSubItem ${assetSubItemInstance.id} created" 93 redirect(action:show,id:assetSubItemInstance.id) 94 94 } 95 95 else { 96 render(view:'create',model:[asset TypeInstance:assetTypeInstance])96 render(view:'create',model:[assetSubItemInstance:assetSubItemInstance]) 97 97 } 98 98 } -
trunk/grails-app/controllers/ExtendedAttributeTypeController.groovy
r267 r268 1 1 import org.codehaus.groovy.grails.plugins.springsecurity.Secured 2 2 3 class AssetExtendedAttributeTypeController extends BaseAppAdminController {3 class ExtendedAttributeTypeController extends BaseAppAdminController { 4 4 5 5 def index = { redirect(action:list,params:params) } … … 10 10 def list = { 11 11 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 12 [ assetExtendedAttributeTypeInstanceList: AssetExtendedAttributeType.list( params ), assetExtendedAttributeTypeInstanceTotal: AssetExtendedAttributeType.count() ]12 [ extendedAttributeTypeInstanceList: ExtendedAttributeType.list( params ), extendedAttributeTypeInstanceTotal: ExtendedAttributeType.count() ] 13 13 } 14 14 15 15 def show = { 16 def assetExtendedAttributeTypeInstance = AssetExtendedAttributeType.get( params.id )16 def extendedAttributeTypeInstance = ExtendedAttributeType.get( params.id ) 17 17 18 if(! assetExtendedAttributeTypeInstance) {19 flash.message = " AssetExtendedAttributeType not found with id ${params.id}"18 if(!extendedAttributeTypeInstance) { 19 flash.message = "ExtendedAttributeType not found with id ${params.id}" 20 20 redirect(action:list) 21 21 } 22 else { return [ assetExtendedAttributeTypeInstance : assetExtendedAttributeTypeInstance ] }22 else { return [ extendedAttributeTypeInstance : extendedAttributeTypeInstance ] } 23 23 } 24 24 25 25 def delete = { 26 def assetExtendedAttributeTypeInstance = AssetExtendedAttributeType.get( params.id )27 if( assetExtendedAttributeTypeInstance) {26 def extendedAttributeTypeInstance = ExtendedAttributeType.get( params.id ) 27 if(extendedAttributeTypeInstance) { 28 28 try { 29 assetExtendedAttributeTypeInstance.delete(flush:true)30 flash.message = " AssetExtendedAttributeType ${params.id} deleted"29 extendedAttributeTypeInstance.delete(flush:true) 30 flash.message = "ExtendedAttributeType ${params.id} deleted" 31 31 redirect(action:list) 32 32 } 33 33 catch(org.springframework.dao.DataIntegrityViolationException e) { 34 flash.message = " AssetExtendedAttributeType ${params.id} could not be deleted"34 flash.message = "ExtendedAttributeType ${params.id} could not be deleted" 35 35 redirect(action:show,id:params.id) 36 36 } 37 37 } 38 38 else { 39 flash.message = " AssetExtendedAttributeType not found with id ${params.id}"39 flash.message = "ExtendedAttributeType not found with id ${params.id}" 40 40 redirect(action:list) 41 41 } … … 43 43 44 44 def edit = { 45 def assetExtendedAttributeTypeInstance = AssetExtendedAttributeType.get( params.id )45 def extendedAttributeTypeInstance = ExtendedAttributeType.get( params.id ) 46 46 47 if(! assetExtendedAttributeTypeInstance) {48 flash.message = " AssetExtendedAttributeType not found with id ${params.id}"47 if(!extendedAttributeTypeInstance) { 48 flash.message = "ExtendedAttributeType not found with id ${params.id}" 49 49 redirect(action:list) 50 50 } 51 51 else { 52 return [ assetExtendedAttributeTypeInstance : assetExtendedAttributeTypeInstance ]52 return [ extendedAttributeTypeInstance : extendedAttributeTypeInstance ] 53 53 } 54 54 } 55 55 56 56 def update = { 57 def assetExtendedAttributeTypeInstance = AssetExtendedAttributeType.get( params.id )58 if( assetExtendedAttributeTypeInstance) {57 def extendedAttributeTypeInstance = ExtendedAttributeType.get( params.id ) 58 if(extendedAttributeTypeInstance) { 59 59 if(params.version) { 60 60 def version = params.version.toLong() 61 if( assetExtendedAttributeTypeInstance.version > version) {61 if(extendedAttributeTypeInstance.version > version) { 62 62 63 assetExtendedAttributeTypeInstance.errors.rejectValue("version", "assetExtendedAttributeType.optimistic.locking.failure", "Another user has updated this AssetExtendedAttributeType while you were editing.")64 render(view:'edit',model:[ assetExtendedAttributeTypeInstance:assetExtendedAttributeTypeInstance])63 extendedAttributeTypeInstance.errors.rejectValue("version", "extendedAttributeType.optimistic.locking.failure", "Another user has updated this ExtendedAttributeType while you were editing.") 64 render(view:'edit',model:[extendedAttributeTypeInstance:extendedAttributeTypeInstance]) 65 65 return 66 66 } 67 67 } 68 assetExtendedAttributeTypeInstance.properties = params69 if(! assetExtendedAttributeTypeInstance.hasErrors() && assetExtendedAttributeTypeInstance.save(flush: true)) {70 flash.message = " AssetExtendedAttributeType ${params.id} updated"71 redirect(action:show,id: assetExtendedAttributeTypeInstance.id)68 extendedAttributeTypeInstance.properties = params 69 if(!extendedAttributeTypeInstance.hasErrors() && extendedAttributeTypeInstance.save(flush: true)) { 70 flash.message = "ExtendedAttributeType ${params.id} updated" 71 redirect(action:show,id:extendedAttributeTypeInstance.id) 72 72 } 73 73 else { 74 render(view:'edit',model:[ assetExtendedAttributeTypeInstance:assetExtendedAttributeTypeInstance])74 render(view:'edit',model:[extendedAttributeTypeInstance:extendedAttributeTypeInstance]) 75 75 } 76 76 } 77 77 else { 78 flash.message = " AssetExtendedAttributeType not found with id ${params.id}"78 flash.message = "ExtendedAttributeType not found with id ${params.id}" 79 79 redirect(action:list) 80 80 } … … 82 82 83 83 def create = { 84 def assetExtendedAttributeTypeInstance = new AssetExtendedAttributeType()85 assetExtendedAttributeTypeInstance.properties = params86 return [' assetExtendedAttributeTypeInstance':assetExtendedAttributeTypeInstance]84 def extendedAttributeTypeInstance = new ExtendedAttributeType() 85 extendedAttributeTypeInstance.properties = params 86 return ['extendedAttributeTypeInstance':extendedAttributeTypeInstance] 87 87 } 88 88 89 89 def save = { 90 def assetExtendedAttributeTypeInstance = new AssetExtendedAttributeType(params)91 if(! assetExtendedAttributeTypeInstance.hasErrors() && assetExtendedAttributeTypeInstance.save(flush: true)) {92 flash.message = " AssetExtendedAttributeType ${assetExtendedAttributeTypeInstance.id} created"93 redirect(action:show,id: assetExtendedAttributeTypeInstance.id)90 def extendedAttributeTypeInstance = new ExtendedAttributeType(params) 91 if(!extendedAttributeTypeInstance.hasErrors() && extendedAttributeTypeInstance.save(flush: true)) { 92 flash.message = "ExtendedAttributeType ${extendedAttributeTypeInstance.id} created" 93 redirect(action:show,id:extendedAttributeTypeInstance.id) 94 94 } 95 95 else { 96 render(view:'create',model:[ assetExtendedAttributeTypeInstance:assetExtendedAttributeTypeInstance])96 render(view:'create',model:[extendedAttributeTypeInstance:extendedAttributeTypeInstance]) 97 97 } 98 98 } -
trunk/grails-app/controllers/SectionController.groovy
r267 r268 1 1 import org.codehaus.groovy.grails.plugins.springsecurity.Secured 2 2 3 class S ystemSectionController extends BaseAppAdminController {3 class SectionController extends BaseAppAdminController { 4 4 5 5 def index = { redirect(action:list,params:params) } … … 10 10 def list = { 11 11 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 12 [ s ystemSectionInstanceList: SystemSection.list( params ), systemSectionInstanceTotal: SystemSection.count() ]12 [ sectionInstanceList: Section.list( params ), sectionInstanceTotal: Section.count() ] 13 13 } 14 14 15 15 def show = { 16 def s ystemSectionInstance = SystemSection.get( params.id )16 def sectionInstance = Section.get( params.id ) 17 17 18 if(!s ystemSectionInstance) {19 flash.message = "S ystemSection not found with id ${params.id}"18 if(!sectionInstance) { 19 flash.message = "Section not found with id ${params.id}" 20 20 redirect(action:list) 21 21 } 22 else { return [ s ystemSectionInstance : systemSectionInstance ] }22 else { return [ sectionInstance : sectionInstance ] } 23 23 } 24 24 25 25 def delete = { 26 def s ystemSectionInstance = SystemSection.get( params.id )27 if(s ystemSectionInstance) {26 def sectionInstance = Section.get( params.id ) 27 if(sectionInstance) { 28 28 try { 29 s ystemSectionInstance.delete(flush:true)30 flash.message = "S ystemSection ${params.id} deleted"29 sectionInstance.delete(flush:true) 30 flash.message = "Section ${params.id} deleted" 31 31 redirect(action:list) 32 32 } 33 33 catch(org.springframework.dao.DataIntegrityViolationException e) { 34 flash.message = "S ystemSection ${params.id} could not be deleted"34 flash.message = "Section ${params.id} could not be deleted" 35 35 redirect(action:show,id:params.id) 36 36 } 37 37 } 38 38 else { 39 flash.message = "S ystemSection not found with id ${params.id}"39 flash.message = "Section not found with id ${params.id}" 40 40 redirect(action:list) 41 41 } … … 43 43 44 44 def edit = { 45 def s ystemSectionInstance = SystemSection.get( params.id )45 def sectionInstance = Section.get( params.id ) 46 46 47 if(!s ystemSectionInstance) {48 flash.message = "S ystemSection not found with id ${params.id}"47 if(!sectionInstance) { 48 flash.message = "Section not found with id ${params.id}" 49 49 redirect(action:list) 50 50 } 51 51 else { 52 return [ s ystemSectionInstance : systemSectionInstance ]52 return [ sectionInstance : sectionInstance ] 53 53 } 54 54 } 55 55 56 56 def update = { 57 def s ystemSectionInstance = SystemSection.get( params.id )58 if(s ystemSectionInstance) {57 def sectionInstance = Section.get( params.id ) 58 if(sectionInstance) { 59 59 if(params.version) { 60 60 def version = params.version.toLong() 61 if(s ystemSectionInstance.version > version) {61 if(sectionInstance.version > version) { 62 62 63 s ystemSectionInstance.errors.rejectValue("version", "systemSection.optimistic.locking.failure", "Another user has updated this SystemSection while you were editing.")64 render(view:'edit',model:[s ystemSectionInstance:systemSectionInstance])63 sectionInstance.errors.rejectValue("version", "section.optimistic.locking.failure", "Another user has updated this Section while you were editing.") 64 render(view:'edit',model:[sectionInstance:sectionInstance]) 65 65 return 66 66 } 67 67 } 68 s ystemSectionInstance.properties = params69 if(!s ystemSectionInstance.hasErrors() && systemSectionInstance.save(flush: true)) {70 flash.message = "S ystemSection ${params.id} updated"71 redirect(action:show,id:s ystemSectionInstance.id)68 sectionInstance.properties = params 69 if(!sectionInstance.hasErrors() && sectionInstance.save(flush: true)) { 70 flash.message = "Section ${params.id} updated" 71 redirect(action:show,id:sectionInstance.id) 72 72 } 73 73 else { 74 render(view:'edit',model:[s ystemSectionInstance:systemSectionInstance])74 render(view:'edit',model:[sectionInstance:sectionInstance]) 75 75 } 76 76 } 77 77 else { 78 flash.message = "S ystemSection not found with id ${params.id}"78 flash.message = "Section not found with id ${params.id}" 79 79 redirect(action:list) 80 80 } … … 82 82 83 83 def create = { 84 def s ystemSectionInstance = new SystemSection()85 s ystemSectionInstance.properties = params86 return ['s ystemSectionInstance':systemSectionInstance]84 def sectionInstance = new Section() 85 sectionInstance.properties = params 86 return ['sectionInstance':sectionInstance] 87 87 } 88 88 89 89 def save = { 90 def s ystemSectionInstance = new SystemSection(params)91 if(!s ystemSectionInstance.hasErrors() && systemSectionInstance.save(flush: true)) {92 flash.message = "S ystemSection ${systemSectionInstance.id} created"93 redirect(action:show,id:s ystemSectionInstance.id)90 def sectionInstance = new Section(params) 91 if(!sectionInstance.hasErrors() && sectionInstance.save(flush: true)) { 92 flash.message = "Section ${sectionInstance.id} created" 93 redirect(action:show,id:sectionInstance.id) 94 94 } 95 95 else { 96 render(view:'create',model:[s ystemSectionInstance:systemSectionInstance])96 render(view:'create',model:[sectionInstance:sectionInstance]) 97 97 } 98 98 } -
trunk/grails-app/controllers/SectionDetailedController.groovy
r267 r268 1 1 import org.codehaus.groovy.grails.plugins.springsecurity.Secured 2 2 3 class S ystemSectionDetailedController extends BaseController {3 class SectionDetailedController extends BaseController { 4 4 5 5 def index = { redirect(action:list,params:params) } … … 10 10 def list = { 11 11 params.max = Math.min( params.max ? params.max.toInteger() : 10, 100) 12 [ s ystemSectionInstanceList: SystemSection.list( params ), systemSectionInstanceTotal: SystemSection.count() ]12 [ sectionInstanceList: Section.list( params ), sectionInstanceTotal: Section.count() ] 13 13 } 14 14 15 15 def show = { 16 def s ystemSectionInstance = SystemSection.get( params.id )16 def sectionInstance = Section.get( params.id ) 17 17 18 if(!s ystemSectionInstance) {19 flash.message = "S ystemSection not found with id ${params.id}"18 if(!sectionInstance) { 19 flash.message = "Section not found with id ${params.id}" 20 20 redirect(action:list) 21 21 } 22 else { return [ s ystemSectionInstance : systemSectionInstance ] }22 else { return [ sectionInstance : sectionInstance ] } 23 23 } 24 24 25 25 def delete = { 26 def s ystemSectionInstance = SystemSection.get( params.id )27 if(s ystemSectionInstance) {26 def sectionInstance = Section.get( params.id ) 27 if(sectionInstance) { 28 28 try { 29 s ystemSectionInstance.delete(flush:true)30 flash.message = "S ystemSection ${params.id} deleted"29 sectionInstance.delete(flush:true) 30 flash.message = "Section ${params.id} deleted" 31 31 redirect(action:list) 32 32 } 33 33 catch(org.springframework.dao.DataIntegrityViolationException e) { 34 flash.message = "S ystemSection ${params.id} could not be deleted"34 flash.message = "Section ${params.id} could not be deleted" 35 35 redirect(action:show,id:params.id) 36 36 } 37 37 } 38 38 else { 39 flash.message = "S ystemSection not found with id ${params.id}"39 flash.message = "Section not found with id ${params.id}" 40 40 redirect(action:list) 41 41 } … … 43 43 44 44 def edit = { 45 def s ystemSectionInstance = SystemSection.get( params.id )45 def sectionInstance = Section.get( params.id ) 46 46 47 if(!s ystemSectionInstance) {48 flash.message = "S ystemSection not found with id ${params.id}"47 if(!sectionInstance) { 48 flash.message = "Section not found with id ${params.id}" 49 49 redirect(action:list) 50 50 } 51 51 else { 52 return [ s ystemSectionInstance : systemSectionInstance ]52 return [ sectionInstance : sectionInstance ] 53 53 } 54 54 } 55 55 56 56 def update = { 57 def s ystemSectionInstance = SystemSection.get( params.id )58 if(s ystemSectionInstance) {57 def sectionInstance = Section.get( params.id ) 58 if(sectionInstance) { 59 59 if(params.version) { 60 60 def version = params.version.toLong() 61 if(s ystemSectionInstance.version > version) {61 if(sectionInstance.version > version) { 62 62 63 s ystemSectionInstance.errors.rejectValue("version", "systemSection.optimistic.locking.failure", "Another user has updated this SystemSection while you were editing.")64 render(view:'edit',model:[s ystemSectionInstance:systemSectionInstance])63 sectionInstance.errors.rejectValue("version", "section.optimistic.locking.failure", "Another user has updated this Section while you were editing.") 64 render(view:'edit',model:[sectionInstance:sectionInstance]) 65 65 return 66 66 } 67 67 } 68 s ystemSectionInstance.properties = params69 if(!s ystemSectionInstance.hasErrors() && systemSectionInstance.save(flush: true)) {70 flash.message = "S ystemSection ${params.id} updated"71 redirect(action:show,id:s ystemSectionInstance.id)68 sectionInstance.properties = params 69 if(!sectionInstance.hasErrors() && sectionInstance.save(flush: true)) { 70 flash.message = "Section ${params.id} updated" 71 redirect(action:show,id:sectionInstance.id) 72 72 } 73 73 else { 74 render(view:'edit',model:[s ystemSectionInstance:systemSectionInstance])74 render(view:'edit',model:[sectionInstance:sectionInstance]) 75 75 } 76 76 } 77 77 else { 78 flash.message = "S ystemSection not found with id ${params.id}"78 flash.message = "Section not found with id ${params.id}" 79 79 redirect(action:list) 80 80 } … … 82 82 83 83 def create = { 84 def s ystemSectionInstance = new SystemSection()85 s ystemSectionInstance.properties = params86 return ['s ystemSectionInstance':systemSectionInstance]84 def sectionInstance = new Section() 85 sectionInstance.properties = params 86 return ['sectionInstance':sectionInstance] 87 87 } 88 88 89 89 def save = { 90 def s ystemSectionInstance = new SystemSection(params)91 if(!s ystemSectionInstance.hasErrors() && systemSectionInstance.save(flush: true)) {92 flash.message = "S ystemSection ${systemSectionInstance.id} created"93 redirect(action:show,id:s ystemSectionInstance.id)90 def sectionInstance = new Section(params) 91 if(!sectionInstance.hasErrors() && sectionInstance.save(flush: true)) { 92 flash.message = "Section ${sectionInstance.id} created" 93 redirect(action:show,id:sectionInstance.id) 94 94 } 95 95 else { 96 render(view:'create',model:[s ystemSectionInstance:systemSectionInstance])96 render(view:'create',model:[sectionInstance:sectionInstance]) 97 97 } 98 98 }
Note: See TracChangeset
for help on using the changeset viewer.