001/*
002 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl-2.1.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     vpasquier <vpasquier@nuxeo.com>
016 */
017package org.nuxeo.ecm.automation.server.jaxrs;
018
019import org.nuxeo.ecm.automation.OperationException;
020
021import javax.servlet.http.HttpServletResponse;
022
023/**
024 * Automation exception to extend to be thrown during REST calls on
025 * Automation operations.
026 *
027 * @since 7.1
028 */
029public class RestOperationException extends OperationException {
030
031    private static final long serialVersionUID = 1L;
032
033    protected int status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
034
035    public RestOperationException(String message) {
036        super(message);
037    }
038
039    public RestOperationException(Throwable cause) {
040        super(cause);
041    }
042
043    public RestOperationException(String message, Throwable cause) {
044        super(message, cause);
045    }
046
047    public RestOperationException(String message, int status) {
048        super(message);
049        this.status = status;
050    }
051
052    public RestOperationException(Throwable cause, int status) {
053        super(cause);
054        this.status = status;
055    }
056
057    public RestOperationException(String message, Throwable cause, int status) {
058        super(message, cause);
059        this.status = status;
060    }
061
062    public int getStatus() {
063        return status;
064    }
065
066    public void setStatus(int status) {
067        this.status = status;
068    }
069}