private static String getSchemaAccessStrategyName(final String schemaAccessValue, final List<AllowableValue> schemaAccessStrategyValues) { for (final AllowableValue allowableValue : schemaAccessStrategyValues) { if (allowableValue.getValue().equalsIgnoreCase(schemaAccessValue)) { return allowableValue.getDisplayName(); } } return null; }
@Override protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) { if (!validationContext.getProperty(ARRAY_WRAPPING).getValue().equals(NO_WRAPPING.getValue())) { if (!validationContext.getProperty(ARRAY_TAG_NAME).isSet()) { StringBuilder explanation = new StringBuilder() .append("if property \'") .append(ARRAY_WRAPPING.getName()) .append("\' is defined as \'") .append(USE_PROPERTY_AS_WRAPPER.getDisplayName()) .append("\' or \'") .append(USE_PROPERTY_FOR_ELEMENTS.getDisplayName()) .append("\' the property \'") .append(ARRAY_TAG_NAME.getDisplayName()) .append("\' has to be set."); return Collections.singleton(new ValidationResult.Builder() .subject(ARRAY_TAG_NAME.getName()) .valid(false) .explanation(explanation.toString()) .build()); } } return Collections.emptyList(); }
MOVE_DESTINATION_DIR.getDisplayName(), COMPLETION_STRATEGY.getDisplayName(), COMPLETION_MOVE.getDisplayName(), MOVE_CREATE_DIRECTORY.getDisplayName(), SFTPTransfer.DISABLE_DIRECTORY_LISTING.getDescription())).build();
for (AllowableValue value : property.getAllowableValues()) { xmlStreamWriter.writeStartElement("li"); xmlStreamWriter.writeCharacters(value.getDisplayName());
private static void validateRequiredProperty(ValidationContext context, Collection<ValidationResult> results, PropertyDescriptor property) { if (!context.getProperty(property).isSet()) { final String displayName = property.getDisplayName(); results.add(new ValidationResult.Builder() .subject(displayName) .explanation(format("'%s' is required to use '%s' listing strategy", displayName, AbstractListProcessor.BY_ENTITIES.getDisplayName())) .valid(false) .build()); } }
@Override protected Collection<ValidationResult> customValidate(ValidationContext validationContext) { final List<ValidationResult> problems = new ArrayList<>(super.customValidate(validationContext)); final boolean isWriterSet = validationContext.getProperty(RECORD_WRITER).isSet(); if (validationContext.getProperty(FORMAT).getValue().equals(RECORD_FORMAT.getValue()) && !isWriterSet) { problems.add(new ValidationResult.Builder() .input("Record Writer") .valid(false) .explanation("If using " + RECORD_FORMAT.getDisplayName() + ", a record writer needs to be set.") .build()); } if (validationContext.getProperty(FORMAT).getValue().equals(AMBARI_FORMAT.getValue()) && isWriterSet) { problems.add(new ValidationResult.Builder() .input("Record Writer") .valid(false) .explanation("If using " + AMBARI_FORMAT.getDisplayName() + ", no record writer should be set.") .build()); } return problems; }
@Override protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) { final List<ValidationResult> results = new ArrayList<>(); if (COMPLETION_MOVE.getValue().equalsIgnoreCase(validationContext.getProperty(COMPLETION_STRATEGY).getValue())) { if (!validationContext.getProperty(MOVE_DESTINATION_DIR).isSet()) { results.add(new ValidationResult.Builder().subject(MOVE_DESTINATION_DIR.getName()).input(null).valid(false).explanation( MOVE_DESTINATION_DIR.getName() + " must be specified if " + COMPLETION_STRATEGY.getName() + " is set to " + COMPLETION_MOVE.getDisplayName()).build()); } } return results; }
static void validateProperties(ValidationContext context, Collection<ValidationResult> results, Scope scope) { validateRequiredProperty(context, results, ListedEntityTracker.TRACKING_STATE_CACHE); validateRequiredProperty(context, results, ListedEntityTracker.TRACKING_TIME_WINDOW); if (Scope.LOCAL.equals(scope) && StringUtils.isEmpty(context.getProperty(NODE_IDENTIFIER).evaluateAttributeExpressions().getValue())) { results.add(new ValidationResult.Builder() .subject(NODE_IDENTIFIER.getDisplayName()) .explanation(format("'%s' is required to use local scope with '%s' listing strategy", NODE_IDENTIFIER.getDisplayName(), AbstractListProcessor.BY_ENTITIES.getDisplayName())) .build()); } }
for (final AllowableValue allowableValue : propertyDescriptor.getAllowableValues()) { final AllowableValueDTO allowableValueDto = new AllowableValueDTO(); allowableValueDto.setDisplayName(allowableValue.getDisplayName()); allowableValueDto.setValue(allowableValue.getValue()); allowableValueDto.setDescription(allowableValue.getDescription());
private static String getSchemaAccessStrategyName(final String schemaAccessValue, final List<AllowableValue> schemaAccessStrategyValues) { for (final AllowableValue allowableValue : schemaAccessStrategyValues) { if (allowableValue.getValue().equalsIgnoreCase(schemaAccessValue)) { return allowableValue.getDisplayName(); } } return null; }
MOVE_DESTINATION_DIR.getDisplayName(), COMPLETION_STRATEGY.getDisplayName(), COMPLETION_MOVE.getDisplayName(), MOVE_CREATE_DIRECTORY.getDisplayName(), SFTPTransfer.DISABLE_DIRECTORY_LISTING.getDescription())).build();
@Override protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) { final List<ValidationResult> results = new ArrayList<>(); if (COMPLETION_MOVE.getValue().equalsIgnoreCase(validationContext.getProperty(COMPLETION_STRATEGY).getValue())) { if (!validationContext.getProperty(MOVE_DESTINATION_DIR).isSet()) { results.add(new ValidationResult.Builder().subject(MOVE_DESTINATION_DIR.getName()).input(null).valid(false).explanation( MOVE_DESTINATION_DIR.getName() + " must be specified if " + COMPLETION_STRATEGY.getName() + " is set to " + COMPLETION_MOVE.getDisplayName()).build()); } } return results; }
@Override protected Collection<ValidationResult> customValidate(ValidationContext validationContext) { final List<ValidationResult> problems = new ArrayList<>(super.customValidate(validationContext)); final boolean isWriterSet = validationContext.getProperty(RECORD_WRITER).isSet(); if (validationContext.getProperty(FORMAT).getValue().equals(RECORD_FORMAT.getValue()) && !isWriterSet) { problems.add(new ValidationResult.Builder() .input("Record Writer") .valid(false) .explanation("If using " + RECORD_FORMAT.getDisplayName() + ", a record writer needs to be set.") .build()); } if (validationContext.getProperty(FORMAT).getValue().equals(AMBARI_FORMAT.getValue()) && isWriterSet) { problems.add(new ValidationResult.Builder() .input("Record Writer") .valid(false) .explanation("If using " + AMBARI_FORMAT.getDisplayName() + ", no record writer should be set.") .build()); } return problems; }