private BinaryData getBinaryData( ContentBinaryDataEntity contentBinaryData, boolean anonAccess, long timestamp) { BinaryData binaryData = new BinaryData(); binaryData.key = contentBinaryData.getBinaryData().getKey(); binaryData.contentKey = contentBinaryData.getContentVersion().getContent().getKey().toInt(); binaryData.setSafeFileName(contentBinaryData.getBinaryData().getName()); binaryData.timestamp = contentBinaryData.getBinaryData().getCreatedAt(); binaryData.anonymousAccess = anonAccess; if (binaryData.timestamp.getTime() > timestamp) { BlobRecord blob = this.binaryDataDao.getBlob(contentBinaryData.getBinaryData()); binaryData.data = blob.getAsBytes(); } return binaryData; }
private BinaryData createBinaryData(ContentBinaryDataEntity contentBinaryData) { boolean anonAccess = contentBinaryData .getContentVersion() .getContent() .hasAccessRightSet( securityService.getAnonymousUser().getUserGroup(), ContentAccessType.READ); BinaryData binaryData = new BinaryData(); binaryData.key = contentBinaryData.getBinaryData().getKey(); binaryData.contentKey = contentBinaryData.getContentVersion().getContent().getKey().toInt(); binaryData.setSafeFileName(contentBinaryData.getBinaryData().getName()); binaryData.timestamp = contentBinaryData.getBinaryData().getCreatedAt(); binaryData.anonymousAccess = anonAccess; BlobRecord blob = this.binaryDataDao.getBlob(contentBinaryData.getBinaryData()); binaryData.data = blob.getAsBytes(); return binaryData; }