@@ -50,7 +50,7 @@ vResults = validateModel(target=model);
50
50
*/
51
51
import cbvalidation .models .* ;
52
52
import cbvalidation .models .result .* ;
53
- component accessors = " true" serialize = " false" implements = " IValidationManager" {
53
+ component accessors = " true" serialize = " false" implements = " IValidationManager" singleton {
54
54
55
55
/**
56
56
* WireBox Object Factory
@@ -67,16 +67,18 @@ component accessors="true" serialize="false" implements="IValidationManager"{
67
67
*/
68
68
property name = " sharedConstraints" type = " struct" ;
69
69
70
+ this .id = createUUID ();
71
+
70
72
/**
71
73
* Constructor
72
74
* @sharedConstraints.hint A structure of shared constraints
73
75
*/
74
- ValidationManager function init (struct sharedConstraints = structNew ()){
75
-
76
+ ValidationManager function init ( struct sharedConstraints = structNew () ){
76
77
// valid validator registrations
77
- validValidators = " required,type,size,range,regex,sameAs,sameAsNoCase,inList,discrete,udf,method,validator,min,max" ;
78
+ variables . validValidators = " required,type,size,range,regex,sameAs,sameAsNoCase,inList,discrete,udf,method,validator,min,max" ;
78
79
// store shared constraints if passed
79
80
variables .sharedConstraints = arguments .sharedConstraints ;
81
+
80
82
return this ;
81
83
}
82
84
@@ -185,24 +187,24 @@ component accessors="true" serialize="false" implements="IValidationManager"{
185
187
* Retrieve the shared constraints, all of them or by name
186
188
* @name.hint Filter by name or not
187
189
*/
188
- struct function getSharedConstraints (string name ){
189
- return ( structKeyExists (arguments ," name" ) ? sharedConstraints [arguments .name ] : sharedConstraints );
190
+ struct function getSharedConstraints ( string name ){
191
+ return ( structKeyExists ( arguments , " name" ) ? variables . sharedConstraints [ arguments .name ] : variables . sharedConstraints );
190
192
}
191
193
192
194
/**
193
195
* Check if a shared constraint exists by name
194
196
* @name.hint The shared constraint to check
195
197
*/
196
- boolean function sharedConstraintsExists (required string name ){
197
- return structKeyExists ( sharedConstraints , arguments .name );
198
+ boolean function sharedConstraintsExists ( required string name ){
199
+ return structKeyExists ( variables . sharedConstraints , arguments .name );
198
200
}
199
201
200
202
201
203
/**
202
204
* Set the entire shared constraints structure
203
205
* @constraints.hint Filter by name or not
204
206
*/
205
- IValidationManager function setSharedConstraints (struct constraints ){
207
+ IValidationManager function setSharedConstraints ( struct constraints ){
206
208
variables .sharedConstraints = arguments .constraints ;
207
209
return this ;
208
210
}
@@ -212,8 +214,8 @@ component accessors="true" serialize="false" implements="IValidationManager"{
212
214
* @name.hint Filter by name or not
213
215
* @constraint.hint The constraint to store.
214
216
*/
215
- IValidationManager function addSharedConstraint (required string name , required struct constraint ){
216
- sharedConstraints [ arguments .name ] = arguments .constraints ;
217
+ IValidationManager function addSharedConstraint ( required string name , required struct constraint ){
218
+ variables . sharedConstraints [ arguments .name ] = arguments .constraints ;
217
219
}
218
220
219
221
/* ************************************* private *********************************************/
0 commit comments