Ignore:
Timestamp:
May 1, 2009, 3:27:41 PM (16 years ago)
Author:
gav
Message:

Run generate-all on all controllers and views except Person and Authority.
Extensive work on Asset domain and application now compiles and runs well.
Update BootStrap? to suite.

File:
1 edited

Legend:

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

    r116 r122  
    22
    33class PersonGroupTypeController extends BaseAppAdminController {
    4 
     4   
    55    def index = { redirect(action:list,params:params) }
    66
     
    99
    1010    def list = {
    11         if(!params.max) params.max = 10
    12         [ personGroupTypeInstanceList: PersonGroupType.list( params ) ]
     11        params.max = Math.min( params.max ? params.max.toInteger() : 10,  100)
     12        [ personGroupTypeInstanceList: PersonGroupType.list( params ), personGroupTypeInstanceTotal: PersonGroupType.count() ]
    1313    }
    1414
     
    2626        def personGroupTypeInstance = PersonGroupType.get( params.id )
    2727        if(personGroupTypeInstance) {
    28             personGroupTypeInstance.delete()
    29             flash.message = "PersonGroupType ${params.id} deleted"
    30             redirect(action:list)
     28            try {
     29                personGroupTypeInstance.delete()
     30                flash.message = "PersonGroupType ${params.id} deleted"
     31                redirect(action:list)
     32            }
     33            catch(org.springframework.dao.DataIntegrityViolationException e) {
     34                flash.message = "PersonGroupType ${params.id} could not be deleted"
     35                redirect(action:show,id:params.id)
     36            }
    3137        }
    3238        else {
     
    5157        def personGroupTypeInstance = PersonGroupType.get( params.id )
    5258        if(personGroupTypeInstance) {
     59            if(params.version) {
     60                def version = params.version.toLong()
     61                if(personGroupTypeInstance.version > version) {
     62                   
     63                    personGroupTypeInstance.errors.rejectValue("version", "personGroupType.optimistic.locking.failure", "Another user has updated this PersonGroupType while you were editing.")
     64                    render(view:'edit',model:[personGroupTypeInstance:personGroupTypeInstance])
     65                    return
     66                }
     67            }
    5368            personGroupTypeInstance.properties = params
    5469            if(!personGroupTypeInstance.hasErrors() && personGroupTypeInstance.save()) {
Note: See TracChangeset for help on using the changeset viewer.