001 /* 002 * Sonar, open source software quality management tool. 003 * Copyright (C) 2009 SonarSource SA 004 * mailto:contact AT sonarsource DOT com 005 * 006 * Sonar is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 3 of the License, or (at your option) any later version. 010 * 011 * Sonar is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public 017 * License along with Sonar; if not, write to the Free Software 018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 019 */ 020 package org.sonar.api.batch; 021 022 import org.sonar.api.measures.Metric; 023 import org.sonar.api.resources.Resource; 024 025 import java.util.Arrays; 026 import java.util.Date; 027 import java.util.List; 028 029 /** 030 * @since 1.10 031 */ 032 public class TimeMachineQuery { 033 034 private Resource resource; 035 private List<Metric> metrics; 036 private Date from; 037 private Date to; 038 private boolean onlyLastAnalysis = false; 039 private boolean fromCurrentAnalysis = false; 040 private boolean toCurrentAnalysis = false; 041 042 public TimeMachineQuery(Resource resource) { 043 this.resource = resource; 044 } 045 046 public Resource getResource() { 047 return resource; 048 } 049 050 public TimeMachineQuery setResource(Resource resource) { 051 this.resource = resource; 052 return this; 053 } 054 055 public List<Metric> getMetrics() { 056 return metrics; 057 } 058 059 public TimeMachineQuery setMetrics(List<Metric> metrics) { 060 this.metrics = metrics; 061 return this; 062 } 063 064 public TimeMachineQuery setMetrics(Metric... metrics) { 065 this.metrics = Arrays.asList(metrics); 066 return this; 067 } 068 069 public TimeMachineQuery unsetMetrics() { 070 this.metrics = null; 071 return this; 072 } 073 074 public Date getFrom() { 075 return from; 076 } 077 078 public TimeMachineQuery setFrom(Date from) { 079 this.from = from; 080 return this; 081 } 082 083 public TimeMachineQuery setFromCurrentAnalysis(boolean b) { 084 this.fromCurrentAnalysis = b; 085 return this; 086 } 087 088 public TimeMachineQuery setToCurrentAnalysis(boolean b) { 089 this.toCurrentAnalysis = b; 090 return this; 091 } 092 093 public boolean isFromCurrentAnalysis() { 094 return fromCurrentAnalysis; 095 } 096 097 public boolean isToCurrentAnalysis() { 098 return toCurrentAnalysis; 099 } 100 101 public Date getTo() { 102 return to; 103 } 104 105 public TimeMachineQuery setTo(Date to) { 106 this.to = to; 107 return this; 108 } 109 110 public boolean isOnlyLastAnalysis() { 111 return onlyLastAnalysis; 112 } 113 114 public TimeMachineQuery setOnlyLastAnalysis(boolean onlyLastAnalysis) { 115 this.onlyLastAnalysis = onlyLastAnalysis; 116 return this; 117 } 118 }