001/*
002 *  Copyright 2011 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.survey.repository;
017
018/**
019 * Class representing a survey rule on a page or question.
020 */
021public class SurveyRule
022{
023    
024    /** Type of a page. */
025    public enum RuleType
026    {
027        /** Jump. */
028        JUMP,
029        /** Skip. */
030        SKIP,
031        /** Finish. */
032        FINISH
033    }
034    
035    private String _option;
036    private RuleType _type;
037    private String _page;
038    
039    /**
040     * Constructor
041     * @param type the type 
042     * @param page the page to jump or skip
043     */
044    public SurveyRule (RuleType type, String page)
045    {
046        this(null, type, page);
047    }
048    
049    /**
050     * Constructor
051     * @param option the selected option
052     * @param type the type 
053     * @param page the page to jump or skip
054     */
055    public SurveyRule (String option, RuleType type, String page)
056    {
057        _option = option;
058        _type = type;
059        _page = page;
060    }
061    
062    /**
063     * Get the selected option
064     * @return the selected option
065     */
066    public String getOption ()
067    {
068        return _option;
069    }
070    
071    /**
072     * Get the type
073     * @return the type
074     */
075    public RuleType getType ()
076    {
077        return _type;
078    }
079    
080    /**
081     * Get the page to jump or skip. Can be null.
082     * @return the page to jump or skip
083     */
084    public String getPage ()
085    {
086        return _page;
087    }
088
089}