Permalink
Browse files

Added config attribute ignoreIdentifier

  • Loading branch information...
dhalupa committed Mar 9, 2012
1 parent c72eaf1 commit 1af0f4a69f1680241f04e4d190d524c014b55f65
Showing with 11 additions and 10 deletions.
  1. +11 −10 src/groovy/org/grails/plugins/marshallers/GenericDomainClassXMLMarshaller.groovy
@@ -58,18 +58,19 @@ class GenericDomainClassXMLMarshaller implements ObjectMarshaller<XML>,NameAware
GrailsDomainClass domainClass = ConverterUtil.getDomainClass(clazz.getName());
def mc=MarshallingConfig.getForClass(clazz).getConfig('xml',configName);
BeanWrapper beanWrapper = new BeanWrapperImpl(value);
- if(mc.identifier){
- mc.identifier.each{
- def val = beanWrapper.getPropertyValue(it);
- xml.attribute(it,String.valueOf(val));
- }
- }else{
- GrailsDomainClassProperty id = domainClass.getIdentifier();
- Object idValue = beanWrapper.getPropertyValue(id.getName());
+ if(mc.ignoreIdentifier==null || !mc.ignoreIdentifier){
+ if(mc.identifier){
+ mc.identifier.each{
+ def val = beanWrapper.getPropertyValue(it);
+ xml.attribute(it,String.valueOf(val));
+ }
+ }else{
+ GrailsDomainClassProperty id = domainClass.getIdentifier();
+ Object idValue = beanWrapper.getPropertyValue(id.getName());
- if (idValue != null) xml.attribute("id", String.valueOf(idValue));
+ if (idValue != null) xml.attribute("id", String.valueOf(idValue));
+ }
}
-
if (includeVersion) {
Object versionValue = beanWrapper.getPropertyValue(domainClass.getVersion().getName());
xml.attribute("version", String.valueOf(versionValue));

0 comments on commit 1af0f4a

Please sign in to comment.