Java Code Examples for org.sonatype.nexus.repository.routing.RoutingRule#description()
The following examples show how to use
org.sonatype.nexus.repository.routing.RoutingRule#description() .
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: RoutingRulesResource.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@PUT @Path("/{name}") @RequiresAuthentication @RequiresPermissions("nexus:*") public void updateRoutingRule(@PathParam("name") final String name, RoutingRuleXO routingRuleXO) { RoutingRule routingRule = routingRuleStore.getByName(name); if (null == routingRule) { throw new WebApplicationException(Status.NOT_FOUND); } routingRule.name(routingRuleXO.getName()); routingRule.description(routingRuleXO.getDescription()); routingRule.mode(routingRuleXO.getMode()); routingRule.matchers(routingRuleXO.getMatchers()); routingRuleStore.update(routingRule); }
Example 2
Source File: RoutingRulesResource.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
private RoutingRule fromXO(RoutingRuleXO routingRuleXO) { final RoutingRule routingRule = routingRuleStore.newRoutingRule(); routingRule.name(routingRuleXO.getName()); routingRule.description(routingRuleXO.getDescription()); routingRule.mode(routingRuleXO.getMode()); routingRule.matchers(routingRuleXO.getMatchers()); return routingRule; }
Example 3
Source File: RoutingRulesApiResource.java From nexus-public with Eclipse Public License 1.0 | 5 votes |
@Override @POST @RequiresAuthentication @RequiresPermissions("nexus:*") public void createRoutingRule(@NotNull final RoutingRuleXO routingRuleXO) { final RoutingRule routingRule = routingRuleStore.newRoutingRule(); routingRule.name(routingRuleXO.getName()); routingRule.description(routingRuleXO.getDescription()); routingRule.mode(routingRuleXO.getMode()); routingRule.matchers(routingRuleXO.getMatchers()); routingRuleStore.create(routingRule); }
Example 4
Source File: OrientRoutingRuleStore.java From nexus-public with Eclipse Public License 1.0 | 4 votes |
@VisibleForTesting static void validate(final RoutingRule rule) { // NOSONAR ValidationErrorsException exception = new ValidationErrorsException(); if (Strings2.isBlank(rule.name())) { exception.withError("name", "A non-empty value must be specified"); } else if (!rule.name().matches(NamePatternConstants.REGEX)) { exception.withError("name", "Only letters, digits, underscores(_), hyphens(-), and dots(.) are allowed and may not start with underscore or dot."); } else if (rule.name().equalsIgnoreCase(NONE)) { exception.withError("name", "Rule must not be named None"); } if (rule.description() == null) { exception.withError("description", "A non-null value must be specified"); } if (rule.mode() == null) { exception.withError("mode", "A non-empty value must be specified"); } if (rule.matchers() == null || rule.matchers().isEmpty()) { exception.withError("matchers", "At least one rule must be specified"); } else { int index = 0; for (String regex : rule.matchers()) { if (Strings2.isBlank(regex)) { exception.withError("matchers[" + index + "]", "Empty matchers are not allowed"); } else { try { Pattern.compile(regex); } catch (PatternSyntaxException e) { // NOSONAR exception.withError("matchers[" + index + "]", "Invalid regex: " + e.getMessage()); } } index++; } } if (!exception.getValidationErrors().isEmpty()) { throw exception; } }
Example 5
Source File: RoutingRuleStoreImpl.java From nexus-public with Eclipse Public License 1.0 | 4 votes |
@VisibleForTesting static RoutingRule validate(final RoutingRule rule) { // NOSONAR ValidationErrorsException exception = new ValidationErrorsException(); if (Strings2.isBlank(rule.name())) { exception.withError(NAME, "A non-empty value must be specified"); } else if (!rule.name().matches(NamePatternConstants.REGEX)) { exception.withError(NAME, "Only letters, digits, underscores(_), hyphens(-), and dots(.) are allowed and may not start with underscore or dot."); } else if (rule.name().equalsIgnoreCase(NONE)) { exception.withError(NAME, "Rule must not be named None"); } if (rule.description() == null) { exception.withError(DESCRIPTION, "A non-null value must be specified"); } if (rule.mode() == null) { exception.withError(MODE, "A non-empty value must be specified"); } if (rule.matchers() == null || rule.matchers().isEmpty()) { exception.withError(MATCHERS, "At least one rule must be specified"); } else { int index = 0; for (String regex : rule.matchers()) { if (Strings2.isBlank(regex)) { exception.withError(MATCHERS + "[" + index + "]", "Empty matchers are not allowed"); } else { try { Pattern.compile(regex); } catch (PatternSyntaxException e) { // NOSONAR exception.withError(MATCHERS + "[" + index + "]", "Invalid regex: " + e.getMessage()); } } index++; } } if (!exception.getValidationErrors().isEmpty()) { throw exception; } return rule; }