/*******************************************************************************
 * Copyright (c) 2008 SAS Institute Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     SAS Institute Inc. - initial API and implementation
 ******************************************************************************/

package org.eclipse.cosmos.me.provisional.deployment.sdd.tooling.btg.aggregator;

import org.eclipse.cosmos.me.provisional.deployment.sdd.common.spi.Identity;

public class IdentityType {

	//simple type only now, complex type to be done in later iteration
	public static Identity merge(Identity identity1, Identity identity2){
		
		if( equals(identity1,identity2) ){
		
			//merge all display text elements TODO: add when implementation done
			//DisplayTextType.merge( identity1.getShortDescription(),identity2.getShortDescription());
			//DisplayTextType.merge( identity1.getDescription(),identity2.getDescription());
			//TranslatableStringType.merge( identity1.getName(), identity2.getName());
			
			// TODO: merge version
			// VersionType.merge(identity1.getVersion(),identity2.getVersion());
			
			//TODO: add MaintenanceInformation, BuildInformation, Manufacturer
			
					
			return identity1;
		}

		return null;
	}
	
	public static boolean equals(Identity identity1, Identity identity2){
		
		if( identity1.getSoftwareID() == "" || identity2.getSoftwareID() == "" ){
			return true;
		}
		else if(identity1.getSoftwareID().equals(identity2.getSoftwareID())){
			return true;
		}
		
		return false;
	}
}
