* @throws IOException
* @throws ResultException
* @throws Exception
*/
public DmcObject deserialize(DmcInputStreamIF dis) throws Exception {
DmcObject dmo = null;
// READ: the number of classes in the objectClass
int classCount = dis.readInt();
// READ: the construction class ID
int classID = dis.readInt();
// Try to find the class in the schema
ClassDefinition cd = schema.isClass(classID);
if (cd == null)
throw new IllegalStateException("Unknown class ID: " + classID + " ensure that you have loaded the required schemas.");
// Instantiate the object
dmo = cd.newDMOInstance();
// Add the auxiliary classes if they exist
if (classCount > 1){
for(int i=1; i<classCount; i++){
classID = dis.readInt();
cd = schema.isClass(classID);
dmo.addAux(new ClassDefinitionREF(cd.getDMO()));
}
}
// READ: the number of attributes
int attrCount = dis.readAttributeCount();
for(int i=0; i<attrCount; i++){
DmcAttribute<?> attr = dis.getAttributeInstance();
// READ: the current attribute
attr.deserializeIt(dis);
if (attr.getAttributeInfo().valueType == ValueTypeEnum.SINGLE)
dmo.set(attr.getAttributeInfo(), attr);
else
dmo.add(attr.getAttributeInfo(), attr);
}
return(dmo);
}