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.cms.workflow;
017
018import java.util.List;
019import java.util.Map;
020
021import org.ametys.plugins.workflow.component.AmetysObjectCurrentStepCondition;
022import org.ametys.runtime.i18n.I18nizableText;
023
024/**
025 * OSWorkflow condition to test the current step of a content
026 * The following configuration have to be used:<br>
027 * <pre>
028 * &lt;condition type="avalon"&gt;
029 * &nbsp;&nbsp;&lt;arg name="role"&gt;org.ametys.cms.workflow.ContentCurrentStepCondition&lt;/arg&gt;
030 * &nbsp;&nbsp;&lt;arg name="step"&gt;2&lt;/arg&gt;
031 * &lt;/condition&gt;
032 * </pre>
033 * <br>
034 * @deprecated use {@link AmetysObjectCurrentStepCondition} instead with additional argument: &lt;arg name="object-key"&gt;org.ametys.cms.repository.Content&lt;/arg&gt;
035 */
036@Deprecated
037public class ContentCurrentStepCondition extends AmetysObjectCurrentStepCondition
038{
039    @Override
040    protected Object _getAmetysObjectKey(Map args)
041    {
042        return AbstractContentWorkflowComponent.CONTENT_KEY;
043    }
044    
045    @Override
046    public I18nizableText getDescription(Map<String, String> argumentsValues)
047    {
048        String stepId = (String) argumentsValues.get("step");
049        return new I18nizableText("plugin.cms", "PLUGINS_CMS_CONTENT_CURRENT_STEP_CONDITION_DESCRIPTION", List.of(stepId));
050    }
051}