001/*
002 *  Copyright 2017 Anyware Services
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 */
016package org.ametys.plugins.extraction.execution;
017
018import org.ametys.cms.repository.Content;
019import org.ametys.plugins.extraction.component.ExtractionComponent;
020
021/**
022 * Context element for nested extraction component
023 */
024public class ExtractionExecutionContextHierarchyElement
025{
026    private ExtractionComponent _component;
027    private Iterable<Content> _contents;
028    private boolean _autoposting;
029    
030    /**
031     * Constructor using element fields
032     * @param component context component
033     * @param contents context contents
034     */
035    public ExtractionExecutionContextHierarchyElement(ExtractionComponent component, Iterable<Content> contents)
036    {
037        this(component, contents, true);
038    }
039    
040    /**
041     * Constructor using all element fields
042     * @param component context component
043     * @param contents context contents
044     * @param autoposting true if the content had to be autoposted, false otherwise
045     */
046    public ExtractionExecutionContextHierarchyElement(ExtractionComponent component, Iterable<Content> contents, boolean autoposting)
047    {
048        super();
049        _component = component;
050        _contents = contents;
051        _autoposting = autoposting;
052    }
053
054    /**
055     * Retrieves the context element's component
056     * @return the context element's component
057     */
058    public ExtractionComponent getComponent()
059    {
060        return _component;
061    }
062    
063    /**
064     * Retrieves the context hierarchy element's contents
065     * @return the context hierarchy element's contents
066     */
067    public Iterable<Content> getContents()
068    {
069        return _contents;
070    }
071    
072    /**
073     * the contents have to be autoposted
074     * @return true if the contents have to be autoposted, false otherwise
075     */
076    public boolean isAutoposting()
077    {
078        return _autoposting;
079    }
080}