001/*
002 *  Copyright 2023 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.workflow.component;
017import org.ametys.runtime.i18n.I18nizableText;
018import org.ametys.runtime.model.DefaultElementDefinition;
019import org.ametys.runtime.model.type.ElementType;
020import org.ametys.runtime.parameter.DefaultValidator;
021
022/**
023 * Class for creating model item for workflow function or condition argument
024 */
025public class WorkflowArgument extends DefaultElementDefinition 
026{
027    
028    /**
029     * Constructor for workflow argument
030     * @param name name of model item
031     * @param type model item type
032     * @param label label key for model item
033     * @param description description key for model item
034     * @param isMandatory if model item has to be filled
035     * @param isMultiple if the model item accept multiple values
036     */
037    @SuppressWarnings("unchecked")
038    public WorkflowArgument(String name, ElementType type, I18nizableText label, I18nizableText description, boolean isMandatory, boolean isMultiple)
039    {
040        super(name, isMultiple, type);
041        setLabel(label);
042        setDescription(description);
043        setValidator(new DefaultValidator(null, isMandatory));
044    }
045}