/** * Ingest a whole document. Build Document object around root element, and feed that to the * transformation, since it may get handled differently than a List of metadata elements. */ public void ingest(Context context, DSpaceObject dso, Element root) throws CrosswalkException, IOException, SQLException, AuthorizeException { if (dso.getType() != Constants.ITEM) throw new CrosswalkObjectNotSupported( "XsltSubmissionionCrosswalk can only crosswalk to an Item."); Item item = (Item) dso; XSLTransformer xform = getTransformer(DIRECTION); if (xform == null) throw new CrosswalkInternalException( "Failed to initialize transformer, probably error loading stylesheet."); try { Document dimDoc = xform.transform(new Document((Element) root.clone())); applyDim(dimDoc.getRootElement().getChildren(), item); } catch (XSLTransformException e) { log.error("Got error: " + e.toString()); throw new CrosswalkInternalException("XSL Transformation failed: " + e.toString()); } }
public List disseminateList(DSpaceObject dso) throws CrosswalkException, IOException, SQLException, AuthorizeException { init(); if (dso.getType() != Constants.ITEM) throw new CrosswalkObjectNotSupported( "XSLTDisseminationCrosswalk can only crosswalk an Item."); Item item = (Item) dso; XSLTransformer xform = getTransformer(DIRECTION); if (xform == null) throw new CrosswalkInternalException( "Failed to initialize transformer, probably error loading stylesheet."); try { return xform.transform(getDim(item).getChildren()); } catch (XSLTransformException e) { log.error("Got error: " + e.toString()); throw new CrosswalkInternalException("XSL translation failed: " + e.toString()); } }