Persistor root = p.getFirstChild(OUTPUT);
if (root == null) {
// See comment in isApplicable() for an explanation
return null;
}
DataStructure struct = null;
DataStructureType type = DataStructureType.valueOf(root.getString(TYPE));
switch (type) {
case ComplexText:
case Text:
// Special case for TextStructures: They have already been fully restored as part of
// the TextDocument they belong to. We can return here.
return lookupTextStructure(root, lookup);
case WebServiceRequest:
// Special case for WebServiceStructures: They have already been fully restored as part
// of
// the WebServiceCall they belong to. We can return here.
return lookupWebServiceCall(root, lookup).getInputStructure();
case WebServiceResponse:
return lookupWebServiceCall(root, lookup).getOutputStructure();
case None:
struct = new NoStructure();
break;
case Database:
struct = createDatabaseOutputStructure(tf, lookup);
break;
case LDAP:
struct = createLdapOutputStructure(tf, lookup);
break;
default:
throw new RuntimeException("Unexpected structure type: " + type);
}
struct.restoreFrom(root);
return struct;
}