public boolean doWeWantThis(BulletinMirroringInformation mirroringInfo) { // TODO handle delete requests when we are propagating deletes, DatabaseKey key = getDatabaseKey(mirroringInfo); if (store.isHidden(key)) return false; UniversalId uid = mirroringInfo.getUid(); DatabaseKey sealedKey = DatabaseKey.createSealedKey(uid); if (store.doesBulletinRevisionExist(sealedKey)) return false; try { if (mirroringInfo.isSealed()) return (!store.doesBulletinRevisionExist(key)); if (store.doesBulletinDelRecordExist(DeleteRequestRecord.getDelKey(uid))) { DeleteRequestRecord delRecord = new DeleteRequestRecord(store.getDatabase(), uid, store.getSignatureVerifier()); if (delRecord.isBefore(mirroringInfo.mTime)) return true; return false; } if (!store.doesBulletinRevisionExist(key)) return true; long currentBulletinsmTime = store.getDatabase().getmTime(key); if (mirroringInfo.getmTime() > currentBulletinsmTime) return true; return false; } catch (Exception e) { logError(e.getMessage(), e); } return false; }
private DatabaseKey getDatabaseKey(BulletinMirroringInformation mirroringInfo) { DatabaseKey key = null; if (mirroringInfo.isSealed()) key = DatabaseKey.createSealedKey(mirroringInfo.getUid()); else if (mirroringInfo.isDraft()) key = DatabaseKey.createDraftKey(mirroringInfo.getUid()); return key; }