private static final String WSCALL_ID = "wsCallId";
public static void saveInputStructure(Transformation tf, DataStructure input, Persistor p) {
if (isApplicable(input)) {
DataStructureType type = input.getStructureType();
Persistor root = p.createChild(INPUT);
root.putString(TYPE, type.name());
if (type.isTextBased()) {
// Special case for TextStructures: We restore them directly from the TextDocument,
// using the document ID
root.putString(DOC_ID, tf.getSourceTextDocumentId().toString());
} else if (type == DataStructureType.WebServiceRequest || type == DataStructureType.WebServiceResponse) {
// Special case for WebServiceCalls: We restore them directly from the
// WebServiceCall instance,
// using its ID
root.putString(WSCALL_ID, ((WebServiceStructure) input).getWebServiceCallId().toString());
} else {
input.writeTo(root);
}
}
}