private DistributionSetType getDefaultDistributionSetType() { final TenantMetaData tenantMetaData = systemManagement.getTenantMetadata(); return tenantMetaData.getDefaultDsType(); }
@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 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 DistributionSetType getCurrentDistributionSetType() { return systemManagement.getTenantMetadata().getDefaultDsType(); } }
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; }
@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 DistributionSetType getDefaultDistributionSetType() { final TenantMetaData tenantMetaData = systemManagement.getTenantMetadata(); return tenantMetaData.getDefaultDsType(); }
private void resolveTenant(final DmfTenantSecurityToken securityToken) { if (securityToken.getTenant() == null) { securityToken.setTenant(systemSecurityContext .runAsSystem(() -> systemManagement.getTenantMetadata(securityToken.getTenantId()).getTenant())); } }
private DistributionSetType getCurrentDistributionSetType() { tenantMetaData = systemManagement.getTenantMetadata(); return tenantMetaData.getDefaultDsType(); }
private DistributionSetType getCurrentDistributionSetType() { return systemManagement.getTenantMetadata().getDefaultDsType(); } }
private DistributionSetType getCurrentDistributionSetType() { tenantMetaData = systemManagement.getTenantMetadata(); return tenantMetaData.getDefaultDsType(); }
@Override public ResponseEntity<List<MgmtDistributionSet>> createDistributionSets( @RequestBody final List<MgmtDistributionSetRequestBodyPost> sets) { LOG.debug("creating {} distribution sets", sets.size()); // set default Ds type if ds type is null final String defaultDsKey = systemSecurityContext .runAsSystem(systemManagement.getTenantMetadata().getDefaultDsType()::getKey); sets.stream().filter(ds -> ds.getType() == null).forEach(ds -> ds.setType(defaultDsKey)); final Collection<DistributionSet> createdDSets = distributionSetManagement .create(MgmtDistributionSetMapper.dsFromRequest(sets, entityFactory)); LOG.debug("{} distribution sets created, return status {}", sets.size(), HttpStatus.CREATED); return new ResponseEntity<>(MgmtDistributionSetMapper.toResponseDistributionSets(createdDSets), HttpStatus.CREATED); }
@Override @Transactional @Retryable(include = { ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY)) public DistributionSet create(final DistributionSetCreate c) { final JpaDistributionSetCreate create = (JpaDistributionSetCreate) c; if (create.getType() == null) { create.type(systemManagement.getTenantMetadata().getDefaultDsType().getKey()); } return distributionSetRepository.save(create.build()); }
@Override @Transactional @Retryable(include = { ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY)) public DistributionSet create(final DistributionSetCreate c) { final JpaDistributionSetCreate create = (JpaDistributionSetCreate) c; if (create.getType() == null) { create.type(systemManagement.getTenantMetadata().getDefaultDsType().getKey()); } return distributionSetRepository.save(create.build()); }