@Test public void givenManifestWhenGetInfoThenGetVersionList() throws Exception { final XMLInputFactory factory = XMLInputFactoryUtils.newInstance(); final XMLEventReader evenReader = factory.createXMLEventReader( new FileReader(PropertiesUtils.getResourcePath("sip.xml").toString())); Map<String, List<DataObjectInfo>> versionList; versionList = utils.manifestVersionList(evenReader); assertEquals(2, versionList.size()); assertEquals(4, versionList.get(SedaConstants.TAG_BINARY_DATA_OBJECT).size()); assertEquals(1, versionList.get(SedaConstants.TAG_PHYSICAL_DATA_OBJECT).size()); List<String> versionsToBeChecked = new ArrayList<>(); assertTrue( versionList.get(SedaConstants.TAG_PHYSICAL_DATA_OBJECT).get(0).getVersion().equals("PhysicalMaster_1")); versionsToBeChecked.addAll(Arrays.asList("BinaryMaster", "Dissemination_1", "Thumbnail", "TextContent_1")); versionList.get(SedaConstants.TAG_BINARY_DATA_OBJECT).forEach(key -> { assertTrue(versionsToBeChecked.contains(key.getVersion())); versionsToBeChecked.remove(key.getVersion()); }); }
public Map<String, List<DataObjectInfo>> manifestVersionList(XMLEventReader evenReader) throws ProcessingException { final Map<String, List<DataObjectInfo>> versionListByType = new HashMap<>(); final SedaUtilInfo sedaUtilInfo = getDataObjectInfo(evenReader); final Map<String, DataObjectInfo> dataObjectMap = sedaUtilInfo.getDataObjectMap(); List<DataObjectInfo> physicalObjectsVersion = new ArrayList<>(); List<DataObjectInfo> binaryObjectsVersion = new ArrayList<>(); for (final String mapKey : dataObjectMap.keySet()) { if (SedaConstants.TAG_PHYSICAL_DATA_OBJECT.equals(dataObjectMap.get(mapKey).getType())) { physicalObjectsVersion.add(dataObjectMap.get(mapKey)); } else { binaryObjectsVersion.add(dataObjectMap.get(mapKey)); } } versionListByType.put(SedaConstants.TAG_BINARY_DATA_OBJECT, binaryObjectsVersion); versionListByType.put(SedaConstants.TAG_PHYSICAL_DATA_OBJECT, physicalObjectsVersion); return versionListByType; }
SedaUtils { public Map<String, List<DataObjectInfo>> manifestVersionList(XMLEventReader evenReader) throws ProcessingException { final Map<String, List<DataObjectInfo>> versionListByType = new HashMap<>(); final SedaUtilInfo sedaUtilInfo = getDataObjectInfo(evenReader); final Map<String, DataObjectInfo> dataObjectMap = sedaUtilInfo.getDataObjectMap(); List<DataObjectInfo> physicalObjectsVersion = new ArrayList<>(); List<DataObjectInfo> binaryObjectsVersion = new ArrayList<>(); for (final String mapKey : dataObjectMap.keySet()) { if (SedaConstants.TAG_PHYSICAL_DATA_OBJECT.equals(dataObjectMap.get(mapKey).getType())) { physicalObjectsVersion.add(dataObjectMap.get(mapKey)); } else { binaryObjectsVersion.add(dataObjectMap.get(mapKey)); } } versionListByType.put(SedaConstants.TAG_BINARY_DATA_OBJECT, binaryObjectsVersion); versionListByType.put(SedaConstants.TAG_PHYSICAL_DATA_OBJECT, physicalObjectsVersion); return versionListByType; } }
SedaUtils { public Map<String, List<DataObjectInfo>> manifestVersionList(XMLEventReader evenReader) throws ProcessingException { final Map<String, List<DataObjectInfo>> versionListByType = new HashMap<>(); final SedaUtilInfo sedaUtilInfo = getDataObjectInfo(evenReader); final Map<String, DataObjectInfo> dataObjectMap = sedaUtilInfo.getDataObjectMap(); List<DataObjectInfo> physicalObjectsVersion = new ArrayList<>(); List<DataObjectInfo> binaryObjectsVersion = new ArrayList<>(); for (final String mapKey : dataObjectMap.keySet()) { if (SedaConstants.TAG_PHYSICAL_DATA_OBJECT.equals(dataObjectMap.get(mapKey).getType())) { physicalObjectsVersion.add(dataObjectMap.get(mapKey)); } else { binaryObjectsVersion.add(dataObjectMap.get(mapKey)); } } versionListByType.put(SedaConstants.TAG_BINARY_DATA_OBJECT, binaryObjectsVersion); versionListByType.put(SedaConstants.TAG_PHYSICAL_DATA_OBJECT, physicalObjectsVersion); return versionListByType; } protected  SedaUtils(HandlerIO handlerIO); }
SedaUtils { public Map<String, List<DataObjectInfo>> manifestVersionList(XMLEventReader evenReader) throws ProcessingException { final Map<String, List<DataObjectInfo>> versionListByType = new HashMap<>(); final SedaUtilInfo sedaUtilInfo = getDataObjectInfo(evenReader); final Map<String, DataObjectInfo> dataObjectMap = sedaUtilInfo.getDataObjectMap(); List<DataObjectInfo> physicalObjectsVersion = new ArrayList<>(); List<DataObjectInfo> binaryObjectsVersion = new ArrayList<>(); for (final String mapKey : dataObjectMap.keySet()) { if (SedaConstants.TAG_PHYSICAL_DATA_OBJECT.equals(dataObjectMap.get(mapKey).getType())) { physicalObjectsVersion.add(dataObjectMap.get(mapKey)); } else { binaryObjectsVersion.add(dataObjectMap.get(mapKey)); } } versionListByType.put(SedaConstants.TAG_BINARY_DATA_OBJECT, binaryObjectsVersion); versionListByType.put(SedaConstants.TAG_PHYSICAL_DATA_OBJECT, physicalObjectsVersion); return versionListByType; } protected  SedaUtils(HandlerIO handlerIO); Map<String, String> getBinaryDataObjectIdToGuid(); Map<String, List<String>> getObjectGroupIdToBinaryDataObjectId(); Map<String, String> getObjectGroupIdToGuid(); Map<String, String> getUnitIdToGuid(); Map<String, String> getBinaryDataObjectIdToGroupId(); Map<String, String> getUnitIdToGroupId(); Map<String, Object> getMandatoryValues(WorkerParameters params); CheckSedaValidationStatus checkSedaValidation(WorkerParameters params, ItemStatus itemStatus); ExtractUriResponse getAllDigitalObjectUriFromManifest(); Map<String, Map<String, String>> checkSupportedDataObjectVersion(WorkerParameters params); SedaUtilInfo getDataObjectInfo(XMLEventReader evenReader); Map<String, List<DataObjectInfo>> manifestVersionList(XMLEventReader evenReader); Map<String, Map<String, String>> compareVersionList(XMLEventReader eventReader); long computeTotalSizeOfObjectsInManifest(WorkerParameters params); }
SedaUtils { public Map<String, List<DataObjectInfo>> manifestVersionList(XMLEventReader evenReader) throws ProcessingException { final Map<String, List<DataObjectInfo>> versionListByType = new HashMap<>(); final SedaUtilInfo sedaUtilInfo = getDataObjectInfo(evenReader); final Map<String, DataObjectInfo> dataObjectMap = sedaUtilInfo.getDataObjectMap(); List<DataObjectInfo> physicalObjectsVersion = new ArrayList<>(); List<DataObjectInfo> binaryObjectsVersion = new ArrayList<>(); for (final String mapKey : dataObjectMap.keySet()) { if (SedaConstants.TAG_PHYSICAL_DATA_OBJECT.equals(dataObjectMap.get(mapKey).getType())) { physicalObjectsVersion.add(dataObjectMap.get(mapKey)); } else { binaryObjectsVersion.add(dataObjectMap.get(mapKey)); } } versionListByType.put(SedaConstants.TAG_BINARY_DATA_OBJECT, binaryObjectsVersion); versionListByType.put(SedaConstants.TAG_PHYSICAL_DATA_OBJECT, physicalObjectsVersion); return versionListByType; } protected  SedaUtils(HandlerIO handlerIO); Map<String, String> getBinaryDataObjectIdToGuid(); Map<String, List<String>> getObjectGroupIdToBinaryDataObjectId(); Map<String, String> getObjectGroupIdToGuid(); Map<String, String> getUnitIdToGuid(); Map<String, String> getBinaryDataObjectIdToGroupId(); Map<String, String> getUnitIdToGroupId(); Map<String, Object> getMandatoryValues(WorkerParameters params); CheckSedaValidationStatus checkSedaValidation(WorkerParameters params, ItemStatus itemStatus); ExtractUriResponse getAllDigitalObjectUriFromManifest(); Map<String, Map<String, String>> checkSupportedDataObjectVersion(WorkerParameters params); SedaUtilInfo getDataObjectInfo(XMLEventReader evenReader); Map<String, List<DataObjectInfo>> manifestVersionList(XMLEventReader evenReader); Map<String, Map<String, String>> compareVersionList(XMLEventReader eventReader); long computeTotalSizeOfObjectsInManifest(WorkerParameters params); static final String NAMESPACE_URI; static final String XSI_URI; static final String NB_AU_EXISTING; static final String INVALID_DATAOBJECT_VERSION; static final String VALID_DATAOBJECT_VERSION; static final String SEDA_XSD_VERSION; }