source:
trunk/grails-app/domain/Asset.groovy
@
469
Last change on this file since 469 was 456, checked in by , 14 years ago | |
---|---|
File size: 1.2 KB |
Rev | Line | |
---|---|---|
[116] | 1 | class Asset { |
[122] | 2 | |
[268] | 3 | Section section |
[122] | 4 | |
[116] | 5 | String name |
6 | String description = "" | |
[329] | 7 | String comment = "" |
[116] | 8 | boolean isActive = true |
9 | ||
[268] | 10 | static hasMany = [assetSubItems: AssetSubItem, |
11 | maintenanceActions: MaintenanceAction, | |
[131] | 12 | assetExtendedAttributes: AssetExtendedAttribute] |
[121] | 13 | |
[268] | 14 | static belongsTo = [Section] |
[121] | 15 | |
[124] | 16 | static constraints = { |
[268] | 17 | name(maxSize:50, unique:true, blank:false) |
[329] | 18 | description(maxSize:75) |
19 | comment(maxSize:500) | |
[268] | 20 | isActive() |
21 | section() | |
[124] | 22 | } |
[116] | 23 | |
[456] | 24 | static mapping = { |
25 | assetSubItems(batchSize:1000) | |
26 | } | |
27 | ||
[116] | 28 | String toString() { |
29 | "${this.name}" | |
30 | } | |
[286] | 31 | |
[343] | 32 | // This additional setter is used to convert the checkBoxList string or string array |
[286] | 33 | // of ids selected to the corresponding domain objects. |
34 | public void setAssetSubItemsFromCheckBoxList(ids) { | |
35 | def idList = [] | |
[343] | 36 | if(ids instanceof String) { |
37 | if(ids.isInteger()) | |
38 | idList << ids.toInteger() | |
[286] | 39 | } |
[343] | 40 | else { |
41 | ids.each() { | |
42 | if(it.isInteger()) | |
43 | idList << it.toInteger() | |
44 | } | |
45 | } | |
[286] | 46 | this.assetSubItems = idList.collect { AssetSubItem.get( it ) } |
47 | } | |
48 | ||
[116] | 49 | } |
50 |
Note: See TracBrowser
for help on using the repository browser.