try {
ConvMetadata metadata = convMetadataStore.get(tx, slobId);
if (metadata.hasImportMetadata()
&& !metadata.getImportMetadata().getImportFinished()) {
log.info(slobId + " still importing; " + participantId + " may not access");
return new Permissions(false, false);
}
// Can't use SlobStore here, that would be a cyclic dependency.
MutationLog mutationLog = convSlobFacilities.getMutationLogFactory()
.create(tx, slobId);
StateAndVersion stateAndVersion = mutationLog.reconstruct(null);
if (stateAndVersion.getVersion() == 0) {
log.info(slobId + " does not exist; " + participantId + " may not access");
return new Permissions(false, false);
}
// TODO(ohler): introduce generics to avoid the cast.
ReadableWaveletObject wavelet = (ReadableWaveletObject) stateAndVersion.getState();
if (wavelet.getParticipants().contains(participantId)) {
log.info(slobId + " exists and " + participantId + " is on the participant list");
return new Permissions(true, true);
} else {
log.info(slobId + " exists but "
+ participantId + " is not on the participant list");
return new Permissions(false, false);
}
} finally {
tx.close();
}
}