| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
package org.itracker.model; |
| 20 |
|
|
| 21 |
|
import java.util.ArrayList; |
| 22 |
|
import java.util.Arrays; |
| 23 |
|
import java.util.Comparator; |
| 24 |
|
import java.util.List; |
| 25 |
|
|
| 26 |
|
import org.apache.commons.lang.builder.CompareToBuilder; |
| 27 |
|
import org.apache.commons.lang.builder.ToStringBuilder; |
| 28 |
|
import org.itracker.services.util.SystemConfigurationUtilities; |
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
|
|
|
| 70.5% |
Uncovered Elements: 23 (78) |
Complexity: 24 |
Complexity Density: 0.69 |
|
| 33 |
|
public class SystemConfiguration extends AbstractEntity { |
| 34 |
|
|
| 35 |
|
|
| 36 |
|
public static final Comparator<SystemConfiguration> VERSION_COMPARATOR = new SystemConfigurationComparator(); |
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
private static final long serialVersionUID = 1L; |
| 41 |
|
|
| 42 |
|
private String version; |
| 43 |
|
|
| 44 |
|
private List<CustomField> customFields = new ArrayList<CustomField>(); |
| 45 |
|
|
| 46 |
|
private List<Configuration> resolutions = new ArrayList<Configuration>(); |
| 47 |
|
private List<Configuration> severities = new ArrayList<Configuration>(); |
| 48 |
|
private List<Configuration> statuses = new ArrayList<Configuration>(); |
| 49 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 50 |
8
|
public SystemConfiguration() {... |
| 51 |
|
} |
| 52 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 1 |
|
| 53 |
0
|
public String getVersion() {... |
| 54 |
0
|
return (version == null ? "" : version); |
| 55 |
|
} |
| 56 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 57 |
1
|
public void setVersion(String value) {... |
| 58 |
1
|
version = value; |
| 59 |
|
} |
| 60 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 61 |
0
|
public List<CustomField> getCustomFields() {... |
| 62 |
0
|
return customFields; |
| 63 |
|
} |
| 64 |
|
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 65 |
2
|
public void setCustomFields(List<CustomField> value) {... |
| 66 |
2
|
if (value != null) { |
| 67 |
2
|
customFields = value; |
| 68 |
|
} |
| 69 |
|
} |
| 70 |
|
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 1 |
Complexity Density: 1 |
|
| 71 |
3
|
public List<Configuration> getResolutions() {... |
| 72 |
3
|
return (resolutions == null ? new ArrayList<Configuration>() |
| 73 |
|
: resolutions); |
| 74 |
|
} |
| 75 |
|
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 76 |
1
|
public void setResolutions(List<Configuration> value) {... |
| 77 |
1
|
if (value != null) { |
| 78 |
1
|
resolutions = value; |
| 79 |
|
} |
| 80 |
|
} |
| 81 |
|
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 1 |
Complexity Density: 1 |
|
| 82 |
3
|
public List<Configuration> getSeverities() {... |
| 83 |
3
|
return (severities == null ? new ArrayList<Configuration>() |
| 84 |
|
: severities); |
| 85 |
|
} |
| 86 |
|
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 87 |
1
|
public void setSeverities(List<Configuration> value) {... |
| 88 |
1
|
if (value != null) { |
| 89 |
1
|
severities = value; |
| 90 |
|
} |
| 91 |
|
} |
| 92 |
|
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 1 |
Complexity Density: 1 |
|
| 93 |
3
|
public List<Configuration> getStatuses() {... |
| 94 |
3
|
return (statuses == null ? new ArrayList<Configuration>() : statuses); |
| 95 |
|
} |
| 96 |
|
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 97 |
1
|
public void setStatuses(List<Configuration> value) {... |
| 98 |
1
|
if (value != null) { |
| 99 |
1
|
statuses = value; |
| 100 |
|
} |
| 101 |
|
} |
| 102 |
|
|
|
|
|
| 76.5% |
Uncovered Elements: 8 (34) |
Complexity: 8 |
Complexity Density: 0.4 |
|
| 103 |
3
|
public void addConfiguration(Configuration configuration) {... |
| 104 |
3
|
if (configuration != null) { |
| 105 |
3
|
Configuration[] newArray; |
| 106 |
|
|
| 107 |
3
|
if (configuration.getType() == SystemConfigurationUtilities.TYPE_RESOLUTION) { |
| 108 |
1
|
newArray = new Configuration[getResolutions().size() + 1]; |
| 109 |
1
|
if (getResolutions().size() > 0) { |
| 110 |
0
|
System.arraycopy((Object) resolutions, 0, |
| 111 |
|
(Object) newArray, 0, resolutions.size()); |
| 112 |
|
} |
| 113 |
1
|
newArray[getResolutions().size()] = configuration; |
| 114 |
1
|
setResolutions(Arrays.asList(newArray)); |
| 115 |
2
|
} else if (configuration.getType() == SystemConfigurationUtilities.TYPE_SEVERITY) { |
| 116 |
1
|
newArray = new Configuration[getSeverities().size() + 1]; |
| 117 |
1
|
if (getSeverities().size() > 0) { |
| 118 |
0
|
System.arraycopy((Object) severities, 0, (Object) newArray, |
| 119 |
|
0, severities.size()); |
| 120 |
|
} |
| 121 |
1
|
newArray[getSeverities().size()] = configuration; |
| 122 |
1
|
setSeverities(Arrays.asList(newArray)); |
| 123 |
1
|
} else if (configuration.getType() == SystemConfigurationUtilities.TYPE_STATUS) { |
| 124 |
1
|
newArray = new Configuration[getStatuses().size() + 1]; |
| 125 |
1
|
if (getStatuses().size() > 0) { |
| 126 |
0
|
System.arraycopy((Object) statuses, 0, (Object) newArray, |
| 127 |
|
0, statuses.size()); |
| 128 |
|
} |
| 129 |
1
|
newArray[getStatuses().size()] = configuration; |
| 130 |
1
|
setStatuses(Arrays.asList(newArray)); |
| 131 |
|
} |
| 132 |
|
} |
| 133 |
|
} |
| 134 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 135 |
0
|
public String toString() {... |
| 136 |
|
|
| 137 |
0
|
return new ToStringBuilder(this).append("id", getId()).append("version", getVersion()).toString(); |
| 138 |
|
|
| 139 |
|
} |
| 140 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 1 |
|
| 141 |
|
private static final class SystemConfigurationComparator implements |
| 142 |
|
Comparator<SystemConfiguration> { |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 143 |
0
|
public int compare(SystemConfiguration o1, SystemConfiguration o2) {... |
| 144 |
0
|
return new CompareToBuilder().append(o1.getVersion(), |
| 145 |
|
o2.getVersion()).append(o1.getId(), o2.getId()) |
| 146 |
|
.toComparison(); |
| 147 |
|
} |
| 148 |
|
} |
| 149 |
|
} |