class ArtifactResource extends AbstractResource {

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/isPromoted")
    public Response isPromoted(@QueryParam("user") final String user,
                               @QueryParam("stage") final int stage,
                               @QueryParam("name") final String filename,
                               @QueryParam("sha256") final String sha256,
                               @QueryParam("type") final String type,
                               @QueryParam("location") final String location) {

        LOG.info("Got a get artifact promotion request");
    	
    	// Validating request
        final ArtifactQuery query = new ArtifactQuery(user, stage, filename, sha256, type, location);
        DataValidator.validate(query);

        if(LOG.isInfoEnabled()) {
            LOG.info(String.format("Artifact validation request. Details [%s]", query.toString()));
        }
        
        // Validating type of request file
        final GrapesServerConfig cfg = getConfig();
        final List<String> validatedTypes = cfg.getExternalValidatedTypes();

        if(!validatedTypes.contains(type)) {
            return Response.ok(buildArtifactNotSupportedResponse(validatedTypes)).status(HttpStatus.UNPROCESSABLE_ENTITY_422).build();
        }

        final DbArtifact dbArtifact = getArtifactHandler().getArtifactUsingSHA256(sha256);

        //
        // No such artifact was identified in the underlying data structure
        //
        if(dbArtifact == null) {
            final String jiraLink = buildArtifactNotificationJiraLink(query);

            sender.send(cfg.getArtifactNotificationRecipients(),
                    buildArtifactValidationSubject(filename),
                    buildArtifactValidationBody(query, "N/A"));  // No Jenkins job if not artifact

            return Response.ok(buildArtifactNotKnown(query, jiraLink)).status(HttpStatus.NOT_FOUND_404).build();
        }

        final ArtifactPromotionStatus promotionStatus = new ArtifactPromotionStatus();
        promotionStatus.setPromoted(dbArtifact.isPromoted());

        // If artifact is promoted
        if(dbArtifact.isPromoted()){
            promotionStatus.setMessage(Messages.get(ARTIFACT_VALIDATION_IS_PROMOTED));
            return Response.ok(promotionStatus).build();
        } else {

            final String jenkinsJobInfo = getArtifactHandler().getModuleJenkinsJobInfo(dbArtifact);
            
            promotionStatus.setMessage(buildArtifactNotPromotedYetResponse(query, jenkinsJobInfo.isEmpty() ? "<i>(Link to Jenkins job not found)</i>" : jenkinsJobInfo));

            // If someone just did not promote the artifact, don't spam the support with more emails
        }

        return Response.ok(promotionStatus).build();
    }

    public  ArtifactResource(final RepositoryHandler repoHandler, final GrapesServerConfig dmConfig);

}