001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     bstefanescu
011 */
012package org.nuxeo.ecm.automation.jaxrs.io.operations;
013
014import java.util.ArrayList;
015import java.util.List;
016
017import org.apache.commons.logging.Log;
018import org.apache.commons.logging.LogFactory;
019import org.nuxeo.ecm.automation.AutomationService;
020import org.nuxeo.ecm.automation.OperationDocumentation;
021import org.nuxeo.ecm.automation.OperationException;
022
023/**
024 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
025 */
026public class AutomationInfo {
027
028    protected static final Log log = LogFactory.getLog(AutomationInfo.class);
029
030    public static final String CHAIN = "Chain";
031
032    protected List<OperationDocumentation> ops;
033
034    protected List<OperationDocumentation> chains = new ArrayList<>();
035
036    public AutomationInfo(AutomationService service) throws OperationException {
037        ops = service.getDocumentation();
038        for(OperationDocumentation op: ops){
039            if(CHAIN.equals(op.getCategory())){
040                chains.add(op);
041            }
042        }
043    }
044
045    public List<OperationDocumentation> getOperations() {
046        return ops;
047    }
048
049    public List<OperationDocumentation> getChains() {
050        return chains;
051    }
052}