/** * Returns a {@link ResponseDoc} corresponding to the given {@link LibraryId}. * @param _libid * @return */ private static Artifact fromLibid(LibraryId _libid) { final Artifact d = new Artifact(); d.setLibId(_libid); return d; }
/** * Returns a {@link LibraryId} corresponding to this {@link ResponseDoc}. * @param _libid * @return */ public Artifact toArtifact() { Artifact r = new Artifact(g,a,v); r.setTimestamp(timestamp); r.setProgrammingLanguage(ProgrammingLanguage.JAVA); return r; }
final Artifact a = new Artifact(mvnGroup,artifact,version); a.setClassifier(classifier.equals("")?null:classifier); a.setPackaging(packaging);
return new ResponseEntity<List<ConstructId>>(HttpStatus.NOT_FOUND); else{ Artifact a = new Artifact(mvnGroup,artifact,version); a.setPackaging(packaging); a.setProgrammingLanguage(lang);
final Artifact a = new Artifact(mvnGroup,artifact,version); a.setClassifier((ClassDownloader.Format.JAVA==_format?"sources":null) ); a.setPackaging( "jar" );
@Override public Set<Artifact> getAllArtifactVersions(String group, String artifact, String classifier, String packaging) throws Exception { Set<Artifact> result = new TreeSet<Artifact>(); final PypiResponse response = this.searchInPypi(artifact,null); if(response!=null){ for(String k:response.getReleases().keySet()){ //the inner loop only creates artifacts if the key (e.g., "1.0.1") contains something // and it creates an artifact with the timestamp of the first element found // TODO: should we pick wheel, tar.gz, or what? for(PypiRelease release : response.getReleases().get(k)){ Artifact a = new Artifact(artifact,artifact,k); a.setProgrammingLanguage(ProgrammingLanguage.PY); if(release.getUpload_time()!=null && !release.getUpload_time().equals("")){ String upload_time = release.getUpload_time().replace("T"," "); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Date parsedDate = dateFormat.parse(upload_time); a.setTimestamp(parsedDate.getTime()); } result.add(a); break; } } } return result; }
doc=new Artifact(d.getG(),d.getA(),d.getV()); doc.setPackaging(d.getP()); doc.setClassifier(d.getC());
else{ Artifact a = new Artifact(mvnGroup,artifact,version); a.setPackaging(packaging); a.setProgrammingLanguage(lang);
Artifact result = null; if(response!=null){ result = new Artifact(response.getGroupId(),response.getArtifactId(),response.getVersion()); result.setProgrammingLanguage(ProgrammingLanguage.JAVA); ResponseEntity<NexusArtifactInfoResourceResponse> responseForTimestamp = null;
result = new Artifact(name.toLowerCase(),name.toLowerCase(),version); String upload_time = release.getUpload_time().replace("T"," "); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); result = new Artifact(name.toLowerCase(),name.toLowerCase(),version); result.setPackaging(packaging); if(release.getUpload_time()!=null && !release.getUpload_time().equals("")){
@Override public Set<Artifact> getAllArtifactVersions(String group, String artifact, String classifier, String packaging) throws InterruptedException { final NexusSearchNGResponse nexusResp = this.searchInNexus(group, artifact, "", classifier, packaging, null); Set<Artifact> result = new TreeSet<Artifact>(); if(nexusResp!=null && nexusResp.getData()!=null && nexusResp.getData().getArtifactList()!=null ){ for(NexusArtifact a : nexusResp.getData().getArtifactList()){ //TODO (2018-04-19): To get the timestamp we would need an additional get for each artifact (the same done in getArtifactVersion) result.add(new Artifact(a.getGroupId(), a.getArtifactId(), a.getVersion())); } } else{ log.info("No artifact found for group [" + group + "], artifact ["+artifact+"], classifier ["+classifier+"], packaging ["+packaging+"] in Nexus"); } return result; }
@Override public Artifact getArtifactForDigest(String digest) throws InterruptedException { //currently it only returns the lib id, to check whether package classifier and timestamp can be obtained (if needed) NexusSearchNGResponse nexusResp = this.searchInNexus(null, null, null, null, null, digest.toLowerCase()); Artifact result = null; if(nexusResp.getData()!=null && nexusResp.getData().getArtifactList()!=null && nexusResp.getData().getArtifactList().size()==1){ result = new Artifact(nexusResp.getData().getArtifactList().get(0).getGroupId(), nexusResp.getData().getArtifactList().get(0).getArtifactId(), nexusResp.getData().getArtifactList().get(0).getVersion()); result.setProgrammingLanguage(ProgrammingLanguage.JAVA); } else if(nexusResp.getData().getArtifactList()!=null && nexusResp.getData().getArtifactList().size()>1) { log.error("More than one artifact found for SHA1 [" + digest + "] in Nexus"); } else { log.info("No artifact found for SHA1 [" + digest + "] in Nexus"); } return result; }
return new ResponseEntity<Signature>(HttpStatus.NOT_FOUND); else{ Artifact a = new Artifact(mvnGroup,artifact,version); a.setPackaging(pack); a.setProgrammingLanguage(lang);
Artifact a = new Artifact(value.getMvnGroup(), value.getArtifact(), value.getVersion()); if(!finalLibrariesList.contains(a)) finalLibrariesList.add(a);
Artifact old_artifact = new Artifact(a.getGroup(), a.getArtifact(), a.getVersion()); if(a.getTimestamp()!=null) old_artifact.setTimestamp(a.getTimestamp());