*/
public ObjectMapped getUnmarshallObject(String xml)
throws UnmarshallException{
ConfigurationImpl child;
ObjectMapped om = null;
logger.log(Level.INFO,Messages.message("Unmarshaller.unmarshall"));
try{
byte [] byteArray = xml.getBytes();
ConfigurationImpl conf = (ConfigurationImpl)
ConfigurationBuilder.build (
new ByteArrayInputStream(byteArray)
);
child = (ConfigurationImpl) conf.getConfiguration("class-name");
logger.log(Level.FINEST,"tag class-name " + child.getValue());
Class classFor = Class.forName(child.getValue());
om = (ObjectMapped) classFor.newInstance();
child = (ConfigurationImpl) conf.getConfiguration("repository-name");
logger.log(Level.FINEST,"tag repository-name " + child.getValue());
om.setRepositoryViewName(child.getValue());
Iterator iter = conf.getConfigurations("attributes");
while (iter.hasNext()){
child = (ConfigurationImpl) iter.next();
Iterator iterChild = child.getConfigurations("attribute");
while (iterChild.hasNext()) {
conf = (ConfigurationImpl) iterChild.next();
child = (ConfigurationImpl) conf.getConfiguration("name");
String name = child.getValue();
logger.log(Level.FINEST,"tag name " + name);
child = (ConfigurationImpl) conf.getConfiguration("value");
String value = child.getValue();
logger.log(Level.FINEST,"tag value " + value);
/*
* Bug fixing 957296 (Gmartone)
*/
if(name.equals("OID"))
om.setOID(value);
else
/*
* End bug fixing 957296 (Gmartone)
*/
ReflectionManager.setValueByName(om,name,value);
}
}
}
catch(Exception e){
logger.throwing(CLASS_NAME,"getUnmarshallObject()",
new UnmarshallException("unmarshal.unmarshalFail",
om.getClassName()));
throw new UnmarshallException("unmarshal.unmarshalFail",
om.getClassName()
);
}
return om;
}