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 String _descriptionId;
031    private List<ExtractionComponent> _extractionComponents;
032    private List<String> _displayOptionalColumnsNames;
033    private Map<String, String> _queryVariablesNamesAndContentTypes;
034    
035    /**
036     * Retrieves the identifier of the extraction's description
037     * @return the identifier of the extraction's description
038     */
039    public String getDescriptionId()
040    {
041        return _descriptionId;
042    }
043    
044    /**
045     * Set the identifier of the extraction's description
046     * @param descriptionId the identifier to set
047     */
048    public void setDescriptionId(String descriptionId)
049    {
050        _descriptionId = descriptionId;
051    }
052    
053    /**
054     * Retrieves the list of the extraction components
055     * @return The extraction components 
056     */
057    public List<ExtractionComponent> getExtractionComponents()
058    {
059        return null != _extractionComponents ? _extractionComponents : new ArrayList<>();
060    }
061    
062    /**
063     * Add an extraction component 
064     * @param extractionComponent The extraction component to add
065     */
066    public void addExtractionComponent(ExtractionComponent extractionComponent)
067    {
068        if (null == _extractionComponents)
069        {
070            _extractionComponents = new ArrayList<>();
071        }
072        _extractionComponents.add(extractionComponent);
073    }
074    
075    /**
076     * Retrieves the list of variables names controlling display of optional columns
077     * @return The variables names
078     */
079    public List<String> getDisplayOptionalColumnsNames()
080    {
081        return null != _displayOptionalColumnsNames ? _displayOptionalColumnsNames : new ArrayList<>();
082    }
083    
084    /**
085     * Set variables names controlling display of optional columns
086     * @param displayOptionalColumnsNames the variables for the optional columns to set
087     */
088    public void setDisplayOptionalColumnsNames(List<String> displayOptionalColumnsNames)
089    {
090        _displayOptionalColumnsNames = displayOptionalColumnsNames;
091    }
092    
093    /**
094     * Retrieves the list of variables names and content type to use in queries
095     * @return A Map containing variables names and content types
096     */
097    public Map<String, String> getQueryVariablesNamesAndContentTypes()
098    {
099        return null != _queryVariablesNamesAndContentTypes ? _queryVariablesNamesAndContentTypes : new HashMap<>();
100    }
101    
102    /**
103     * Set variables names and content types to use in queries
104     * @param queryVariablesNamesAndContentTypes A Map containing variables names and content types to set
105     */
106    public void setQueryVariablesNamesAndContentTypes(Map<String, String> queryVariablesNamesAndContentTypes)
107    {
108        _queryVariablesNamesAndContentTypes = queryVariablesNamesAndContentTypes;
109    }
110
111}