/*
 *    Geotools2 - OpenSource mapping toolkit
 *    http://geotools.org
 *    (C) 2005-2006, GeoTools Project Managment Committee (PMC)
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
 *    version 2.1 of the License.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 */
package org.geotools.data.complex.config;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.geotools.util.CheckedArrayList;

/**
 * 
 * @author Gabriel Roldan, Axios Engineering
 * @version $Id: TypeMapping.java 25814 2007-06-12 12:03:41Z groldan $
 * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/unsupported/community-schemas/community-schema-ds/src/main/java/org/geotools/data/complex/config/TypeMapping.java $
 * @since 2.4
 */
public class TypeMapping implements Serializable{

	private static final long serialVersionUID = 1444252634598922057L;
	private String sourceDataStore;
	private String sourceTypeName;
	private String targetElementName;
	private List groupbyAttributeNames = Collections.EMPTY_LIST;
	private List attributeMappings = Collections.EMPTY_LIST;
		
	public TypeMapping(){
		//no-op
	}
	
	public List getAttributeMappings() {
		return new ArrayList(attributeMappings);
	}
	public void setAttributeMappings(List attributeMappings) {
		this.attributeMappings = new CheckedArrayList(AttributeMapping.class);
		if(attributeMappings != null) {
            this.attributeMappings.addAll(attributeMappings);
        }
	}
	
	public List getGroupbyAttributeNames() {
		return new ArrayList(groupbyAttributeNames);
	}
	
	public void setGroupbyAttributeNames(List groupbyAttributeNames) {
		this.groupbyAttributeNames = new CheckedArrayList(String.class);
		if(groupbyAttributeNames != null){
			this.groupbyAttributeNames.addAll(groupbyAttributeNames);
		}
	}
	
	public String getSourceDataStore() {
		return sourceDataStore;
	}
	
	public void setSourceDataStore(String sourceDataStore) {
		this.sourceDataStore = sourceDataStore;
	}
	
	public String getSourceTypeName() {
		return sourceTypeName;
	}
	
	public void setSourceTypeName(String sourceTypeName) {
		this.sourceTypeName = sourceTypeName;
	}
	
	public String getTargetElementName() {
		return targetElementName;
	}
	
	public void setTargetElementName(String targetElementName) {
		this.targetElementName = targetElementName;
	}
	
	public String toString(){
		StringBuffer sb = new StringBuffer();
		sb.append("TypeMappingDTO[")
		.append("sourceDataStore=").append(sourceDataStore)
		.append(",\n sourceTypeName=").append(sourceTypeName)
		.append(",\n targetElementName=").append(targetElementName)
		.append(",\n groupbyAttributeNames=").append(groupbyAttributeNames)
		.append(",\n attributeMappings=").append(attributeMappings)
		.append("]");
		return sb.toString();
		
	}
		
}
