@POST
    @Path("/{gavc}" + ServerAPI.GET_LICENSES)
    public Response addLicense(@Auth final DbCredential credential,
                               @PathParam("gavc") final String gavc,
                               @QueryParam(ServerAPI.LICENSE_ID_PARAM) final String licenseId){
        if(!credential.getRoles().contains(AvailableRoles.DATA_UPDATER) &&
                !credential.getRoles().contains(AvailableRoles.LICENSE_SETTER)){
            throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
        }

        if(LOG.isInfoEnabled()) {
            LOG.info(String.format("Got a add license request [%s]", gavc));
        }

        if(licenseId == null){
            return Response.serverError().status(HttpStatus.NOT_ACCEPTABLE_406).build();
        }

        getArtifactHandler().addLicenseToArtifact(gavc, licenseId);
        cacheUtils.clear(CacheName.PROMOTION_REPORTS);

        return Response.ok("done").build();
    }
@ POST @ Path ( "/{gavc}" + ServerAPI . GET_LICENSES ) public Response addLicense ( @ Auth final DbCredential credential , @ PathParam ( "gavc" ) final String gavc , @ QueryParam ( ServerAPI . LICENSE_ID_PARAM ) final String licenseId ) { if ( ! credential . getRoles ( ) . contains ( AvailableRoles . DATA_UPDATER ) && ! credential . getRoles ( ) . contains ( AvailableRoles . LICENSE_SETTER ) ) { throw new WebApplicationException ( Response . status ( Response . Status . UNAUTHORIZED ) . build ( ) ) ; } if ( LOG . isInfoEnabled ( ) ) { LOG . info ( String . format ( "Got a add license request [%s]" , gavc ) ) ; } if ( licenseId == null ) { return Response . serverError ( ) . status ( HttpStatus . NOT_ACCEPTABLE_406 ) . build ( ) ; } getArtifactHandler ( ) . addLicenseToArtifact ( gavc , licenseId ) ; cacheUtils . clear ( CacheName . PROMOTION_REPORTS ) ; return Response . ok ( "done" ) . build ( ) ; }
Add a license to an artifact

@param credential DbCredential
@param gavc String
@param licenseId String
@return Response