
win.doyto.query.service.AssociativeService Maven / Gradle / Ivy
package win.doyto.query.service;
import java.util.Collection;
import java.util.List;
import static java.util.Collections.singleton;
/**
* AssociativeService
*
* @author f0rb on 2019-05-30
*/
public interface AssociativeService {
List getByLeftId(L leftId);
void deleteByLeftId(L leftId);
List getByRightId(R rightId);
void deleteByRightId(R rightId);
boolean exists(Collection leftIds, Collection rightIds);
default boolean exists(L leftId, R rightId) {
return exists(leftId, singleton(rightId));
}
default boolean exists(L leftId, Collection rightIds) {
return exists(singleton(leftId), rightIds);
}
default boolean exists(Collection leftIds, R rightId) {
return exists(leftIds, singleton(rightId));
}
long count(Collection leftIds, Collection rightIds);
default int allocate(L leftId, R rightId) {
return allocate(leftId, singleton(rightId));
}
int allocate(L leftId, Collection rightIds);
int allocate(Collection leftIds, R rightId);
default void deallocate(L leftId, R rightId) {
deallocate(singleton(leftId), singleton(rightId));
}
void deallocate(Collection leftIds, Collection rightIds);
int reallocateForLeft(L leftId, Collection rightIds);
int reallocateForRight(R rightId, Collection leftIds);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy