@Test void testCorrectionWithExplicitApplyNamespaceFalse() { ApplicationNameValidator applicationNameValidator = new ApplicationNameValidator(NAMESPACE, true); String result = (String) applicationNameValidator.attemptToCorrect(APPLICATION_NAME, CONTEXT_DO_NOT_APPLY_NAMESPACE); assertEquals(APPLICATION_NAME, result); }
@Override public Object attemptToCorrect(Object applicationName, final Map<String, Object> relatedParameters) { if (!(applicationName instanceof String)) { throw new ContentException(Messages.COULD_NOT_CREATE_VALID_APPLICATION_NAME_FROM_0, applicationName); } boolean applyNamespaceLocal = MapUtil.parseBooleanFlag(relatedParameters, SupportedParameters.APPLY_NAMESPACE, true); boolean applyNamespace = applyNamespaceGlobal && applyNamespaceLocal; return NameUtil.computeValidApplicationName((String) applicationName, namespace, applyNamespace); }
ApplicationNameValidator implements ParameterValidator { @Override public Object attemptToCorrect(Object applicationName, final Map<String, Object> relatedParameters) { if (!(applicationName instanceof String)) { throw new ContentException(Messages.COULD_NOT_CREATE_VALID_APPLICATION_NAME_FROM_0, applicationName); } boolean applyNamespaceLocal = MapUtil.parseBooleanFlag(relatedParameters, SupportedParameters.APPLY_NAMESPACE, true); boolean applyNamespace = applyNamespaceGlobal && applyNamespaceLocal; return NameUtil.computeValidApplicationName((String) applicationName, namespace, applyNamespace); } }
ApplicationNameValidator implements ParameterValidator { @Override public Object attemptToCorrect(Object applicationName, final Map<String, Object> relatedParameters) { if (!(applicationName instanceof String)) { throw new ContentException(Messages.COULD_NOT_CREATE_VALID_APPLICATION_NAME_FROM_0, applicationName); } boolean applyNamespaceLocal = MapUtil.parseBooleanFlag(relatedParameters, SupportedParameters.APPLY_NAMESPACE, true); boolean applyNamespace = applyNamespaceGlobal && applyNamespaceLocal; return NameUtil.computeValidApplicationName((String) applicationName, namespace, applyNamespace); } ApplicationNameValidator(String namespace, boolean applyNamespace); }
ApplicationNameValidator implements ParameterValidator { @Override public Object attemptToCorrect(Object applicationName, final Map<String, Object> relatedParameters) { if (!(applicationName instanceof String)) { throw new ContentException(Messages.COULD_NOT_CREATE_VALID_APPLICATION_NAME_FROM_0, applicationName); } boolean applyNamespaceLocal = MapUtil.parseBooleanFlag(relatedParameters, SupportedParameters.APPLY_NAMESPACE, true); boolean applyNamespace = applyNamespaceGlobal && applyNamespaceLocal; return NameUtil.computeValidApplicationName((String) applicationName, namespace, applyNamespace); } ApplicationNameValidator(String namespace, boolean applyNamespace); @Override Class<?> getContainerType(); @Override String getParameterName(); @Override boolean isValid(Object applicationName, final Map<String, Object> context); @Override boolean canCorrect(); @Override Object attemptToCorrect(Object applicationName, final Map<String, Object> relatedParameters); @Override Set<String> getRelatedParameterNames(); }
ApplicationNameValidator implements ParameterValidator { @Override public Object attemptToCorrect(Object applicationName, final Map<String, Object> relatedParameters) { if (!(applicationName instanceof String)) { throw new ContentException(Messages.COULD_NOT_CREATE_VALID_APPLICATION_NAME_FROM_0, applicationName); } boolean applyNamespaceLocal = MapUtil.parseBooleanFlag(relatedParameters, SupportedParameters.APPLY_NAMESPACE, true); boolean applyNamespace = applyNamespaceGlobal && applyNamespaceLocal; return NameUtil.computeValidApplicationName((String) applicationName, namespace, applyNamespace); } ApplicationNameValidator(String namespace, boolean applyNamespace); @Override Class<?> getContainerType(); @Override String getParameterName(); @Override boolean isValid(Object applicationName, final Map<String, Object> context); @Override boolean canCorrect(); @Override Object attemptToCorrect(Object applicationName, final Map<String, Object> relatedParameters); @Override Set<String> getRelatedParameterNames();  }