private EnumSet<Status> getActionStatus() { final TenantConfigurationValue<String> statusStr = getConfigValue(ACTION_CLEANUP_ACTION_STATUS, String.class); if (statusStr != null) { return Arrays.stream(statusStr.getValue().split("[;,]")).map(Status::valueOf) .collect(Collectors.toCollection(() -> EnumSet.noneOf(Status.class))); } return EMPTY_STATUS_SET; }
static MgmtSystemTenantConfigurationValue toResponse(final String key, final TenantConfigurationValue<?> repoConfValue) { final MgmtSystemTenantConfigurationValue restConfValue = new MgmtSystemTenantConfigurationValue(); restConfValue.setValue(repoConfValue.getValue()); restConfValue.setGlobal(repoConfValue.isGlobal()); restConfValue.setCreatedAt(repoConfValue.getCreatedAt()); restConfValue.setCreatedBy(repoConfValue.getCreatedBy()); restConfValue.setLastModifiedAt(repoConfValue.getLastModifiedAt()); restConfValue.setLastModifiedBy(repoConfValue.getLastModifiedBy()); restConfValue.add( linkTo(methodOn(MgmtTenantManagementResource.class).getTenantConfigurationValue(key)).withSelfRel()); return restConfValue; } }
final Class<T> clazzT = (Class<T>) value.getClass(); return TenantConfigurationValue.<T> builder().global(false).createdBy(updatedTenantConfiguration.getCreatedBy()) .createdAt(updatedTenantConfiguration.getCreatedAt()) .lastModifiedAt(updatedTenantConfiguration.getLastModifiedAt())
final Class<T> clazzT = (Class<T>) value.getClass(); return TenantConfigurationValue.<T> builder().global(false).createdBy(updatedTenantConfiguration.getCreatedBy()) .createdAt(updatedTenantConfiguration.getCreatedAt()) .lastModifiedAt(updatedTenantConfiguration.getLastModifiedAt())
private EnumSet<Status> getActionStatus() { final TenantConfigurationValue<String> statusStr = readConfigValue(ACTION_CLEANUP_ACTION_STATUS, String.class); if (statusStr != null) { return Arrays.stream(statusStr.getValue().split("[;,]")).map(Status::valueOf) .collect(Collectors.toCollection(() -> EnumSet.noneOf(Status.class))); } return EMPTY_STATUS_SET; }
@Override public <T extends Serializable> TenantConfigurationValue<T> buildTenantConfigurationValueByKey( final TenantConfigurationKey configurationKey, final Class<T> propertyType, final TenantConfiguration tenantConfiguration) { if (tenantConfiguration != null) { return TenantConfigurationValue.<T> builder().global(false).createdBy(tenantConfiguration.getCreatedBy()) .createdAt(tenantConfiguration.getCreatedAt()) .lastModifiedAt(tenantConfiguration.getLastModifiedAt()) .lastModifiedBy(tenantConfiguration.getLastModifiedBy()) .value(conversionService.convert(tenantConfiguration.getValue(), propertyType)).build(); } else if (configurationKey.getDefaultValue() != null) { return TenantConfigurationValue.<T> builder().global(true).createdBy(null).createdAt(null) .lastModifiedAt(null).lastModifiedBy(null) .value(getGlobalConfigurationValue(configurationKey.getKeyName(), propertyType)).build(); } return null; }
private long getActionExpiry() { return TimeUnit.MILLISECONDS.toDays(readConfigValue(ACTION_CLEANUP_ACTION_EXPIRY, Long.class).getValue()); }
@Override public <T extends Serializable> TenantConfigurationValue<T> buildTenantConfigurationValueByKey( final TenantConfigurationKey configurationKey, final Class<T> propertyType, final TenantConfiguration tenantConfiguration) { if (tenantConfiguration != null) { return TenantConfigurationValue.<T> builder().global(false).createdBy(tenantConfiguration.getCreatedBy()) .createdAt(tenantConfiguration.getCreatedAt()) .lastModifiedAt(tenantConfiguration.getLastModifiedAt()) .lastModifiedBy(tenantConfiguration.getLastModifiedBy()) .value(conversionService.convert(tenantConfiguration.getValue(), propertyType)).build(); } else if (configurationKey.getDefaultValue() != null) { return TenantConfigurationValue.<T> builder().global(true).createdBy(null).createdAt(null) .lastModifiedAt(null).lastModifiedBy(null) .value(getGlobalConfigurationValue(configurationKey.getKeyName(), propertyType)).build(); } return null; }
private EnumSet<Status> getActionStatus() { final TenantConfigurationValue<String> statusStr = readConfigValue(ACTION_CLEANUP_ACTION_STATUS, String.class); if (statusStr != null) { return Arrays.stream(statusStr.getValue().split("[;,]")).map(Status::valueOf) .collect(Collectors.toCollection(() -> EnumSet.noneOf(Status.class))); } return EMPTY_STATUS_SET; }
private boolean isEnabled() { final TenantConfigurationValue<Boolean> isEnabled = getConfigValue(ACTION_CLEANUP_ENABLED, Boolean.class); return isEnabled != null ? isEnabled.getValue() : ACTION_CLEANUP_ENABLED_DEFAULT; }
private long getExpiry() { final TenantConfigurationValue<Long> expiry = getConfigValue(ACTION_CLEANUP_ACTION_EXPIRY, Long.class); return expiry != null ? expiry.getValue() : ACTION_CLEANUP_ACTION_EXPIRY_DEFAULT; }
private boolean isEnabled() { final TenantConfigurationValue<Boolean> isEnabled = getConfigValue(ACTION_CLEANUP_ENABLED, Boolean.class); return isEnabled != null ? isEnabled.getValue() : ACTION_CLEANUP_ENABLED_DEFAULT; }
private EnumSet<Status> getActionStatus() { final TenantConfigurationValue<String> statusStr = getConfigValue(ACTION_CLEANUP_ACTION_STATUS, String.class); if (statusStr != null) { return Arrays.stream(statusStr.getValue().split("[;,]")).map(Status::valueOf) .collect(Collectors.toCollection(() -> EnumSet.noneOf(Status.class))); } return EMPTY_STATUS_SET; }
private long getExpiry() { final TenantConfigurationValue<Long> expiry = getConfigValue(ACTION_CLEANUP_ACTION_EXPIRY, Long.class); return expiry != null ? expiry.getValue() : ACTION_CLEANUP_ACTION_EXPIRY_DEFAULT; }
private long getActionExpiry() { return TimeUnit.MILLISECONDS.toDays(readConfigValue(ACTION_CLEANUP_ACTION_EXPIRY, Long.class).getValue()); }
/** * Returns true, if rollout approval is enabled and rollout creator doesn't have * approval role. */ @Override public boolean isApprovalNeeded(final Rollout rollout) { final UserDetails userDetails = this.getActor(rollout); final boolean approvalEnabled = this.tenantConfigurationManagement .getConfigurationValue(TenantConfigurationKey.ROLLOUT_APPROVAL_ENABLED, Boolean.class).getValue(); return approvalEnabled && userDetails.getAuthorities().stream() .noneMatch(authority -> SpPermission.APPROVE_ROLLOUT.equals(authority.getAuthority())); }