Ignore:
Timestamp:
Jan 14, 2010, 10:51:03 PM (14 years ago)
Author:
gav
Message:

Refactor classes for asset tree refinement.
Regenerate views and controllers to suite.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/ExtendedAttributeTypeController.groovy

    r267 r268  
    11import org.codehaus.groovy.grails.plugins.springsecurity.Secured
    22
    3 class AssetExtendedAttributeTypeController extends BaseAppAdminController {
     3class ExtendedAttributeTypeController extends BaseAppAdminController {
    44   
    55    def index = { redirect(action:list,params:params) }
     
    1010    def list = {
    1111        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() ]
    1313    }
    1414
    1515    def show = {
    16         def assetExtendedAttributeTypeInstance = AssetExtendedAttributeType.get( params.id )
     16        def extendedAttributeTypeInstance = ExtendedAttributeType.get( params.id )
    1717
    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}"
    2020            redirect(action:list)
    2121        }
    22         else { return [ assetExtendedAttributeTypeInstance : assetExtendedAttributeTypeInstance ] }
     22        else { return [ extendedAttributeTypeInstance : extendedAttributeTypeInstance ] }
    2323    }
    2424
    2525    def delete = {
    26         def assetExtendedAttributeTypeInstance = AssetExtendedAttributeType.get( params.id )
    27         if(assetExtendedAttributeTypeInstance) {
     26        def extendedAttributeTypeInstance = ExtendedAttributeType.get( params.id )
     27        if(extendedAttributeTypeInstance) {
    2828            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"
    3131                redirect(action:list)
    3232            }
    3333            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"
    3535                redirect(action:show,id:params.id)
    3636            }
    3737        }
    3838        else {
    39             flash.message = "AssetExtendedAttributeType not found with id ${params.id}"
     39            flash.message = "ExtendedAttributeType not found with id ${params.id}"
    4040            redirect(action:list)
    4141        }
     
    4343
    4444    def edit = {
    45         def assetExtendedAttributeTypeInstance = AssetExtendedAttributeType.get( params.id )
     45        def extendedAttributeTypeInstance = ExtendedAttributeType.get( params.id )
    4646
    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}"
    4949            redirect(action:list)
    5050        }
    5151        else {
    52             return [ assetExtendedAttributeTypeInstance : assetExtendedAttributeTypeInstance ]
     52            return [ extendedAttributeTypeInstance : extendedAttributeTypeInstance ]
    5353        }
    5454    }
    5555
    5656    def update = {
    57         def assetExtendedAttributeTypeInstance = AssetExtendedAttributeType.get( params.id )
    58         if(assetExtendedAttributeTypeInstance) {
     57        def extendedAttributeTypeInstance = ExtendedAttributeType.get( params.id )
     58        if(extendedAttributeTypeInstance) {
    5959            if(params.version) {
    6060                def version = params.version.toLong()
    61                 if(assetExtendedAttributeTypeInstance.version > version) {
     61                if(extendedAttributeTypeInstance.version > version) {
    6262                   
    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])
    6565                    return
    6666                }
    6767            }
    68             assetExtendedAttributeTypeInstance.properties = params
    69             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)
    7272            }
    7373            else {
    74                 render(view:'edit',model:[assetExtendedAttributeTypeInstance:assetExtendedAttributeTypeInstance])
     74                render(view:'edit',model:[extendedAttributeTypeInstance:extendedAttributeTypeInstance])
    7575            }
    7676        }
    7777        else {
    78             flash.message = "AssetExtendedAttributeType not found with id ${params.id}"
     78            flash.message = "ExtendedAttributeType not found with id ${params.id}"
    7979            redirect(action:list)
    8080        }
     
    8282
    8383    def create = {
    84         def assetExtendedAttributeTypeInstance = new AssetExtendedAttributeType()
    85         assetExtendedAttributeTypeInstance.properties = params
    86         return ['assetExtendedAttributeTypeInstance':assetExtendedAttributeTypeInstance]
     84        def extendedAttributeTypeInstance = new ExtendedAttributeType()
     85        extendedAttributeTypeInstance.properties = params
     86        return ['extendedAttributeTypeInstance':extendedAttributeTypeInstance]
    8787    }
    8888
    8989    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)
    9494        }
    9595        else {
    96             render(view:'create',model:[assetExtendedAttributeTypeInstance:assetExtendedAttributeTypeInstance])
     96            render(view:'create',model:[extendedAttributeTypeInstance:extendedAttributeTypeInstance])
    9797        }
    9898    }
Note: See TracChangeset for help on using the changeset viewer.