001/*
002 *  Copyright 2016 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.contentio.synchronize.impl;
017
018import java.util.List;
019import java.util.Map;
020
021import org.apache.avalon.framework.configuration.Configurable;
022import org.apache.avalon.framework.configuration.Configuration;
023import org.apache.avalon.framework.configuration.ConfigurationException;
024import org.slf4j.Logger;
025
026import org.ametys.cms.repository.Content;
027import org.ametys.plugins.contentio.synchronize.SynchronizingContentOperator;
028import org.ametys.runtime.i18n.I18nizableText;
029import org.ametys.runtime.plugin.component.PluginAware;
030
031/**
032 * Default implementation of {@link SynchronizingContentOperator} which does nothing.
033 */
034public class DefaultSynchronizingContentOperator implements SynchronizingContentOperator, Configurable, PluginAware
035{
036    /** The label */
037    protected I18nizableText _label;
038    /** The name of plugin hosting this component */
039    protected String _pluginName;
040    
041    @Override
042    public void setPluginInfo(String pluginName, String featureName, String id)
043    {
044        _pluginName = pluginName;
045    }
046    
047    @Override
048    public void configure(Configuration configuration) throws ConfigurationException
049    {
050        _label = I18nizableText.parseI18nizableText(configuration.getChild("label"), "plugin." + _pluginName);
051    }
052    
053    @Override
054    public I18nizableText getLabel()
055    {
056        return _label;
057    }
058    
059    @Override
060    public Map<String, List<Object>> transform(Map<String, List<Object>> remoteValues, Logger logger)
061    {
062        return remoteValues;
063    }
064
065    @Override
066    public void additionalOperation(Content content, Map<String, List<Object>> remoteValues, Logger logger)
067    {
068        // Do nothing
069    }
070
071}