| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| MavenArtifact |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * This file is part of dependency-check-core. | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | * | |
| 16 | * Copyright (c) 2014 Jeremy Long. All Rights Reserved. | |
| 17 | */ | |
| 18 | package org.owasp.dependencycheck.data.nexus; | |
| 19 | ||
| 20 | /** | |
| 21 | * Simple bean representing a Maven Artifact. | |
| 22 | * | |
| 23 | * @author colezlaw | |
| 24 | */ | |
| 25 | public class MavenArtifact { | |
| 26 | ||
| 27 | /** | |
| 28 | * The groupId | |
| 29 | */ | |
| 30 | private String groupId; | |
| 31 | ||
| 32 | /** | |
| 33 | * The artifactId | |
| 34 | */ | |
| 35 | private String artifactId; | |
| 36 | ||
| 37 | /** | |
| 38 | * The version | |
| 39 | */ | |
| 40 | private String version; | |
| 41 | ||
| 42 | /** | |
| 43 | * The artifact url. This may change depending on which Nexus server the search took place. | |
| 44 | */ | |
| 45 | private String artifactUrl; | |
| 46 | ||
| 47 | /** | |
| 48 | * Creates an empty MavenArtifact. | |
| 49 | */ | |
| 50 | 0 | public MavenArtifact() { |
| 51 | 0 | } |
| 52 | ||
| 53 | /** | |
| 54 | * Creates a MavenArtifact with the given attributes. | |
| 55 | * | |
| 56 | * @param groupId the groupId | |
| 57 | * @param artifactId the artifactId | |
| 58 | * @param version the version | |
| 59 | */ | |
| 60 | 0 | public MavenArtifact(String groupId, String artifactId, String version) { |
| 61 | 0 | setGroupId(groupId); |
| 62 | 0 | setArtifactId(artifactId); |
| 63 | 0 | setVersion(version); |
| 64 | 0 | } |
| 65 | ||
| 66 | /** | |
| 67 | * Creates a MavenArtifact with the given attributes. | |
| 68 | * | |
| 69 | * @param groupId the groupId | |
| 70 | * @param artifactId the artifactId | |
| 71 | * @param version the version | |
| 72 | * @param url the artifactLink url | |
| 73 | */ | |
| 74 | 0 | public MavenArtifact(String groupId, String artifactId, String version, String url) { |
| 75 | 0 | setGroupId(groupId); |
| 76 | 0 | setArtifactId(artifactId); |
| 77 | 0 | setVersion(version); |
| 78 | 0 | setArtifactUrl(url); |
| 79 | 0 | } |
| 80 | ||
| 81 | /** | |
| 82 | * Returns the Artifact coordinates as a String. | |
| 83 | * | |
| 84 | * @return the String representation of the artifact coordinates | |
| 85 | */ | |
| 86 | @Override | |
| 87 | public String toString() { | |
| 88 | 0 | return String.format("%s:%s:%s", groupId, artifactId, version); |
| 89 | } | |
| 90 | ||
| 91 | /** | |
| 92 | * Sets the groupId. | |
| 93 | * | |
| 94 | * @param groupId the groupId | |
| 95 | */ | |
| 96 | public void setGroupId(String groupId) { | |
| 97 | 0 | this.groupId = groupId; |
| 98 | 0 | } |
| 99 | ||
| 100 | /** | |
| 101 | * Gets the groupId. | |
| 102 | * | |
| 103 | * @return the groupId | |
| 104 | */ | |
| 105 | public String getGroupId() { | |
| 106 | 0 | return groupId; |
| 107 | } | |
| 108 | ||
| 109 | /** | |
| 110 | * Sets the artifactId. | |
| 111 | * | |
| 112 | * @param artifactId the artifactId | |
| 113 | */ | |
| 114 | public void setArtifactId(String artifactId) { | |
| 115 | 0 | this.artifactId = artifactId; |
| 116 | 0 | } |
| 117 | ||
| 118 | /** | |
| 119 | * Gets the artifactId. | |
| 120 | * | |
| 121 | * @return the artifactId | |
| 122 | */ | |
| 123 | public String getArtifactId() { | |
| 124 | 0 | return artifactId; |
| 125 | } | |
| 126 | ||
| 127 | /** | |
| 128 | * Sets the version. | |
| 129 | * | |
| 130 | * @param version the version | |
| 131 | */ | |
| 132 | public void setVersion(String version) { | |
| 133 | 0 | this.version = version; |
| 134 | 0 | } |
| 135 | ||
| 136 | /** | |
| 137 | * Gets the version. | |
| 138 | * | |
| 139 | * @return the version | |
| 140 | */ | |
| 141 | public String getVersion() { | |
| 142 | 0 | return version; |
| 143 | } | |
| 144 | ||
| 145 | /** | |
| 146 | * Sets the artifactUrl. | |
| 147 | * | |
| 148 | * @param artifactUrl the artifactUrl | |
| 149 | */ | |
| 150 | public void setArtifactUrl(String artifactUrl) { | |
| 151 | 0 | this.artifactUrl = artifactUrl; |
| 152 | 0 | } |
| 153 | ||
| 154 | /** | |
| 155 | * Gets the artifactUrl. | |
| 156 | * | |
| 157 | * @return the artifactUrl | |
| 158 | */ | |
| 159 | public String getArtifactUrl() { | |
| 160 | 0 | return artifactUrl; |
| 161 | } | |
| 162 | } | |
| 163 | ||
| 164 | // vim: cc=120:sw=4:ts=4:sts=4 |