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 CfnNagViolation.
34   */
35  public final class CfnNagViolation {
36  
37  	/** The id. */
38  	private String id;
39  
40  	/** The type. */
41  	private String type;
42  
43  	/** The message. */
44  	private String message;
45  
46  	/** The logical resource ids. */
47  	private List<String> logicalResourceIds = new ArrayList<>();
48  
49  	/** The line numbers. */
50  	private List<Integer> lineNumbers = new ArrayList<>();
51  
52  
53  	/**
54  	 * Gets the id.
55  	 *
56  	 * @return the id
57  	 */
58  	public String getId() {
59  		return id;
60  	}
61  
62  	/**
63  	 * Sets the id.
64  	 *
65  	 * @param id the new id
66  	 */
67  	public void setId(final String id) {
68  		this.id = id;
69  	}
70  
71  	/**
72  	 * Gets the type.
73  	 *
74  	 * @return the type
75  	 */
76  	public String getType() {
77  		return type;
78  	}
79  
80  	/**
81  	 * Sets the type.
82  	 *
83  	 * @param type the new type
84  	 */
85  	public void setType(final String type) {
86  		this.type = type;
87  	}
88  
89  	/**
90  	 * Gets the message.
91  	 *
92  	 * @return the message
93  	 */
94  	public String getMessage() {
95  		return message;
96  	}
97  
98  	/**
99  	 * Sets the message.
100 	 *
101 	 * @param message the new message
102 	 */
103 	public void setMessage(final String message) {
104 		this.message = message;
105 	}
106 
107 	/**
108 	 * Gets the logical resource ids.
109 	 *
110 	 * @return the logical resource ids
111 	 */
112 	@JsonProperty("logical_resource_ids")
113 	public List<String> getLogicalResourceIds() {
114 		return new ArrayList<>(logicalResourceIds);
115 	}
116 
117 	/**
118 	 * Sets the logical resource ids.
119 	 *
120 	 * @param logicalResourceIds the new logical resource ids
121 	 */
122 	public void setLogicalResourceIds(final List<String> logicalResourceIds) {
123 		this.logicalResourceIds = new ArrayList<>(logicalResourceIds);
124 	}
125 
126 	/**
127 	 * Gets the line numbers.
128 	 *
129 	 * @return the line numbers
130 	 */
131 	@JsonProperty("line_numbers")
132 	public List<Integer> getLineNumbers() {
133 		return new ArrayList<>(lineNumbers);
134 	}
135 
136 	/**
137 	 * Sets the line numbers.
138 	 *
139 	 * @param lineNumbers the new line numbers
140 	 */
141 	public void setLineNumbers(final List<Integer> lineNumbers) {
142 		this.lineNumbers = new ArrayList<>(lineNumbers);
143 	}
144 
145 	/**
146 	 * To string.
147 	 *
148 	 * @return the string
149 	 */
150 	@Override
151 	public String toString() {
152 		return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
153 	}
154 
155 	/**
156 	 * Equals.
157 	 *
158 	 * @param object the object
159 	 * @return true, if successful
160 	 */
161 	@Override
162     public boolean equals(final Object object) {
163     	return EqualsBuilder.reflectionEquals(this,object);
164     }
165 
166 	/**
167 	 * Hash code.
168 	 *
169 	 * @return the int
170 	 */
171 	@Override
172 	public int hashCode() {
173 		return HashCodeBuilder.reflectionHashCode(this);
174 	}
175 
176 }