All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.infomaximum.platform.querypool.RemovableResource Maven / Gradle / Ivy

The newest version!
package com.infomaximum.platform.querypool;

import com.infomaximum.database.domainobject.DomainObject;
import com.infomaximum.database.domainobject.DomainObjectEditable;
import com.infomaximum.database.domainobject.filter.Filter;
import com.infomaximum.platform.exception.PlatformException;
import com.infomaximum.platform.querypool.iterator.IteratorEntity;

public interface RemovableResource extends EditableResource {

    void remove(T obj, QueryTransaction transaction) throws PlatformException;

    void clear(QueryTransaction transaction) throws PlatformException;

    default boolean removeAll(Filter filter, QueryTransaction transaction) throws PlatformException {
        boolean result = false;
        try (IteratorEntity i = findAll(filter, transaction)) {
            while (i.hasNext()) {
                remove(i.next(), transaction);
                result = true;
            }
        }
        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy