Java tutorial
/******************************************************************************* * Copyright (c) 2014 OSSMETER Partners. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Yannis Korkontzelos - Implementation. *******************************************************************************/ package org.ossmeter.metricprovider.historic.bugs.comments.model; import com.mongodb.*; import java.util.*; import com.googlecode.pongo.runtime.*; import com.googlecode.pongo.runtime.querying.*; public class BugsCommentsHistoricMetric extends Pongo { protected List<DailyBugData> bugs = null; public BugsCommentsHistoricMetric() { super(); dbObject.put("bugs", new BasicDBList()); NUMBEROFCOMMENTS.setOwningType( "org.ossmeter.metricprovider.historic.bugs.comments.model.BugsCommentsHistoricMetric"); CUMULATIVENUMBEROFCOMMENTS.setOwningType( "org.ossmeter.metricprovider.historic.bugs.comments.model.BugsCommentsHistoricMetric"); } public static NumericalQueryProducer NUMBEROFCOMMENTS = new NumericalQueryProducer("numberOfComments"); public static NumericalQueryProducer CUMULATIVENUMBEROFCOMMENTS = new NumericalQueryProducer( "cumulativeNumberOfComments"); public int getNumberOfComments() { return parseInteger(dbObject.get("numberOfComments") + "", 0); } public BugsCommentsHistoricMetric setNumberOfComments(int numberOfComments) { dbObject.put("numberOfComments", numberOfComments); notifyChanged(); return this; } public int getCumulativeNumberOfComments() { return parseInteger(dbObject.get("cumulativeNumberOfComments") + "", 0); } public BugsCommentsHistoricMetric setCumulativeNumberOfComments(int cumulativeNumberOfComments) { dbObject.put("cumulativeNumberOfComments", cumulativeNumberOfComments); notifyChanged(); return this; } public List<DailyBugData> getBugs() { if (bugs == null) { bugs = new PongoList<DailyBugData>(this, "bugs", true); } return bugs; } }