001/*
002 * (C) Copyright 2013 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     vpasquier <vpasquier@nuxeo.com>
018 */
019package org.nuxeo.ecm.automation.core;
020
021import java.util.ArrayList;
022
023import org.nuxeo.common.xmap.annotation.XNode;
024import org.nuxeo.common.xmap.annotation.XNodeList;
025import org.nuxeo.common.xmap.annotation.XObject;
026
027/**
028 * @since 5.7.3 The exception chain declaration for Automation exceptions.
029 */
030@XObject("catchChain")
031public class ChainExceptionDescriptor {
032
033    @XNode("@id")
034    protected String id;
035
036    @XNode("@onChainId")
037    protected String onChainId;
038
039    @XNodeList(value = "run", type = ArrayList.class, componentType = ChainExceptionRun.class)
040    protected ArrayList<ChainExceptionRun> chainExceptionRuns;
041
042    public String getOnChainId() {
043        return onChainId;
044    }
045
046    public ArrayList<ChainExceptionRun> getChainExceptionsRun() {
047        return chainExceptionRuns;
048    }
049
050    public String getId() {
051        return id;
052    }
053
054    @XObject("run")
055    public static class ChainExceptionRun {
056
057        @XNode("@chainId")
058        protected String chainId;
059
060        @XNode("@priority")
061        protected Integer priority = 0;
062
063        @XNode("@rollBack")
064        protected Boolean rollBack = true;
065
066        @XNode("@filterId")
067        protected String filterId = "";
068
069        public String getChainId() {
070            return chainId;
071        }
072
073        public Integer getPriority() {
074            return priority;
075        }
076
077        public Boolean getRollBack() {
078            return rollBack;
079        }
080
081        public String getFilterId() {
082            return filterId;
083        }
084    }
085}