class ArtifactMetadataAdapter implements ArtifactMetadata {

        private final Metadata metadata;

        ArtifactMetadataAdapter(Metadata metadata) {
            this.metadata = metadata;
        }

        public boolean storedInArtifactVersionDirectory() {
            return !metadata.getVersion().isEmpty();
        }

        public boolean storedInGroupDirectory() {
            return metadata.getArtifactId().isEmpty();
        }

        public String getGroupId() {
            return nullify(metadata.getGroupId());
        }

        public String getArtifactId() {
            return nullify(metadata.getArtifactId());
        }

        public String getBaseVersion() {
            return nullify(metadata.getVersion());
        }

        private String nullify(String str) {
            return (str == null || str.isEmpty()) ? null : str;
        }

        public Object getKey() {
            return metadata.toString();
        }

        public String getRemoteFilename() {
            return metadata.getType();
        }

        public String getLocalFilename(ArtifactRepository repository) {
            return insertRepositoryKey(getRemoteFilename(), repository.getKey());
        }

        private String insertRepositoryKey(String filename, String repositoryKey) {<FILL_FUNCTION_BODY>}

        public void merge(org.apache.maven.repository.legacy.metadata.ArtifactMetadata metadata) {
            // not used
        }

        public void merge(ArtifactMetadata metadata) {
            // not used
        }

        public void storeInLocalRepository(ArtifactRepository localRepository, ArtifactRepository remoteRepository)
                throws RepositoryMetadataStoreException {
            // not used
        }

        public String extendedToString() {
            return metadata.toString();
        }
    }

            String result;
            int idx = filename.indexOf('.');
            if (idx < 0) {
                result = filename + '-' + repositoryKey;
            } else {
                result = filename.substring(0, idx) + '-' + repositoryKey + filename.substring(idx);
            }
            return result;
        
<no_super_class>