Last change
on this file since 378 was
343,
checked in by gav, 15 years ago
|
Improvements to CustomTagLib checkBoxList, sorting, dynamic displayFields and a small fix to the domain class set method.
|
File size:
1.2 KB
|
Line | |
---|
1 | class 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 or string array |
---|
29 | // of ids selected to the corresponding domain objects. |
---|
30 | public void setAssetSubItemsFromCheckBoxList(ids) { |
---|
31 | def idList = [] |
---|
32 | if(ids instanceof String) { |
---|
33 | if(ids.isInteger()) |
---|
34 | idList << ids.toInteger() |
---|
35 | } |
---|
36 | else { |
---|
37 | ids.each() { |
---|
38 | if(it.isInteger()) |
---|
39 | idList << it.toInteger() |
---|
40 | } |
---|
41 | } |
---|
42 | this.assetSubItems = idList.collect { AssetSubItem.get( it ) } |
---|
43 | } |
---|
44 | |
---|
45 | } |
---|
46 | |
---|
Note: See
TracBrowser
for help on using the repository browser.