@Test public void testGetRequisition() throws Exception { Requisition requisition = createRequisition(); ForeignSource foreignSource = createForeignSource(m_defaultForeignSourceName); assertRequisitionsMatch("requisitions must match", m_foreignSourceRepository.getRequisition(m_defaultForeignSourceName), m_foreignSourceRepository.getRequisition(foreignSource)); assertRequisitionsMatch("foreign source is the expected one", requisition, m_foreignSourceRepository.getRequisition(foreignSource)); }
public Requisition getRequisition(final String foreignSourceName) throws ForeignSourceRepositoryException { if (foreignSourceName == null) { throw new ForeignSourceRepositoryException("can't get a requisition with a null foreign source name!"); } m_readLock.lock(); try { final File inputFile = RequisitionFileUtils.encodeFileName(m_requisitionPath, foreignSourceName); if (inputFile != null && inputFile.exists()) { return RequisitionFileUtils.getRequisitionFromFile(inputFile); } return null; } finally { m_readLock.unlock(); } }
FilesystemForeignSourceRepository extends AbstractForeignSourceRepository implements InitializingBean { public Requisition getRequisition(final String foreignSourceName) throws ForeignSourceRepositoryException { if (foreignSourceName == null) { throw new ForeignSourceRepositoryException("can't get a requisition with a null foreign source name!"); } m_readLock.lock(); try { final File inputFile = RequisitionFileUtils.encodeFileName(m_requisitionPath, foreignSourceName); if (inputFile != null && inputFile.exists()) { return RequisitionFileUtils.getRequisitionFromFile(inputFile); } return null; } finally { m_readLock.unlock(); } } }
FilesystemForeignSourceRepository extends AbstractForeignSourceRepository implements InitializingBean { public Requisition getRequisition(final String foreignSourceName) throws ForeignSourceRepositoryException { if (foreignSourceName == null) { throw new ForeignSourceRepositoryException("can't get a requisition with a null foreign source name!"); } m_readLock.lock(); try { final File inputFile = RequisitionFileUtils.encodeFileName(m_requisitionPath, foreignSourceName); if (inputFile != null && inputFile.exists()) { return RequisitionFileUtils.getRequisitionFromFile(inputFile); } return null; } finally { m_readLock.unlock(); } } FilesystemForeignSourceRepository(); }
FilesystemForeignSourceRepository extends AbstractForeignSourceRepository implements InitializingBean { public Requisition getRequisition(final String foreignSourceName) throws ForeignSourceRepositoryException { if (foreignSourceName == null) { throw new ForeignSourceRepositoryException("can't get a requisition with a null foreign source name!"); } m_readLock.lock(); try { final File inputFile = RequisitionFileUtils.encodeFileName(m_requisitionPath, foreignSourceName); if (inputFile != null && inputFile.exists()) { return RequisitionFileUtils.getRequisitionFromFile(inputFile); } return null; } finally { m_readLock.unlock(); } } FilesystemForeignSourceRepository(); @Override void afterPropertiesSet(); Set<String> getActiveForeignSourceNames(); int getForeignSourceCount(); Set<ForeignSource> getForeignSources(); ForeignSource getForeignSource(final String foreignSourceName); void save(final ForeignSource foreignSource); void delete(final ForeignSource foreignSource); Set<Requisition> getRequisitions(); Requisition getRequisition(final String foreignSourceName); Requisition getRequisition(final ForeignSource foreignSource); void save(final Requisition requisition); void delete(final Requisition requisition); void setRequisitionPath(final String path); void setForeignSourcePath(final String path); @Override Date getRequisitionDate(final String foreignSource); URL getRequisitionURL(final String foreignSource); @Override void flush(); }
FilesystemForeignSourceRepository extends AbstractForeignSourceRepository implements InitializingBean { public Requisition getRequisition(final String foreignSourceName) throws ForeignSourceRepositoryException { if (foreignSourceName == null) { throw new ForeignSourceRepositoryException("can't get a requisition with a null foreign source name!"); } m_readLock.lock(); try { final File inputFile = RequisitionFileUtils.encodeFileName(m_requisitionPath, foreignSourceName); if (inputFile != null && inputFile.exists()) { return RequisitionFileUtils.getRequisitionFromFile(inputFile); } return null; } finally { m_readLock.unlock(); } } FilesystemForeignSourceRepository(); @Override void afterPropertiesSet(); Set<String> getActiveForeignSourceNames(); int getForeignSourceCount(); Set<ForeignSource> getForeignSources(); ForeignSource getForeignSource(final String foreignSourceName); void save(final ForeignSource foreignSource); void delete(final ForeignSource foreignSource); Set<Requisition> getRequisitions(); Requisition getRequisition(final String foreignSourceName); Requisition getRequisition(final ForeignSource foreignSource); void save(final Requisition requisition); void delete(final Requisition requisition); void setRequisitionPath(final String path); void setForeignSourcePath(final String path); @Override Date getRequisitionDate(final String foreignSource); URL getRequisitionURL(final String foreignSource); @Override void flush();  }