Search in sources :

Example 1 with ContentValidator

use of com.enonic.xp.content.ContentValidator in project xp by enonic.

the class ValidateContentDataCommand method execute.

ValidationErrors execute() {
    final ContentType contentType = contentTypeService.getByName(new GetContentTypeParams().contentTypeName(contentTypeName));
    Preconditions.checkArgument(contentType != null, "ContentType [%s] not found", contentTypeName);
    final ContentValidatorParams validatorParams = contentValidatorParamsBuilder.contentType(contentType).build();
    for (ContentValidator contentValidator : contentValidators) {
        if (contentValidator.supports(contentTypeName)) {
            contentValidator.validate(validatorParams, resultBuilder);
        }
    }
    return this.resultBuilder.build();
}
Also used : GetContentTypeParams(com.enonic.xp.schema.content.GetContentTypeParams) ContentValidatorParams(com.enonic.xp.content.ContentValidatorParams) ContentValidator(com.enonic.xp.content.ContentValidator) ContentType(com.enonic.xp.schema.content.ContentType)

Aggregations

ContentValidator (com.enonic.xp.content.ContentValidator)1 ContentValidatorParams (com.enonic.xp.content.ContentValidatorParams)1 ContentType (com.enonic.xp.schema.content.ContentType)1 GetContentTypeParams (com.enonic.xp.schema.content.GetContentTypeParams)1