Search in sources :

Example 1 with DeletePrivateUrlCommand

use of edu.harvard.iq.dataverse.engine.command.impl.DeletePrivateUrlCommand in project dataverse by IQSS.

the class DatasetPage method disablePrivateUrl.

public void disablePrivateUrl() {
    try {
        commandEngine.submit(new DeletePrivateUrlCommand(dvRequestService.getDataverseRequest(), dataset));
        privateUrl = null;
        JH.addSuccessMessage(BundleUtil.getStringFromBundle("dataset.privateurl.disabledSuccess"));
    } catch (CommandException ex) {
        logger.info("CommandException caught calling DeletePrivateUrlCommand: " + ex);
    }
}
Also used : DeletePrivateUrlCommand(edu.harvard.iq.dataverse.engine.command.impl.DeletePrivateUrlCommand) CommandException(edu.harvard.iq.dataverse.engine.command.exception.CommandException) IllegalCommandException(edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException)

Example 2 with DeletePrivateUrlCommand

use of edu.harvard.iq.dataverse.engine.command.impl.DeletePrivateUrlCommand in project dataverse by IQSS.

the class Datasets method deletePrivateUrl.

@DELETE
@Path("{id}/privateUrl")
public Response deletePrivateUrl(@PathParam("id") String idSupplied) {
    return response(req -> {
        Dataset dataset = findDatasetOrDie(idSupplied);
        PrivateUrl privateUrl = execCommand(new GetPrivateUrlCommand(req, dataset));
        if (privateUrl != null) {
            execCommand(new DeletePrivateUrlCommand(req, dataset));
            return ok("Private URL deleted.");
        } else {
            return notFound("No Private URL to delete.");
        }
    });
}
Also used : PrivateUrl(edu.harvard.iq.dataverse.privateurl.PrivateUrl) Dataset(edu.harvard.iq.dataverse.Dataset) GetPrivateUrlCommand(edu.harvard.iq.dataverse.engine.command.impl.GetPrivateUrlCommand) DeletePrivateUrlCommand(edu.harvard.iq.dataverse.engine.command.impl.DeletePrivateUrlCommand) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE)

Aggregations

DeletePrivateUrlCommand (edu.harvard.iq.dataverse.engine.command.impl.DeletePrivateUrlCommand)2 Dataset (edu.harvard.iq.dataverse.Dataset)1 CommandException (edu.harvard.iq.dataverse.engine.command.exception.CommandException)1 IllegalCommandException (edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException)1 GetPrivateUrlCommand (edu.harvard.iq.dataverse.engine.command.impl.GetPrivateUrlCommand)1 PrivateUrl (edu.harvard.iq.dataverse.privateurl.PrivateUrl)1 DELETE (javax.ws.rs.DELETE)1 Path (javax.ws.rs.Path)1