| 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 | * Dependency-check-core is free software: you can redistribute it and/or modify it | |
| 5 | * under the terms of the GNU General Public License as published by the Free | |
| 6 | * Software Foundation, either version 3 of the License, or (at your option) any | |
| 7 | * later version. | |
| 8 | * | |
| 9 | * Dependency-check-core is distributed in the hope that it will be useful, but | |
| 10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
| 12 | * details. | |
| 13 | * | |
| 14 | * You should have received a copy of the GNU General Public License along with | |
| 15 | * dependency-check-core. If not, see http://www.gnu.org/licenses/. | |
| 16 | * | |
| 17 | * Copyright (c) 2012 Jeremy Long. All Rights Reserved. | |
| 18 | */ | |
| 19 | package org.owasp.dependencycheck.data.nexus; | |
| 20 | ||
| 21 | /** | |
| 22 | * Simple bean representing a Maven Artifact. | |
| 23 | * | |
| 24 | * @author colezlaw | |
| 25 | */ | |
| 26 | public class MavenArtifact { | |
| 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 | |
| 44 | * server the search took place. | |
| 45 | */ | |
| 46 | private String artifactUrl; | |
| 47 | ||
| 48 | ||
| 49 | /** | |
| 50 | * Creates an empty MavenArtifact. | |
| 51 | */ | |
| 52 | 0 | public MavenArtifact() { |
| 53 | 0 | } |
| 54 | ||
| 55 | /** | |
| 56 | * Creates a MavenArtifact with the given attributes. | |
| 57 | * | |
| 58 | * @param groupId the groupId | |
| 59 | * @param artifactId the artifactId | |
| 60 | * @param version the version | |
| 61 | */ | |
| 62 | 0 | public MavenArtifact(String groupId, String artifactId, String version) { |
| 63 | 0 | setGroupId(groupId); |
| 64 | 0 | setArtifactId(artifactId); |
| 65 | 0 | setVersion(version); |
| 66 | 0 | } |
| 67 | ||
| 68 | /** | |
| 69 | * Creates a MavenArtifact with the given attributes. | |
| 70 | * | |
| 71 | * @param groupId the groupId | |
| 72 | * @param artifactId the artifactId | |
| 73 | * @param version the version | |
| 74 | * @param url the artifactLink url | |
| 75 | */ | |
| 76 | 0 | public MavenArtifact(String groupId, String artifactId, String version, String url) { |
| 77 | 0 | setGroupId(groupId); |
| 78 | 0 | setArtifactId(artifactId); |
| 79 | 0 | setVersion(version); |
| 80 | 0 | setArtifactUrl(url); |
| 81 | 0 | } |
| 82 | ||
| 83 | /** | |
| 84 | * Returns the Artifact coordinates as a String. | |
| 85 | * | |
| 86 | * @return the String representation of the artifact coordinates | |
| 87 | */ | |
| 88 | @Override | |
| 89 | public String toString() { | |
| 90 | 0 | return String.format("%s:%s:%s", groupId, artifactId, version); |
| 91 | } | |
| 92 | ||
| 93 | /** | |
| 94 | * Sets the groupId. | |
| 95 | * | |
| 96 | * @param groupId the groupId | |
| 97 | */ | |
| 98 | 0 | public void setGroupId(String groupId) { this.groupId = groupId; } |
| 99 | ||
| 100 | /** | |
| 101 | * Gets the groupId. | |
| 102 | * | |
| 103 | * @return the groupId | |
| 104 | */ | |
| 105 | 0 | public String getGroupId() { return groupId; } |
| 106 | ||
| 107 | /** | |
| 108 | * Sets the artifactId. | |
| 109 | * | |
| 110 | * @param artifactId the artifactId | |
| 111 | */ | |
| 112 | 0 | public void setArtifactId(String artifactId) { this.artifactId = artifactId; } |
| 113 | ||
| 114 | /** | |
| 115 | * Gets the artifactId. | |
| 116 | * | |
| 117 | * @return the artifactId | |
| 118 | */ | |
| 119 | 0 | public String getArtifactId() { return artifactId; } |
| 120 | ||
| 121 | /** | |
| 122 | * Sets the version. | |
| 123 | * | |
| 124 | * @param version the version | |
| 125 | */ | |
| 126 | 0 | public void setVersion(String version) { this.version = version; } |
| 127 | ||
| 128 | /** | |
| 129 | * Gets the version. | |
| 130 | * | |
| 131 | * @return the version | |
| 132 | */ | |
| 133 | 0 | public String getVersion() { return version; } |
| 134 | ||
| 135 | /** | |
| 136 | * Sets the artifactUrl. | |
| 137 | * | |
| 138 | * @param artifactUrl the artifactUrl | |
| 139 | */ | |
| 140 | public void setArtifactUrl(String artifactUrl) { | |
| 141 | 0 | this.artifactUrl = artifactUrl; |
| 142 | 0 | } |
| 143 | ||
| 144 | /** | |
| 145 | * Gets the artifactUrl. | |
| 146 | * | |
| 147 | * @return the artifactUrl | |
| 148 | */ | |
| 149 | public String getArtifactUrl() { | |
| 150 | 0 | return artifactUrl; |
| 151 | } | |
| 152 | } | |
| 153 | ||
| 154 | // vim: cc=120:sw=4:ts=4:sts=4 |