All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openprovenance.prov.service.translation.actions.ActionMetrics Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
package org.openprovenance.prov.service.translation.actions;

import jakarta.ws.rs.core.Response;
import org.jboss.resteasy.plugins.providers.multipart.InputPart;
import org.openprovenance.prov.service.core.ActionPerformer;
import org.openprovenance.prov.service.core.ServiceUtils;
import org.openprovenance.prov.storage.api.DocumentResource;

import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;

public final class ActionMetrics implements ActionPerformer {

    private final ServiceUtils utils;

    public ActionMetrics(ServiceUtils utils) {
        this.utils=utils;
    }

    @Override
    public ServiceUtils.Action getAction() {
        return ServiceUtils.Action.METRICS;
    }

    @Override
    public Response doAction(Map> formData, DocumentResource vr, Date date) throws IOException {

        String location = "metrics/" + vr.getVisibleId() + "." + "json";

        return utils.composeResponseSeeOther(location).header("Expires", date).build();
    }

    @Override public String toString () {
        return "<>";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy