use of org.mycore.common.content.MCRWrappedContent in project mycore by MyCoRe-Org.
the class MCRXEditorTransformer method transform.
public MCRContent transform(MCRContent editorSource) throws IOException, JDOMException, SAXException {
editorSession.getValidator().clearRules();
editorSession.getSubmission().clear();
MCRContentTransformer transformer = MCRContentTransformerFactory.getTransformer("xeditor");
if (transformer instanceof MCRParameterizedTransformer) {
String key = MCRXEditorTransformerStore.storeTransformer(this);
transformationParameters.setParameter("XEditorTransformerKey", key);
MCRContent result = ((MCRParameterizedTransformer) transformer).transform(editorSource, transformationParameters);
if (result instanceof MCRWrappedContent && result.getClass().getName().contains(MCRXSLTransformer.class.getName())) {
// lazy transformation make JUnit tests fail
result = ((MCRWrappedContent) result).getBaseContent();
}
editorSession.getValidator().clearValidationResults();
return result;
} else {
throw new MCRException("Xeditor needs parameterized MCRContentTransformer: " + transformer);
}
}
Aggregations