com.capitalone.dashboard.repository.RelatedCollectorItemRepository Maven / Gradle / Ivy
package com.capitalone.dashboard.repository;
import com.capitalone.dashboard.model.Build;
import com.capitalone.dashboard.model.relation.RelatedCollectorItem;
import org.apache.commons.collections4.CollectionUtils;
import org.bson.types.ObjectId;
import java.util.List;
/**
* Repository for {@link Build} data.
*/
public interface RelatedCollectorItemRepository extends QueryRepository {
List findRelatedCollectorItemByLeft(ObjectId left);
List findRelatedCollectorItemByRight(ObjectId right);
List findAllByLeftAndRight(ObjectId left, ObjectId right);
default RelatedCollectorItem saveRelatedItems(ObjectId left, ObjectId right, String source, String reason) {
List items = findAllByLeftAndRight(left, right);
if (!CollectionUtils.isEmpty(items)) {
this.deleteAll(items);
}
RelatedCollectorItem related = new RelatedCollectorItem();
related.setLeft(left);
related.setRight(right);
related.setCreationTime(System.currentTimeMillis());
related.setSource(source);
related.setReason(reason);
return save(related);
}
List findAllByCreationTimeIsBetweenOrderByCreationTimeDesc(long beginDate, long endDate);
List findAllByReasonAndCreationTimeIsBetweenOrderByCreationTimeDesc(String reason, long beginDate, long endDate);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy