public static ArtifactReference clone( ArtifactReference artifactReference ) { if ( artifactReference == null ) { return null; } ArtifactReference cloned = new ArtifactReference(); cloned.setGroupId( artifactReference.getGroupId() ); cloned.setArtifactId( artifactReference.getArtifactId() ); cloned.setVersion( artifactReference.getVersion() ); cloned.setClassifier( artifactReference.getClassifier() ); cloned.setType( artifactReference.getType() ); return cloned; }
private ArtifactReference getNewArtifactReference( ArtifactReference reference, String version ) throws LayoutException { ArtifactReference artifact = new ArtifactReference( ); artifact.setGroupId( reference.getGroupId( ) ); artifact.setArtifactId( reference.getArtifactId( ) ); artifact.setVersion( version ); artifact.setClassifier( reference.getClassifier( ) ); artifact.setType( reference.getType( ) ); return artifact; } }
public ArchivaArtifact( ArtifactReference ref, String repositoryId ) { this( ref.getGroupId(), ref.getArtifactId(), ref.getVersion(), ref.getClassifier(), ref.getType(), repositoryId ); }
ArtifactReference artifact = new ArtifactReference(); artifact.setGroupId( metadata.getNamespace() ); artifact.setArtifactId( metadata.getProject() ); artifact.setVersion( metadata.getVersion() ); MavenArtifactFacet facet = (MavenArtifactFacet) metadata.getFacet( MavenArtifactFacet.FACET_ID ); if ( facet != null ) artifact.setClassifier( facet.getClassifier() ); artifact.setType( facet.getType() );
try { ArtifactReference artifact = toArtifactReference(repoBase.relativize(path).toString()); if( artifact.getGroupId().equals( reference.getGroupId() ) && artifact.getArtifactId().equals( reference.getArtifactId() ) && artifact.getVersion().equals( reference.getVersion() )) { return artifact; } else {
reference.setGroupId( artifact.getGroupId( ) ); reference.setArtifactId( artifact.getArtifactId( ) ); reference.setVersion( artifact.getVersion( ) ); newArtifactReference.setVersion( version ); if ( VersionUtil.isGenericSnapshot( newArtifactReference.getVersion( ) ) ) else if ( VersionUtil.isUniqueSnapshot( newArtifactReference.getVersion( ) ) ) Calendar timestampCal = uniqueSnapshotToCalendar( newArtifactReference.getVersion( ) );
for ( ArtifactReference reference : references ) String baseVersion = VersionUtil.getBaseVersion( reference.getVersion( ) ); String metaBaseId = reference.getGroupId( ) + "/" + reference.getArtifactId( ) + "/" + baseVersion; metaResolved.put( metaBaseId, metadataRepository.getArtifacts( repository.getId( ), reference.getGroupId( ), reference.getArtifactId( ), baseVersion ) ); listener.deleteArtifact( metadataRepository, repository.getId( ), reference.getGroupId( ), reference.getArtifactId( ), reference.getVersion( ), artifactFile.getFileName( ).toString( ) ); boolean snapshotVersion = VersionUtil.isSnapshot( reference.getVersion( ) ); if ( artifactMetadata.getVersion( ).equals( reference.getVersion( ) ) ) if ( StringUtils.isNotBlank( reference.getClassifier( ) ) ) info.setClassifier( reference.getClassifier( ) ); metaRemovalList.put( info, artifactMetadata ); ArtifactInfo info = new ArtifactInfo( reference.getGroupId( ), reference.getArtifactId( ), baseVersion, reference.getVersion( ) ); for ( ArtifactMetadata metadata : metaResolved.get( metaBaseId ) ) triggerAuditEvent( repository.getRepository( ).getId( ), ArtifactReference.toKey( reference ), AuditEvent.PURGE_ARTIFACT ); purgeSupportFiles( artifactFile );
ArtifactReference artifactReference = new ArtifactReference(); artifactReference.setGroupId( namespace ); artifactReference.setArtifactId( projectId ); artifactReference.setVersion( version );
@Override public void deleteProject( String namespace, String projectId ) throws RepositoryException, ContentNotFoundException { ArtifactReference artifactReference = new ArtifactReference(); artifactReference.setGroupId( namespace ); artifactReference.setArtifactId( projectId ); String path = toPath( artifactReference ); File directory = new File( getRepoRoot(), path ); if ( !directory.exists() ) { throw new ContentNotFoundException( "cannot found project " + namespace + ":" + projectId ); } if ( directory.isDirectory() ) { try { FileUtils.deleteDirectory( directory ); } catch ( IOException e ) { throw new RepositoryException( e.getMessage(), e ); } } else { log.warn( "project {}:{} is not a directory", namespace, projectId ); } }
if ( StringUtils.endsWith( artifactReference.getVersion(), VersionUtil.SNAPSHOT ) ) artifactReference.getArtifactId() // + "-" + artifactReference.getVersion(), // artifactReference.getArtifactId() // + "-" + StringUtils.remove( artifactReference.getVersion(), "-" + VersionUtil.SNAPSHOT ) // + "-" + timestamp //
private void updateProjectMetadata( ArtifactReference artifact, String path ) projectRef.setGroupId( artifact.getGroupId( ) ); projectRef.setArtifactId( artifact.getArtifactId( ) );
.map(ar -> ar.getVersion()) .collect(Collectors.toSet()); } catch (IOException e) {
public ArchivaArtifact( ArtifactReference ref, String repositoryId ) { this( ref.getGroupId(), ref.getArtifactId(), ref.getVersion(), ref.getClassifier(), ref.getType(), repositoryId ); }
ArtifactReference artifact = new ArtifactReference(); artifact.setGroupId( metadata.getNamespace() ); artifact.setArtifactId( metadata.getProject() ); artifact.setVersion( metadata.getVersion() ); MavenArtifactFacet facet = (MavenArtifactFacet) metadata.getFacet( MavenArtifactFacet.FACET_ID ); if ( facet != null ) artifact.setClassifier( facet.getClassifier() ); artifact.setType( facet.getType() );
if ( artifact.getGroupId().equals( reference.getGroupId() ) && artifact.getArtifactId().equals( reference.getArtifactId() ) && artifact.getVersion().equals( reference.getVersion() ) )
reference.setGroupId( artifact.getGroupId() ); reference.setArtifactId( artifact.getArtifactId() ); reference.setVersion( artifact.getVersion() ); newArtifactReference.setVersion( version ); if ( VersionUtil.isGenericSnapshot( newArtifactReference.getVersion() ) ) else if ( VersionUtil.isUniqueSnapshot( newArtifactReference.getVersion() ) ) Calendar timestampCal = uniqueSnapshotToCalendar( newArtifactReference.getVersion() );
listener.deleteArtifact( metadataRepository, repository.getId(), reference.getGroupId(), reference.getArtifactId(), reference.getVersion(), artifactFile.getName() ); metadataRepository.removeProjectVersion( repository.getId(), reference.getGroupId(), reference.getArtifactId(), reference.getVersion() ); boolean snapshotVersion = VersionUtil.isSnapshot( reference.getVersion() ); String baseVersion = VersionUtil.getBaseVersion( reference.getVersion() ); Collection<ArtifactMetadata> artifacts = metadataRepository.getArtifacts( repository.getId(), reference.getGroupId(), reference.getArtifactId(), baseVersion ); if ( artifacts != null ) if ( artifactMetadata.getVersion().equals( reference.getVersion() ) ) if ( StringUtils.isNotBlank( reference.getClassifier() ) ) if ( StringUtils.equals( reference.getClassifier(), mavenArtifactFacet.getClassifier() ) ) String groupId = reference.getGroupId(), artifactId = reference.getArtifactId(), version = reference.getVersion(); MavenArtifactFacet mavenArtifactFacetToCompare = new MavenArtifactFacet(); mavenArtifactFacetToCompare.setClassifier( reference.getClassifier() ); metadataRepository.removeArtifact( repository.getId(), groupId, artifactId, version, mavenArtifactFacetToCompare );
ArtifactReference artifactReference = new ArtifactReference(); artifactReference.setGroupId( namespace ); artifactReference.setArtifactId( projectId ); artifactReference.setVersion( version );
@Override public void deleteProject( String namespace, String projectId ) throws RepositoryException { ArtifactReference artifactReference = new ArtifactReference(); artifactReference.setGroupId( namespace ); artifactReference.setArtifactId( projectId ); String path = toPath( artifactReference ); Path directory = Paths.get( getRepoRoot(), path ); if ( !Files.exists(directory) ) { throw new ContentNotFoundException( "cannot found project " + namespace + ":" + projectId ); } if ( Files.isDirectory(directory) ) { try { org.apache.archiva.common.utils.FileUtils.deleteDirectory( directory ); } catch ( IOException e ) { throw new RepositoryException( e.getMessage(), e ); } } else { log.warn( "project {}:{} is not a directory", namespace, projectId ); } }
if ( StringUtils.endsWith( artifactReference.getVersion(), VersionUtil.SNAPSHOT ) ) artifactReference.getArtifactId() // + "-" + artifactReference.getVersion(), // artifactReference.getArtifactId() // + "-" + StringUtils.remove( artifactReference.getVersion(), "-" + VersionUtil.SNAPSHOT ) // + "-" + timestamp //