com.kenshoo.pl.entity.InsertOnDuplicateUpdateCommand 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;
import static com.kenshoo.pl.entity.ChangeOperation.CREATE;
import static com.kenshoo.pl.entity.ChangeOperation.UPDATE;
public class InsertOnDuplicateUpdateCommand, ID extends Identifier> extends UpdateEntityCommand {
    private ChangeOperation changeOperation = UPDATE;
    private boolean allowMissingEntity = true;
    public InsertOnDuplicateUpdateCommand(E entityType, ID key) {
        super(entityType, key);
    }
    @Override
    public ChangeOperation getChangeOperation() {
        return changeOperation;
    }
    @Override
    public boolean allowMissingEntity() {
        return allowMissingEntity;
    }
    @Override
    public void updateOperator(ChangeOperation changeOperation) {
        if (this.changeOperation == UPDATE && changeOperation == CREATE) {
            this.changeOperation = changeOperation;
            this.allowMissingEntity = false;
            ChangeEntityCommand.copy(this, this.getIdentifier());
            this.getChildren().forEach(child -> child.updateOperator(changeOperation));
        } else {
            throw new UnsupportedOperationException("Unsupported update change operation from " + this.changeOperation + " to " + changeOperation);
        }
    }
}
       © 2015 - 2025 Weber Informatics LLC | Privacy Policy