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 * @param <T> Type of the argument 025 */ 026public class WorkflowArgument<T> extends DefaultElementDefinition<T> 027{ 028 029 /** 030 * Constructor for workflow argument 031 * @param name name of model item 032 * @param type model item type 033 * @param label label key for model item 034 * @param description description key for model item 035 * @param isMandatory if model item has to be filled 036 * @param isMultiple if the model item accept multiple values 037 */ 038 @SuppressWarnings("unchecked") 039 public WorkflowArgument(String name, ElementType type, I18nizableText label, I18nizableText description, boolean isMandatory, boolean isMultiple) 040 { 041 super(name, isMultiple, type); 042 setLabel(label); 043 setDescription(description); 044 setValidator(new DefaultValidator(null, isMandatory)); 045 } 046}