@Override public ContentAvaiability getContentAvailability(ResourceMetadataSearchResult metadata) { ElementLicenseResponse response = licenseResolver.fetchContentLicense(metadata); return response.getAvailability(); }
@Override public boolean shouldProcess(ElementMetadata metadata) { String dataset = TagUtils.getTag(RepositoryStoreConstants.TAG_NAME_DATASET, metadata.getTags()); if (!datasets.contains(dataset)) { return false; } ElementLicenseResponse response = licenseResolver.fetchContentLicense(metadata); return response.getAvailability() == ContentAvaiability.FORBIDDEN; }
@Override public String getNoAccessReason(ElementMetadata metadata) { ElementLicenseResponse response = licenseResolver.fetchContentLicense(metadata); UnauthorizedInformation information = response.getInformation(); if (response.getAvailability() == ContentAvaiability.AVAILABLE || information == null) { return StringUtils.EMPTY; } return getMessage(information); }
@Override public ContentAvaiability getContentAvailability(ElementMetadata metadata) { YElement element = (YElement) metadata.getContent(); if(!YMODEL_PROPERTYE_XTRACTOR.isContentAvailable(element)){ return ContentAvaiability.NOT_AVAILABLE; } ElementLicenseResponse response = licenseResolver.fetchContentLicense(metadata); return response.getAvailability(); }
private ElementContent fetchLicensedContent(final String objectId, final String contentPath, final ElementMetadata elementMetadata) { ElementLicenseResponse response = licenseResolver.fetchContentLicense(elementMetadata); switch (response.getAvailability()) { case AVAILABLE: ElementContent content = repositoryFacade.fetchContent(objectId, contentPath); auditServiceFacade.addDownload(elementMetadata, response, content.getContentType()); return content; default: } throw new AccessViolationException(objectId); }
@Override public ElementMetadata fetchElementMetadata(final String objectId) { ElementMetadata elementMetadata = repositoryFacade.fetchElementMetadata(objectId); ElementLicenseResponse response = licenseResolver.fetchMetadataLicense(elementMetadata); if (response.getAvailability() != ContentAvaiability.AVAILABLE) { throw new AccessViolationException(objectId); } if(metadataPostProcessors != null){ for(ElementMetadataPostProcessor postProcessor:metadataPostProcessors){ if(postProcessor.shouldProcess(elementMetadata)){ elementMetadata = postProcessor.postProcess(elementMetadata); } } } return elementMetadata; }