--- a/metric-providers/org.ossmeter.metricprovider.threads/src/org/ossmeter/metricprovider/threads/model/ArticleDataCollection.java
+++ b/metric-providers/org.ossmeter.metricprovider.threads/src/org/ossmeter/metricprovider/threads/model/ThreadDataCollection.java
@@ -4,62 +4,45 @@
import java.util.*;
import com.mongodb.*;
-public class ArticleDataCollection extends PongoCollection<ArticleData> {
+public class ThreadDataCollection extends PongoCollection<ThreadData> {
- public ArticleDataCollection(DBCollection dbCollection) {
+ public ThreadDataCollection(DBCollection dbCollection) {
super(dbCollection);
- createIndex("url_name");
- createIndex("articleNumber");
+ createIndex("threadId");
}
- public Iterable<ArticleData> findById(String id) {
- return new IteratorIterable<ArticleData>(new PongoCursorIterator<ArticleData>(this, dbCollection.find(new BasicDBObject("_id", id))));
+ public Iterable<ThreadData> findById(String id) {
+ return new IteratorIterable<ThreadData>(new PongoCursorIterator<ThreadData>(this, dbCollection.find(new BasicDBObject("_id", id))));
}
- public Iterable<ArticleData> findByUrl_name(String q) {
- return new IteratorIterable<ArticleData>(new PongoCursorIterator<ArticleData>(this, dbCollection.find(new BasicDBObject("url_name", q + ""))));
+ public Iterable<ThreadData> findByThreadId(int q) {
+ return new IteratorIterable<ThreadData>(new PongoCursorIterator<ThreadData>(this, dbCollection.find(new BasicDBObject("threadId", q + ""))));
}
- public ArticleData findOneByUrl_name(String q) {
- ArticleData articleData = (ArticleData) PongoFactory.getInstance().createPongo(dbCollection.findOne(new BasicDBObject("url_name", q + "")));
- if (articleData != null) {
- articleData.setPongoCollection(this);
+ public ThreadData findOneByThreadId(int q) {
+ ThreadData threadData = (ThreadData) PongoFactory.getInstance().createPongo(dbCollection.findOne(new BasicDBObject("threadId", q + "")));
+ if (threadData != null) {
+ threadData.setPongoCollection(this);
}
- return articleData;
+ return threadData;
}
- public long countByUrl_name(String q) {
- return dbCollection.count(new BasicDBObject("url_name", q + ""));
- }
- public Iterable<ArticleData> findByArticleNumber(int q) {
- return new IteratorIterable<ArticleData>(new PongoCursorIterator<ArticleData>(this, dbCollection.find(new BasicDBObject("articleNumber", q + ""))));
- }
-
- public ArticleData findOneByArticleNumber(int q) {
- ArticleData articleData = (ArticleData) PongoFactory.getInstance().createPongo(dbCollection.findOne(new BasicDBObject("articleNumber", q + "")));
- if (articleData != null) {
- articleData.setPongoCollection(this);
- }
- return articleData;
- }
-
-
- public long countByArticleNumber(int q) {
- return dbCollection.count(new BasicDBObject("articleNumber", q + ""));
+ public long countByThreadId(int q) {
+ return dbCollection.count(new BasicDBObject("threadId", q + ""));
}
@Override
- public Iterator<ArticleData> iterator() {
- return new PongoCursorIterator<ArticleData>(this, dbCollection.find());
+ public Iterator<ThreadData> iterator() {
+ return new PongoCursorIterator<ThreadData>(this, dbCollection.find());
}
- public void add(ArticleData articleData) {
- super.add(articleData);
+ public void add(ThreadData threadData) {
+ super.add(threadData);
}
- public void remove(ArticleData articleData) {
- super.remove(articleData);
+ public void remove(ThreadData threadData) {
+ super.remove(threadData);
}
}