Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added config attribute ignoreIdentifier

  • Loading branch information...
commit 1af0f4a69f1680241f04e4d190d524c014b55f65 1 parent c72eaf1
@dhalupa dhalupa authored
View
21 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));
Please sign in to comment.
Something went wrong with that request. Please try again.