001/*
002 *  Copyright 2014 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.runtime.config;
017
018import java.util.ArrayList;
019import java.util.List;
020
021/**
022 * Disable conditions for config parameters.
023 * Composed by a list of conditions or disable conditions and a association operator 
024 */
025public class DisableConditions
026{
027    /** Association between sub conditions*/
028    public enum ASSOCIATION_TYPE
029    {
030        /** And */
031        AND,
032        /** Or */
033        OR
034    }
035    
036    private ASSOCIATION_TYPE _associationType;
037    
038    private final List<DisableConditions> _subConditionsList;
039    
040    private final List<DisableCondition> _conditionList;
041    
042    /**
043     * Creates a disable conditions
044     */
045    public DisableConditions()
046    {
047        _associationType = ASSOCIATION_TYPE.AND;
048        _subConditionsList = new ArrayList<>();
049        _conditionList = new ArrayList<>();
050    }
051    
052    /**
053     * Get the conditions
054     * @return The list of conditions
055     */
056    public List<DisableCondition> getConditions()
057    {
058        return _conditionList;
059    }
060    
061    /**
062     * Get the sub conditions
063     * @return The list of underlying conditions
064     */
065    public List<DisableConditions> getSubConditions()
066    {
067        return _subConditionsList;
068    }
069    
070    /**
071     * Get the association
072     * @return The association
073     */
074    public ASSOCIATION_TYPE getAssociationType()
075    {
076        return _associationType;
077    }
078    
079    /**
080     * Set the association
081     * @param associationType The new association between underlying conditions
082     */
083    public void setAssociation(ASSOCIATION_TYPE associationType)
084    {
085        _associationType = associationType;
086    }
087}