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.cms.search.solr.schema;
017
018import java.util.Map;
019
020/**
021 * Represents a copy field definition in a solr schema.
022 */
023public class CopyFieldDefinition implements SchemaDefinition
024{
025    
026    /** The source field. */
027    protected String _source;
028    
029    /** The destination field. */
030    protected String _destination;
031    
032    /**
033     * Build a copy field definition.
034     * @param source The source field.
035     * @param destination The destination field.
036     */
037    public CopyFieldDefinition(String source, String destination)
038    {
039        this._source = source;
040        this._destination = destination;
041    }
042    
043    /**
044     * Build a copy field definition from a map of attributes.
045     * @param attributes the Map of attributes.
046     */
047    public CopyFieldDefinition(Map<String, Object> attributes)
048    {
049        this._source = (String) attributes.get("source");
050        this._destination = (String) attributes.get("dest");
051    }
052    
053    /**
054     * Get the source field.
055     * @return The source field.
056     */
057    public String getSource()
058    {
059        return _source;
060    }
061    
062    /**
063     * Set the source field.
064     * @param source the source field.
065     */
066    public void setSource(String source)
067    {
068        this._source = source;
069    }
070    
071    /**
072     * Get the destination field.
073     * @return The destination field.
074     */
075    public String getDestination()
076    {
077        return _destination;
078    }
079    
080    /**
081     * Set the destination field.
082     * @param destination the destination field.
083     */
084    public void setDestination(String destination)
085    {
086        this._destination = destination;
087    }
088    
089}