Skip to content

Commit

Permalink
Add multivalued/delimiter properties
Browse files Browse the repository at this point in the history
  • Loading branch information
gschueler committed Mar 2, 2011
1 parent e2baa80 commit 3b9172f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion rundeckapp/grails-app/domain/Option.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public class Option implements Comparable{
String valuesUrlString
String regex
String valuesList
Boolean multivalued
String delimiter
static belongsTo=[scheduledExecution:ScheduledExecution]
static transients=['valuesList','valuesUrlString']

Expand All @@ -58,6 +60,8 @@ public class Option implements Comparable{
valuesUrl(nullable:true)
regex(nullable:true)
scheduledExecution(nullable:true)
delimiter(nullable:true)
multivalued(nullable:true)
}

/**
Expand Down Expand Up @@ -87,6 +91,10 @@ public class Option implements Comparable{
if(values){
map.values=values as List
}
if(multivalued){
map.multivalued=multivalued
map.delimiter=delimiter?:','
}
return map
}

Expand All @@ -110,6 +118,12 @@ public class Option implements Comparable{
if(data.values){
opt.values=data.values instanceof Collection?new TreeSet(data.values):new TreeSet([data.values])
}
if(data.multivalued){
opt.multivalued=true
if(data.delimiter){
opt.delimiter=data.delimiter
}
}
return opt
}
/**
Expand Down Expand Up @@ -145,7 +159,7 @@ public class Option implements Comparable{
*/
public Option createClone(){
Option opt = new Option()
['name','description','defaultValue','enforced','required','values','valuesList','valuesUrl','regex'].each{k->
['name','description','defaultValue','enforced','required','values','valuesList','valuesUrl','regex','multivalued','delimiter'].each{k->
opt[k]=this[k]
}
if(!opt.valuesList && values){
Expand All @@ -164,6 +178,8 @@ public class Option implements Comparable{
", values=" + values +
", valuesUrl=" + valuesUrl +
", regex='" + regex + '\'' +
", multivalued='" + multivalued + '\'' +
", delimiter='" + delimiter + '\'' +
'}' ;
}

Expand Down

0 comments on commit 3b9172f

Please sign in to comment.