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 *     slacoin <slacoin@nuxeo.com>
019 */
020package org.nuxeo.ecm.automation.core.trace;
021
022import java.util.ArrayList;
023import java.util.List;
024
025import org.nuxeo.ecm.automation.OperationException;
026import org.nuxeo.ecm.automation.OperationType;
027
028/**
029 * @since 5.7.3
030 */
031public class Trace {
032
033    protected final Call parent;
034
035    protected final OperationType chain;
036
037    protected final List<Call> calls;
038
039    protected final Object input;
040
041    protected final Object output;
042
043    protected final OperationException error;
044
045    protected Trace(Call parent, OperationType chain, List<Call> calls, Object input, Object output, OperationException error) {
046        this.parent = parent;
047        this.chain = chain;
048        this.calls = new ArrayList<Call>(calls);
049        this.input = input;
050        this.output = output;;
051        this.error = error;
052    }
053
054
055    public Call getParent() {
056        return parent;
057    }
058
059    public OperationType getChain() {
060        return chain;
061    }
062
063    public OperationException getError() {
064        return error;
065    }
066
067    public Object getInput() {
068        return input;
069    }
070
071    public Object getOutput() {
072        return output;
073    }
074
075    public List<Call> getCalls() {
076        return calls;
077    }
078
079    @Override
080    public String toString() {
081        return TracePrinter.print(this, true);
082    }
083}