/*******************************************************************************
 * Copyright (c) 2004, 2005 Actuate Corporation.
 * 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:
 *  Actuate Corporation  - initial API and implementation
 *******************************************************************************/

package org.eclipse.birt.report.designer.data.ui.dataset;

import org.eclipse.birt.report.designer.internal.ui.util.ExceptionHandler;
import org.eclipse.birt.report.model.adapter.oda.ModelOdaAdapter;
import org.eclipse.birt.report.model.api.DataSetHandle;
import org.eclipse.birt.report.model.api.OdaDataSetHandle;
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.datatools.connectivity.oda.design.DataSetDesign;
import org.eclipse.datatools.connectivity.oda.design.DesignerState;

/**
 * 
 * Data model manager class
 *
 */
class DataModelManager
{

	private ModelOdaAdapter modelOdaAdapter = new ModelOdaAdapter( );

	/**
	 * update DataSetHandle
	 * 
	 * @param dataSetDesign
	 */
	public void updateDataSetHandle( DataSetDesign dataSetDesign,
			DataSetHandle handle, boolean flag )
	{
		try
		{
			modelOdaAdapter.updateDataSetHandle( dataSetDesign,
					(OdaDataSetHandle) handle,
					flag );
		}
		catch ( SemanticException e )
		{
			ExceptionHandler.handle( e );
		}
	}

	/**
	 * update ROMDesignerState
	 * 
	 * @param designerState
	 */
	public void updateROMDesignerState( DesignerState designerState,
			DataSetHandle handle )
	{
		try
		{
			modelOdaAdapter.updateROMDesignerState( designerState,
					(OdaDataSetHandle) handle );
		}
		catch ( SemanticException e )
		{
			ExceptionHandler.handle( e );
		}
	}
	
	/**
	 * 
	 * @param dataSetDesign
	 * @param handle
	 */
	public void updateDataSetDesign( DataSetDesign dataSetDesign,
			DataSetHandle handle, String propName )
	{
		modelOdaAdapter.updateDataSetDesign( (OdaDataSetHandle) handle,
				dataSetDesign,
				propName );
	}
}