protected void addContent(RepositoryResourceWritable res, File assetFile, String name,
                              ArtifactMetadata metadata, String contentUrl) throws RepositoryException {
        String downloadUrl = contentUrl;
        String linkTypeString = null;
        if (metadata != null && metadata.properties != null) {
            if (downloadUrl == null) {
                downloadUrl = metadata.properties.getProperty(PROP_DOWNLOAD_URL);
            }
            linkTypeString = metadata.properties.getProperty(LINK_TYPE_PROPERTY_KEY);
        }

        if (downloadUrl != null && !downloadUrl.isEmpty()) {
            AttachmentLinkType linkType = linkTypeString != null ? AttachmentLinkType.valueOf(linkTypeString) : null;
            res.addContent(assetFile, name, downloadUrl, linkType);
        } else if (assetFile != null) {
            res.addContent(assetFile, name);
        } else {
            // No content so set the download policy to installer to hide the
            // download button in the web UI and display policy hidden to hide it in WDT
            res.setDownloadPolicy(DownloadPolicy.INSTALLER);
            res.setDisplayPolicy(DisplayPolicy.HIDDEN);
        }
    }
protected void addContent ( RepositoryResourceWritable res , File assetFile , String name , ArtifactMetadata metadata , String contentUrl ) throws RepositoryException { String downloadUrl = contentUrl ; String linkTypeString = null ; if ( metadata != null && metadata . properties != null ) { if ( downloadUrl == null ) { downloadUrl = metadata . properties . getProperty ( PROP_DOWNLOAD_URL ) ; } linkTypeString = metadata . properties . getProperty ( LINK_TYPE_PROPERTY_KEY ) ; } if ( downloadUrl != null && ! downloadUrl . isEmpty ( ) ) { AttachmentLinkType linkType = linkTypeString != null ? AttachmentLinkType . valueOf ( linkTypeString ) : null ; res . addContent ( assetFile , name , downloadUrl , linkType ) ; } else if ( assetFile != null ) { res . addContent ( assetFile , name ) ; } else { res . setDownloadPolicy ( DownloadPolicy . INSTALLER ) ; res . setDisplayPolicy ( DisplayPolicy . HIDDEN ) ; } }
<p>
This method adds an attachment for the content JAR and gets the location
(if set) from the artifact metadata, if the metadata is null or doesn't
have a downloadURL in it then it will upload the attachment.
</p>
<p>
If the asset already has a main content attachment then it is deleted
(including deleting in Massive) prior to adding the attachment as an
asset can only have one content attachment
</p>

@throws RepositoryException