com.kenshoo.pl.entity.spi.helpers.CompoundChangesValidator Maven / Gradle / Ivy
                 Go to download
                
        
                    Show more of this group  Show more artifacts with this name
Show all versions of persistence-layer Show documentation
                Show all versions of persistence-layer Show documentation
A Java persistence layer based on JOOQ for high performance and business flow support.
                
             The newest version!
        
        package com.kenshoo.pl.entity.spi.helpers;
import com.google.common.collect.Lists;
import com.kenshoo.pl.entity.ChangeContext;
import com.kenshoo.pl.entity.ChangeEntityCommand;
import com.kenshoo.pl.entity.ChangeOperation;
import com.kenshoo.pl.entity.EntityChange;
import com.kenshoo.pl.entity.EntityField;
import com.kenshoo.pl.entity.EntityType;
import com.kenshoo.pl.entity.spi.ChangesValidator;
import com.kenshoo.pl.entity.spi.CurrentStateConsumer;
import java.util.Collection;
import java.util.List;
import java.util.stream.Stream;
public class CompoundChangesValidator> implements ChangesValidator {
    private final List> changesValidators = Lists.newArrayList();
    public void register(ChangesValidator changesValidator) {
        changesValidators.add(changesValidator);
    }
    @Override
    public void validate(Collection extends EntityChange> entityChanges, ChangeOperation changeOperation, ChangeContext changeContext) {
        changesValidators.stream().
                filter(CurrentStateConsumer.supporting(changeOperation)).
                    forEach(validator -> validator.validate(entityChanges, changeOperation, changeContext));
    }
    @Override
    public Stream extends EntityField, ?>> requiredFields(Collection extends EntityField> fieldsToUpdate, ChangeOperation changeOperation) {
        return changesValidators.stream()
                .filter(CurrentStateConsumer.supporting(changeOperation))
                .flatMap(changesValidator -> changesValidator.requiredFields(fieldsToUpdate, changeOperation));
    }
}
          © 2015 - 2025 Weber Informatics LLC | Privacy Policy