@Test(expected = MetsExportException.class) public void saveInvalidDC() throws Exception { String sourceDirPath = getTargetPath() + File.separator + "monographInvalid" + File.separator; File resultDir = tmp.newFolder("result" + "monographInvalidDC"); String path = sourceDirPath + "1ccbf6c5-b22c-4d89-b42e-8cd14101a737.xml"; DigitalObject dbObj = MetsUtils.readFoXML(path); MetsContext context = new MetsContext(); context.setPath(sourceDirPath); context.setFsParentMap(TestConst.parents); context.setOutputPath(resultDir.getAbsolutePath()); context.setAllowNonCompleteStreams(true); context.setAllowMissingURNNBN(true); MetsElement metsElement = MetsElement.getElement(dbObj, null, context, true); MetsElementVisitor visitor = new MetsElementVisitor(); metsElement.accept(visitor); }
public static DigitalObject readFoXML(String path) throws MetsExportException { DigitalObject foXMLObject; File file = new File(path); try { JAXBContext jaxbContext = JAXBContext.newInstance(DigitalObject.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); foXMLObject = (DigitalObject) unmarshaller.unmarshal(file); return foXMLObject; } catch (JAXBException e) { throw new MetsExportException("Unable to read FoXML document " + path, false, e); } }
MetsUtils { public static DigitalObject readFoXML(String path) throws MetsExportException { DigitalObject foXMLObject; File file = new File(path); try { JAXBContext jaxbContext = JAXBContext.newInstance(DigitalObject.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); foXMLObject = (DigitalObject) unmarshaller.unmarshal(file); return foXMLObject; } catch (JAXBException e) { throw new MetsExportException("Unable to read FoXML document " + path, false, e); } } }
MetsUtils { public static DigitalObject readFoXML(String path) throws MetsExportException { DigitalObject foXMLObject; File file = new File(path); try { JAXBContext jaxbContext = JAXBContext.newInstance(DigitalObject.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); foXMLObject = (DigitalObject) unmarshaller.unmarshal(file); return foXMLObject; } catch (JAXBException e) { throw new MetsExportException("Unable to read FoXML document " + path, false, e); } }  }
MetsUtils { public static DigitalObject readFoXML(String path) throws MetsExportException { DigitalObject foXMLObject; File file = new File(path); try { JAXBContext jaxbContext = JAXBContext.newInstance(DigitalObject.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); foXMLObject = (DigitalObject) unmarshaller.unmarshal(file); return foXMLObject; } catch (JAXBException e) { throw new MetsExportException("Unable to read FoXML document " + path, false, e); } }  static XMLGregorianCalendar getCurrentDate(); static Properties getMimeToExtension(); static String getElementType(String  model); static List<String> findPSPPIDs(String pid, MetsContext ctx, boolean fillChildren); static String getProperty(String name, java.util.List<PropertyType> properties); static List<Element> removeSchemaLocation(List<Element> elements); static List<Element> removeModsCollection(List<Element> elements); static byte[] getBinaryDataStreams(List<DatastreamType> datastreams, String type); static boolean equalDataStreams(String dataStream, String streamName); static Document getDocumentFromList(List<Element> elements); static String xPathEvaluateString(List<Element> elements, String xPath); static Node xPathEvaluateNode(List<Element> elements, String xPath); static String getModel(List<Element> relExtStream); static void copyStream(InputStream is, OutputStream os); static byte[] getBinaryDataStreams(FedoraClient fedoraClient, IMetsElement metsElement, String streamName); static HashMap<String, FileGrp> initFileGroups(); static HashMap<String, FileGrp> initAudioFileGroups(); static HashMap<String, FileGrp> initAudioFileGroups(HashMap<String, FileGrp> fileGrpMap); static DigitalObject readFoXML(String path); static DigitalObject readFoXML(String uuid, FedoraClient client); static List<String> validateAgainstXSD(Document document, InputStream xsd); static List<String> validateAgainstXSD(File file, InputStream xsd); static boolean hasReferenceXML(String name); static String validateIdentifier(String identifier); static String removeNonAlpabetChars(String inputString); static void saveInfoFile(String path, MetsContext metsContext, String md5, String fileMd5Name, File metsFile); static String getPackageID(IMetsElement element); static DigitalObject readRelatedFoXML(String uuid, FedoraClient client); static DigitalObject readRelatedFoXML(String path, String fileName); static FileMD5Info getDigestAndCopy(InputStream is, OutputStream os); static FileMD5Info getDigest(InputStream is); static String getParent(String uuid, RemoteStorage remoteStorage); static String getParent(String uuid, Map<String, String> fileSystemParents); static Document getDocumentFromBytes(byte[] bytes); static void deleteFolder(File folder); static HashMap<String, FileGrp> initEbornFileGroups(); }
MetsUtils { public static DigitalObject readFoXML(String path) throws MetsExportException { DigitalObject foXMLObject; File file = new File(path); try { JAXBContext jaxbContext = JAXBContext.newInstance(DigitalObject.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); foXMLObject = (DigitalObject) unmarshaller.unmarshal(file); return foXMLObject; } catch (JAXBException e) { throw new MetsExportException("Unable to read FoXML document " + path, false, e); } }  static XMLGregorianCalendar getCurrentDate(); static Properties getMimeToExtension(); static String getElementType(String  model); static List<String> findPSPPIDs(String pid, MetsContext ctx, boolean fillChildren); static String getProperty(String name, java.util.List<PropertyType> properties); static List<Element> removeSchemaLocation(List<Element> elements); static List<Element> removeModsCollection(List<Element> elements); static byte[] getBinaryDataStreams(List<DatastreamType> datastreams, String type); static boolean equalDataStreams(String dataStream, String streamName); static Document getDocumentFromList(List<Element> elements); static String xPathEvaluateString(List<Element> elements, String xPath); static Node xPathEvaluateNode(List<Element> elements, String xPath); static String getModel(List<Element> relExtStream); static void copyStream(InputStream is, OutputStream os); static byte[] getBinaryDataStreams(FedoraClient fedoraClient, IMetsElement metsElement, String streamName); static HashMap<String, FileGrp> initFileGroups(); static HashMap<String, FileGrp> initAudioFileGroups(); static HashMap<String, FileGrp> initAudioFileGroups(HashMap<String, FileGrp> fileGrpMap); static DigitalObject readFoXML(String path); static DigitalObject readFoXML(String uuid, FedoraClient client); static List<String> validateAgainstXSD(Document document, InputStream xsd); static List<String> validateAgainstXSD(File file, InputStream xsd); static boolean hasReferenceXML(String name); static String validateIdentifier(String identifier); static String removeNonAlpabetChars(String inputString); static void saveInfoFile(String path, MetsContext metsContext, String md5, String fileMd5Name, File metsFile); static String getPackageID(IMetsElement element); static DigitalObject readRelatedFoXML(String uuid, FedoraClient client); static DigitalObject readRelatedFoXML(String path, String fileName); static FileMD5Info getDigestAndCopy(InputStream is, OutputStream os); static FileMD5Info getDigest(InputStream is); static String getParent(String uuid, RemoteStorage remoteStorage); static String getParent(String uuid, Map<String, String> fileSystemParents); static Document getDocumentFromBytes(byte[] bytes); static void deleteFolder(File folder); static HashMap<String, FileGrp> initEbornFileGroups();  }