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.component;
017
018import org.apache.commons.lang3.StringUtils;
019
020/**
021 * Object representing a extraction columns
022 */
023public class ExtractionColumn
024{
025
026    private String _fieldPath;
027    private String _displayOptionalName;
028    
029    /**
030     * Retrieves the field path
031     * @return The field path
032     */
033    public String getFieldPath()
034    {
035        return _fieldPath;
036    }
037    
038    /**
039     * Set the field path
040     * @param fieldPath The field path to set
041     */
042    public void setFieldPath(String fieldPath)
043    {
044        _fieldPath = fieldPath;
045    }
046    
047    /**
048     * Checks if the extraction column is optional
049     * @return true if the column is optional, false otherwise
050     */
051    public boolean isOptional()
052    {
053        return !StringUtils.isBlank(_displayOptionalName);
054    }
055    
056    /**
057     * Retrieves the name of the variable controlling display of optional column 
058     * @return The name of the variable
059     */
060    public String getDisplayOptionalName()
061    {
062        return _displayOptionalName;
063    }
064    
065    /**
066     * Set the name of the variable controlling the display of optional column
067     * @param displayOptionalName The name of the variable 
068     */
069    public void setDisplayOptionalName(String displayOptionalName)
070    {
071        _displayOptionalName = displayOptionalName;
072    }
073}