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.Map; 019 020import org.apache.avalon.framework.configuration.Configuration; 021 022import org.ametys.plugins.contentio.synchronize.SynchronizableContentsCollection; 023import org.ametys.plugins.contentio.synchronize.SynchronizableContentsCollectionModel; 024import org.ametys.runtime.i18n.I18nizableText; 025import org.ametys.runtime.parameter.Parameter; 026import org.ametys.runtime.parameter.ParameterHelper.ParameterType; 027 028/** 029 * Implementation of {@link SynchronizableContentsCollectionModel} able to populate contents from a LDAP source 030 * 031 */ 032public class DefaultSynchronizableContentsCollectionModel implements SynchronizableContentsCollectionModel 033{ 034 private String _id; 035 private Class<SynchronizableContentsCollection> _syncCollectionClass; 036 private I18nizableText _label; 037 private I18nizableText _description; 038 private Map<String, ? extends Parameter<ParameterType>> _parameters; 039 private String _pluginName; 040 041 /** 042 * Constructor 043 * @param id The unique identifier of this user directory model 044 * @param syncCollectionClass The {@link SynchronizableContentsCollection} class 045 * @param sccConfig Additional configuration for {@link SynchronizableContentsCollection} class. Can be empty. 046 * @param label The i18n label 047 * @param description The i18n description 048 * @param parameters the parameters 049 * @param pluginName the plugin name of declaration (for debug purpose) 050 */ 051 public DefaultSynchronizableContentsCollectionModel(String id, Class<SynchronizableContentsCollection> syncCollectionClass, Configuration sccConfig, I18nizableText label, I18nizableText description, Map<String, ? extends Parameter<ParameterType>> parameters, String pluginName) 052 { 053 _id = id; 054 _syncCollectionClass = syncCollectionClass; 055 _label = label; 056 _description = description; 057 _parameters = parameters; 058 _pluginName = pluginName; 059 } 060 061 @Override 062 public String getId() 063 { 064 return _id; 065 } 066 067 @Override 068 public I18nizableText getLabel() 069 { 070 return _label; 071 } 072 073 @Override 074 public I18nizableText getDescription() 075 { 076 return _description; 077 } 078 079 @Override 080 public Map<String, ? extends Parameter<ParameterType>> getParameters() 081 { 082 return _parameters; 083 } 084 085 @Override 086 public String getPluginName() 087 { 088 return _pluginName; 089 } 090 091 @Override 092 public Class<SynchronizableContentsCollection> getSynchronizableCollectionClass() 093 { 094 return _syncCollectionClass; 095 } 096}