public void addLicense(final String gavc, final String licenseId) {
        final DbArtifact dbArtifact = getArtifact(gavc);

        // Try to find an existing license that match the new one
        final LicenseHandler licenseHandler = new LicenseHandler(repositoryHandler);
        final DbLicense license = licenseHandler.resolve(licenseId);

        // If there is no existing license that match this one let's use the provided value but
        // only if the artifact has no license  yet. Otherwise it could mean that users has already
        // identify the license manually.
        if(license == null){
            if(dbArtifact.getLicenses().isEmpty()){
                LOG.warn("Add reference to a non existing license called " + licenseId + " in  artifact " + dbArtifact.getGavc());
                repositoryHandler.addLicenseToArtifact(dbArtifact, licenseId);
            }
        }
        // Add only if the license is not already referenced
        else if(!dbArtifact.getLicenses().contains(license.getName())){
            repositoryHandler.addLicenseToArtifact(dbArtifact, license.getName());
        }
    }
public void addLicense ( final String gavc , final String licenseId ) { final DbArtifact dbArtifact = getArtifact ( gavc ) ; final LicenseHandler licenseHandler = new LicenseHandler ( repositoryHandler ) ; final DbLicense license = licenseHandler . resolve ( licenseId ) ; if ( license == null ) { if ( dbArtifact . getLicenses ( ) . isEmpty ( ) ) { LOG . warn ( "Add reference to a non existing license called " + licenseId + " in  artifact " + dbArtifact . getGavc ( ) ) ; repositoryHandler . addLicenseToArtifact ( dbArtifact , licenseId ) ; } } else if ( ! dbArtifact . getLicenses ( ) . contains ( license . getName ( ) ) ) { repositoryHandler . addLicenseToArtifact ( dbArtifact , license . getName ( ) ) ; } }
Adds a license to an artifact if the license exist into the database

@param gavc String
@param licenseId String