/** * Returns the artifact associated with the specified id. * * @param id the artifact ID * @return the artifact associated with the specified id */ Artifact getArtifactByID( String id ) { for ( NetDependency netDependency : netDependencies ) { if ( netDependency.getId() != null && netDependency.getId().equals( id ) ) { return netDependencyToArtifact( netDependency ); } } return null; }
/** * Returns a list of artifacts that match the specified parameters. If the version or type parameters are null, * then the returned list will include all versions and types. * * @param groupId the group ID of the artifact to match. This value should not be null. * @param artifactId the artifact ID of the artifact to match. This value should not be null. * @param version the version if the artifact to match. * @param type the type of artifact to match * @return a list of artifacts that match the specified parameters */ List<Artifact> getArtifactsFor( String groupId, String artifactId, String version, String type ) { List<Artifact> artifacts = new ArrayList<Artifact>(); for ( NetDependency netDependency : netDependencies ) { if ( netDependency.getGroupId().equals( groupId ) && netDependency.getArtifactId().equals( artifactId ) && ( version == null || netDependency.getVersion().equals( version ) ) && ( type == null || netDependency.getType().equals( type ) ) ) { artifacts.add( netDependencyToArtifact( netDependency ) ); } } return artifacts; }