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 java.util.ArrayList;
019import java.util.HashMap;
020import java.util.List;
021import java.util.Map;
022
023import org.ametys.plugins.extraction.component.ExtractionComponent;
024
025/**
026 * Object representing the extraction definition file content
027 */
028public class Extraction
029{
030    private List<ExtractionComponent> _extractionComponents;
031    private List<String> _displayOptionalColumnsNames;
032    private Map<String, String> _queryVariablesNamesAndContentTypes;
033    
034    /**
035     * Retrieves the list of the extraction components
036     * @return The extraction components 
037     */
038    public List<ExtractionComponent> getExtractionComponents()
039    {
040        return null != _extractionComponents ? _extractionComponents : new ArrayList<>();
041    }
042    
043    /**
044     * Add an extraction component 
045     * @param extractionComponent The extraction component to add
046     */
047    public void addExtractionComponent(ExtractionComponent extractionComponent)
048    {
049        if (null == _extractionComponents)
050        {
051            _extractionComponents = new ArrayList<>();
052        }
053        _extractionComponents.add(extractionComponent);
054    }
055    
056    /**
057     * Retrieves the list of variables names controlling display of optional columns
058     * @return The variables names
059     */
060    public List<String> getDisplayOptionalColumnsNames()
061    {
062        return null != _displayOptionalColumnsNames ? _displayOptionalColumnsNames : new ArrayList<>();
063    }
064    
065    /**
066     * Set variables names controlling display of optional columns
067     * @param displayOptionalColumnsNames the variables for the optional columns to set
068     */
069    public void setDisplayOptionalColumnsNames(List<String> displayOptionalColumnsNames)
070    {
071        _displayOptionalColumnsNames = displayOptionalColumnsNames;
072    }
073    
074    /**
075     * Retrieves the list of variables names and content type to use in queries
076     * @return A Map containing variables names and content types
077     */
078    public Map<String, String> getQueryVariablesNamesAndContentTypes()
079    {
080        return null != _queryVariablesNamesAndContentTypes ? _queryVariablesNamesAndContentTypes : new HashMap<>();
081    }
082    
083    /**
084     * Set variables names and content types to use in queries
085     * @param queryVariablesNamesAndContentTypes A Map containing variables names and content types to set
086     */
087    public void setQueryVariablesNamesAndContentTypes(Map<String, String> queryVariablesNamesAndContentTypes)
088    {
089        _queryVariablesNamesAndContentTypes = queryVariablesNamesAndContentTypes;
090    }
091
092}