URL createSnapshot() throws MalformedURLException { flush(); final Requisition pending = getPendingForeignSourceRepository().getRequisition(getForeignSource()); final Requisition deployed = getDeployedForeignSourceRepository().getRequisition(getForeignSource()); final URL activeUrl = pending == null || (deployed != null && deployed.getDateStamp().compare(pending.getDateStamp()) > -1) ? getDeployedForeignSourceRepository().getRequisitionURL(getForeignSource()) : RequisitionFileUtils.createSnapshot( getPendingForeignSourceRepository(), getForeignSource(), pending.getDate()) .toURI() .toURL(); return activeUrl; }
public Requisition getActiveRequisition(final boolean createIfMissing) { if (m_pending != null) { return m_pending; } final Requisition pending = RequisitionFileUtils.getLatestPendingOrSnapshotRequisition( getPendingForeignSourceRepository(), m_foreignSource); final Requisition deployed = getDeployedForeignSourceRepository().getRequisition(m_foreignSource); if (pending == null && deployed == null && createIfMissing) { return new Requisition(m_foreignSource); } else if (pending == null) { return deployed; } else if (deployed == null) { return pending; } else if (deployed.getDate().after(pending.getDate())) { // deployed is newer than pending return deployed; } return pending; }