source: trunk/grails-app/domain/Asset.groovy @ 329

Last change on this file since 329 was 329, checked in by gav, 14 years ago

Add comment attribute to Asset and limit description to 75 char.
Update service and detailed views to suite.

File size: 1015 bytes
Line 
1class Asset {
2
3    Section section
4
5    String name
6    String description = ""
7    String comment = ""
8    boolean isActive = true
9
10    static hasMany = [assetSubItems: AssetSubItem,
11                                    maintenanceActions: MaintenanceAction,
12                                    assetExtendedAttributes: AssetExtendedAttribute]
13
14    static belongsTo = [Section]
15
16    static constraints = {
17        name(maxSize:50, unique:true, blank:false)
18        description(maxSize:75)
19        comment(maxSize:500)
20        isActive()
21        section()
22    }
23
24    String toString() {
25        "${this.name}"
26    }
27
28    //  This additional setter is used to convert the checkBoxList string
29    //  of ids selected to the corresponding domain objects.
30    public void setAssetSubItemsFromCheckBoxList(ids) {
31        def idList = []
32        ids.each() {
33            if(it.isInteger())
34                idList << it.toInteger()
35        }
36        this.assetSubItems = idList.collect { AssetSubItem.get( it ) }
37    }
38
39}
40
Note: See TracBrowser for help on using the repository browser.