private String computeIdentifier ( final TrackedContentEntryDTO transfer ) { String identifier = null ; switch ( transfer . getStoreKey ( ) . getPackageType ( ) ) { case MAVEN_PKG_KEY : ArtifactPathInfo pathInfo = ArtifactPathInfo . parse ( transfer . getPath ( ) ) ; if ( pathInfo != null ) { ArtifactRef aref = new SimpleArtifactRef ( pathInfo . getProjectId ( ) , pathInfo . getType ( ) , pathInfo . getClassifier ( ) ) ; identifier = aref . toString ( ) ; } break ; case NPM_PKG_KEY : NpmPackagePathInfo npmPathInfo = NpmPackagePathInfo . parse ( transfer . getPath ( ) ) ; if ( npmPathInfo != null ) { NpmPackageRef packageRef = new NpmPackageRef ( npmPathInfo . getName ( ) , npmPathInfo . getVersion ( ) ) ; identifier = packageRef . toString ( ) ; } break ; case GENERIC_PKG_KEY : // handle generic downloads along with other invalid download paths for other package types break ; default : // do not do anything by default logger . warn ( "Package type {} is not handled by Indy repository session." , transfer . getStoreKey ( ) . getPackageType ( ) ) ; break ; } if ( identifier == null ) { identifier = computeGenericIdentifier ( transfer . getOriginUrl ( ) , transfer . getLocalUrl ( ) , transfer . getSha256 ( ) ) ; } return identifier ; }
Computes identifier string for an artifact . If the download path is valid for a package - type specific artifact it creates the identifier accordingly .