equal
deleted
inserted
replaced
168 // an attempt to use already created entities |
168 // an attempt to use already created entities |
169 def currentValue = getFieldValue(entity, field) |
169 def currentValue = getFieldValue(entity, field) |
170 newValue = toRemove.find {it.class == type && it != currentValue} |
170 newValue = toRemove.find {it.class == type && it != currentValue} |
171 if(newValue == null) |
171 if(newValue == null) |
172 newValue = createEntity(type as Class) |
172 newValue = createEntity(type as Class) |
|
173 } else if(Enum.class.isAssignableFrom(type)) { |
|
174 def values = type.values(); |
|
175 newValue = values[uniqueValue++ % values.size()]; |
173 } else if( |
176 } else if( |
174 type instanceof Class |
177 type instanceof Class |
175 && !( |
178 && !( |
176 field.clazz.annotations.find {it instanceof IdClass} != null |
179 field.clazz.annotations.find {it instanceof IdClass} != null |
177 && field.declaredAnnotations.find {it instanceof Id} != null |
180 && field.declaredAnnotations.find {it instanceof Id} != null |