@Override @Cacheable(value = "currentTenant", keyGenerator = "currentTenantKeyGenerator", cacheManager = "directCacheManager", unless = "#result == null") public String currentTenant() { final String initialTenantCreation = currentTenantCacheKeyGenerator.getCreateInitialTenant().get(); if (initialTenantCreation == null) { final TenantMetaData findByTenant = tenantMetaDataRepository .findByTenantIgnoreCase(tenantAware.getCurrentTenant()); return findByTenant != null ? findByTenant.getTenant() : null; } return initialTenantCreation; }
@Override @Cacheable(value = "currentTenant", keyGenerator = "currentTenantKeyGenerator", cacheManager = "directCacheManager", unless = "#result == null") public String currentTenant() { final String initialTenantCreation = currentTenantCacheKeyGenerator.getCreateInitialTenant().get(); if (initialTenantCreation == null) { final TenantMetaData findByTenant = tenantMetaDataRepository .findByTenantIgnoreCase(tenantAware.getCurrentTenant()); return findByTenant != null ? findByTenant.getTenant() : null; } return initialTenantCreation; }
private void resolveTenant(final DmfTenantSecurityToken securityToken) { if (securityToken.getTenant() == null) { securityToken.setTenant(systemSecurityContext .runAsSystem(() -> systemManagement.getTenantMetadata(securityToken.getTenantId()).getTenant())); } }
private DmfArtifact convertArtifact(final Target target, final Artifact localArtifact) { final DmfArtifact artifact = new DmfArtifact(); artifact.setUrls(artifactUrlHandler .getUrls(new URLPlaceholder(systemManagement.getTenantMetadata().getTenant(), systemManagement.getTenantMetadata().getId(), target.getControllerId(), target.getId(), new SoftwareData(localArtifact.getSoftwareModule().getId(), localArtifact.getFilename(), localArtifact.getId(), localArtifact.getSha1Hash())), ApiType.DMF) .stream().collect(Collectors.toMap(ArtifactUrl::getProtocol, ArtifactUrl::getRef))); artifact.setFilename(localArtifact.getFilename()); artifact.setHashes(new DmfArtifactHash(localArtifact.getSha1Hash(), localArtifact.getMd5Hash())); artifact.setSize(localArtifact.getSize()); return artifact; }
private static DdiArtifact createArtifact(final Target target, final ArtifactUrlHandler artifactUrlHandler, final Artifact artifact, final SystemManagement systemManagement, final HttpRequest request) { final DdiArtifact file = new DdiArtifact(); file.setHashes(new DdiArtifactHash(artifact.getSha1Hash(), artifact.getMd5Hash())); file.setFilename(artifact.getFilename()); file.setSize(artifact.getSize()); artifactUrlHandler .getUrls(new URLPlaceholder(systemManagement.getTenantMetadata().getTenant(), systemManagement.getTenantMetadata().getId(), target.getControllerId(), target.getId(), new SoftwareData(artifact.getSoftwareModule().getId(), artifact.getFilename(), artifact.getId(), artifact.getSha1Hash())), ApiType.DDI, request.getURI()) .forEach(entry -> file.add(new Link(entry.getRef()).withRel(entry.getRel()))); return file; }
private static DdiArtifact createArtifact(final Target target, final ArtifactUrlHandler artifactUrlHandler, final Artifact artifact, final SystemManagement systemManagement, final HttpRequest request) { final DdiArtifact file = new DdiArtifact(); file.setHashes(new DdiArtifactHash(artifact.getSha1Hash(), artifact.getMd5Hash())); file.setFilename(artifact.getFilename()); file.setSize(artifact.getSize()); artifactUrlHandler .getUrls(new URLPlaceholder(systemManagement.getTenantMetadata().getTenant(), systemManagement.getTenantMetadata().getId(), target.getControllerId(), target.getId(), new SoftwareData(artifact.getSoftwareModule().getId(), artifact.getFilename(), artifact.getId(), artifact.getSha1Hash())), ApiType.DDI, request.getURI()) .forEach(entry -> file.add(new Link(entry.getRef()).withRel(entry.getRel()))); return file; }