@Test public final void testSubmitToArchive() { try { MockTargetInstanceDAO tiDAO = new MockTargetInstanceDAO(testFile); this.testSetTargetInstanceManager(); this.testSetTargetManager(); this.testSetDigitalAssetStore(); try { testInstance.submitToArchive(tiDAO.load(5000L), "", null, 10000); fail("Target Reference Number Cannot Be Blank"); } catch(ArchiveException ae) { assertTrue(ae.getMessage().equals("Target Reference Number cannot be blank. This is mandatory for archiving.")); } testInstance.setTargetReferenceMandatory(false); try { testInstance.submitToArchive(tiDAO.load(5000L), "", null, 10000); } catch(ArchiveException ae) { fail(ae.getMessage()); } testInstance.setTargetReferenceMandatory(true); try { testInstance.submitToArchive(tiDAO.load(5000L), "", null, 10000); fail("Target Reference Number Cannot Be Blank"); } catch(ArchiveException ae) { assertTrue(ae.getMessage().equals("Target Reference Number cannot be blank. This is mandatory for archiving.")); } } catch(Exception e) { fail(e.getMessage()); } }
@SuppressWarnings("unchecked") public void submitToArchive(TargetInstance instance, String sipXML, Map customDepositFormElements, int harvestNumber) throws Exception{ Map map = createMap(instance); if (customDepositFormElements != null && customDepositFormElements.isEmpty() == false) map.putAll(customDepositFormElements); try { digitalAssetStore.submitToArchive(instance.getOid().toString(),sipXML,map,harvestNumber); instance.setState(TargetInstance.STATE_ARCHIVING); targetInstanceManager.save(instance); } catch (DigitalAssetStoreException e) { throw new Exception(e.getMessage(), e); } }
ArchiveAdapterImpl implements ArchiveAdapter { @SuppressWarnings("unchecked") public void submitToArchive(TargetInstance instance, String sipXML, Map customDepositFormElements, int harvestNumber) throws Exception{ Map map = createMap(instance); if (customDepositFormElements != null && customDepositFormElements.isEmpty() == false) map.putAll(customDepositFormElements); try { digitalAssetStore.submitToArchive(instance.getOid().toString(),sipXML,map,harvestNumber); instance.setState(TargetInstance.STATE_ARCHIVING); targetInstanceManager.save(instance); } catch (DigitalAssetStoreException e) { throw new Exception(e.getMessage(), e); } } }
ArchiveAdapterImpl implements ArchiveAdapter { @SuppressWarnings("unchecked") public void submitToArchive(TargetInstance instance, String sipXML, Map customDepositFormElements, int harvestNumber) throws Exception{ Map map = createMap(instance); if (customDepositFormElements != null && customDepositFormElements.isEmpty() == false) map.putAll(customDepositFormElements); try { digitalAssetStore.submitToArchive(instance.getOid().toString(),sipXML,map,harvestNumber); instance.setState(TargetInstance.STATE_ARCHIVING); targetInstanceManager.save(instance); } catch (DigitalAssetStoreException e) { throw new Exception(e.getMessage(), e); } }  }
ArchiveAdapterImpl implements ArchiveAdapter { @SuppressWarnings("unchecked") public void submitToArchive(TargetInstance instance, String sipXML, Map customDepositFormElements, int harvestNumber) throws Exception{ Map map = createMap(instance); if (customDepositFormElements != null && customDepositFormElements.isEmpty() == false) map.putAll(customDepositFormElements); try { digitalAssetStore.submitToArchive(instance.getOid().toString(),sipXML,map,harvestNumber); instance.setState(TargetInstance.STATE_ARCHIVING); targetInstanceManager.save(instance); } catch (DigitalAssetStoreException e) { throw new Exception(e.getMessage(), e); } }  @SuppressWarnings("unchecked") void submitToArchive(TargetInstance instance, String sipXML, Map customDepositFormElements, int harvestNumber); void setDigitalAssetStore(DigitalAssetStore digitalAssetStore); void setTargetInstanceManager(TargetInstanceManager targetInstanceManager); void setTargetManager(TargetManager targetManager); void setTargetReferenceMandatory(boolean targetReferenceMandatory); boolean getTargetReferenceMandatory(); void setAccessStatusMap(Map<String, String> accessStatusMap); }
ArchiveAdapterImpl implements ArchiveAdapter { @SuppressWarnings("unchecked") public void submitToArchive(TargetInstance instance, String sipXML, Map customDepositFormElements, int harvestNumber) throws Exception{ Map map = createMap(instance); if (customDepositFormElements != null && customDepositFormElements.isEmpty() == false) map.putAll(customDepositFormElements); try { digitalAssetStore.submitToArchive(instance.getOid().toString(),sipXML,map,harvestNumber); instance.setState(TargetInstance.STATE_ARCHIVING); targetInstanceManager.save(instance); } catch (DigitalAssetStoreException e) { throw new Exception(e.getMessage(), e); } }  @SuppressWarnings("unchecked") void submitToArchive(TargetInstance instance, String sipXML, Map customDepositFormElements, int harvestNumber); void setDigitalAssetStore(DigitalAssetStore digitalAssetStore); void setTargetInstanceManager(TargetInstanceManager targetInstanceManager); void setTargetManager(TargetManager targetManager); void setTargetReferenceMandatory(boolean targetReferenceMandatory); boolean getTargetReferenceMandatory(); void setAccessStatusMap(Map<String, String> accessStatusMap);  }