package io.ebeanservice.docstore.api;
import io.ebean.DocStoreQueueEntry;
import io.ebean.DocStoreQueueEntry.Action;
import java.util.ArrayList;
import java.util.List;
public class DocStoreUpdates {
private final List<DocStoreUpdate> persistEvents = new ArrayList<>();
private final List<DocStoreUpdate> deleteEvents = new ArrayList<>();
private final List<DocStoreQueueEntry> nestedEvents = new ArrayList<>();
private final List<DocStoreQueueEntry> queueEntries = new ArrayList<>();
public DocStoreUpdates() {
}
public boolean isEmpty() {
return persistEvents.isEmpty() && deleteEvents.isEmpty() && nestedEvents.isEmpty() && queueEntries.isEmpty();
}
public void addPersist(DocStoreUpdate bulkRequest) {
persistEvents.add(bulkRequest);
}
public void addDelete(DocStoreUpdate bulkRequest) {
deleteEvents.add(bulkRequest);
}
public void addNested(String queueId, String path, Object beanId) {
nestedEvents.add(new DocStoreQueueEntry(Action.NESTED, queueId, path, beanId));
}
public void queueIndex(String queueId, Object beanId) {
queueEntries.add(new DocStoreQueueEntry(Action.INDEX, queueId, beanId));
}
public void queueDelete(String queueId, Object beanId) {
queueEntries.add(new DocStoreQueueEntry(Action.DELETE, queueId, beanId));
}
public void queueNested(String queueId, String path, Object beanId) {
queueEntries.add(new DocStoreQueueEntry(Action.NESTED, queueId, path, beanId));
}
public List<DocStoreUpdate> getPersistEvents() {
return persistEvents;
}
public List<DocStoreUpdate> getDeleteEvents() {
return deleteEvents;
}
public List<DocStoreQueueEntry> getNestedEvents() {
return nestedEvents;
}
public List<DocStoreQueueEntry> getQueueEntries() {
return queueEntries;
}
}