001/*-------------------------------------------------------------------------+ 002| | 003| Copyright 2005-2011 the ConQAT Project | 004| | 005| Licensed under the Apache License, Version 2.0 (the "License"); | 006| you may not use this file except in compliance with the License. | 007| You may obtain a copy of the License at | 008| | 009| http://www.apache.org/licenses/LICENSE-2.0 | 010| | 011| Unless required by applicable law or agreed to in writing, software | 012| distributed under the License is distributed on an "AS IS" BASIS, | 013| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 014| See the License for the specific language governing permissions and | 015| limitations under the License. | 016+-------------------------------------------------------------------------*/ 017package org.conqat.engine.index.shared; 018 019import java.io.Serializable; 020import java.util.ArrayList; 021import java.util.List; 022 023import com.fasterxml.jackson.annotation.JsonCreator; 024import com.fasterxml.jackson.annotation.JsonProperty; 025 026/** 027 * Holds a finding group name along with its number of corresponding findings. 028 */ 029public class FindingsSummaryGroupInfo extends FindingsSummaryInfoBase implements Serializable { 030 031 /** Version for serialization */ 032 private static final long serialVersionUID = 1; 033 034 /** The name of the JSON property name for {@link #groupName}. */ 035 private static final String GROUP_NAME_PROPERTY = "groupName"; 036 037 /** The name of the JSON property name for {@link #count}. */ 038 private static final String COUNT_PROPERTY = "count"; 039 040 /** The name of the JSON property name for {@link #countRed}. */ 041 private static final String COUNT_RED_PROPERTY = "countRed"; 042 043 /** The name of the finding group */ 044 @JsonProperty(GROUP_NAME_PROPERTY) 045 private final String groupName; 046 047 /** The finding typeId infos */ 048 @JsonProperty("typeIdInfos") 049 private final List<FindingsSummaryTypeIdInfo> typeIdInfos = new ArrayList<>(); 050 051 /** Constructor */ 052 @JsonCreator 053 public FindingsSummaryGroupInfo(@JsonProperty(GROUP_NAME_PROPERTY) String groupName, 054 @JsonProperty(COUNT_PROPERTY) int count, @JsonProperty(COUNT_RED_PROPERTY) int countRed) { 055 this.groupName = groupName; 056 this.count = count; 057 this.countRed = countRed; 058 } 059 060 /** Returns the finding group. */ 061 public String getGroup() { 062 return groupName; 063 } 064 065 /** Returns the TypeId infos. */ 066 public List<FindingsSummaryTypeIdInfo> getTypeIdInfos() { 067 return typeIdInfos; 068 } 069 070 /** Adds the given group info to this category info. */ 071 public void addTypeIdInfo(FindingsSummaryTypeIdInfo typeIdInfo) { 072 this.typeIdInfos.add(typeIdInfo); 073 } 074 075}