View Javadoc
1   /*
2    * Cloudformation Plugin for SonarQube
3    * Copyright (C) 2019 James Pether Sörling
4    * james@hack23.com
5    *
6    * This program is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU Lesser General Public
8    * License as published by the Free Software Foundation; either
9    * version 3 of the License, or (at your option) any later version.
10   *
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   * Lesser General Public License for more details.
15   *
16   * You should have received a copy of the GNU Lesser General Public License
17   * along with this program; if not, write to the Free Software Foundation,
18   * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19   */
20  package com.hack23.sonar.cloudformation.reports.cfnnag;
21  
22  import java.util.ArrayList;
23  import java.util.List;
24  
25  import org.apache.commons.lang3.builder.EqualsBuilder;
26  import org.apache.commons.lang3.builder.HashCodeBuilder;
27  import org.apache.commons.lang3.builder.ToStringBuilder;
28  import org.apache.commons.lang3.builder.ToStringStyle;
29  
30  import com.fasterxml.jackson.annotation.JsonProperty;
31  
32  /**
33   * The Class CfnNagReport.
34   */
35  public final class CfnNagReport {
36  
37  	/** The failure count. */
38  	private int failureCount;
39  
40  	/** The violations. */
41  	private List<CfnNagViolation> violations = new ArrayList<>();
42  
43  	/**
44  	 * Gets the failure count.
45  	 *
46  	 * @return the failure count
47  	 */
48  	@JsonProperty("failure_count")
49  	public int getFailureCount() {
50  		return failureCount;
51  	}
52  
53  	/**
54  	 * Sets the failure count.
55  	 *
56  	 * @param failureCount the new failure count
57  	 */
58  	public void setFailureCount(final int failureCount) {
59  		this.failureCount = failureCount;
60  	}
61  
62  	/**
63  	 * Gets the violations.
64  	 *
65  	 * @return the violations
66  	 */
67  	public List<CfnNagViolation> getViolations() {
68  		return new ArrayList<>(violations);
69  	}
70  
71  	/**
72  	 * Sets the violations.
73  	 *
74  	 * @param violations the new violations
75  	 */
76  	public void setViolations(final List<CfnNagViolation> violations) {
77  		this.violations = new ArrayList<>(violations);
78  	}
79  
80  
81  	/**
82  	 * To string.
83  	 *
84  	 * @return the string
85  	 */
86  	@Override
87  	public String toString() {
88  		return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
89  	}
90  
91  	/**
92  	 * Equals.
93  	 *
94  	 * @param object the object
95  	 * @return true, if successful
96  	 */
97  	@Override
98      public boolean equals(final Object object) {
99      	return EqualsBuilder.reflectionEquals(this,object);
100     }
101 
102 	/**
103 	 * Hash code.
104 	 *
105 	 * @return the int
106 	 */
107 	@Override
108 	public int hashCode() {
109 		return HashCodeBuilder.reflectionHashCode(this);
110 	}
111 
112 }