org.sonatype.nexus.cleanup.config.CleanupPolicyConfiguration Java Examples
The following examples show how to use
org.sonatype.nexus.cleanup.config.CleanupPolicyConfiguration.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CleanupPolicyComponent.java From nexus-public with Eclipse Public License 1.0 | 6 votes |
/** * Load configuration to check whether a field should be enabled for a given format */ @DirectMethod @Timed @ExceptionMetered @RequiresAuthentication @RequiresPermissions("nexus:*") @Validate public Map<String, Map<String, Boolean>> getApplicableFields(final List<String> fields) { Map<String, Map<String, Boolean>> applicability = new HashMap<>(); for (Entry<String, CleanupPolicyConfiguration> config : cleanupPolicyConfiguration.entrySet()) { String format = config.getKey(); Map<String, Boolean> fieldApplicability = fields.stream() .collect(toMap(identity(), f -> isFieldApplicable(format, f))); applicability.put(format, fieldApplicability); } return applicability; }
Example #2
Source File: CleanupPolicyComponent.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Inject public CleanupPolicyComponent(final CleanupPolicyStorage cleanupPolicyStorage, final RepositoryManager repositoryManager, final Map<String, CleanupPolicyConfiguration> cleanupPolicyConfiguration, final RepositoryPermissionChecker repositoryPermissionChecker) { this.cleanupPolicyStorage = checkNotNull(cleanupPolicyStorage); this.repositoryManager = checkNotNull(repositoryManager); this.cleanupPolicyConfiguration = checkNotNull(cleanupPolicyConfiguration); this.defaultCleanupPolicyConfiguration = checkNotNull(cleanupPolicyConfiguration.get("default")); this.repositoryPermissionChecker = repositoryPermissionChecker; }
Example #3
Source File: CleanupPolicyComponent.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
private boolean isFieldApplicable(final @NotEmpty String format, final String field) { CleanupPolicyConfiguration config = cleanupPolicyConfiguration.get(format); if (!config.getConfiguration().containsKey(field)) { return defaultCleanupPolicyConfiguration.getConfiguration().get(field); } return config.getConfiguration().get(field); }