<commit_before>/*******************************************************************************
 * 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.core.data.DataType;
import org.eclipse.birt.report.designer.core.model.views.data.DataSetItemModel;
import org.eclipse.birt.report.model.api.DataSetHandle;
import org.eclipse.birt.report.model.api.StructureFactory;
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants;
import org.eclipse.birt.report.model.api.elements.structures.ResultSetColumn;

/**
 * The utility class.
 */
public final class DataSetUIUtil
{
	/**
	 * Save the column meta data to data set handle.
	 * 
	 * @param dataSetHandle
	 * @param items
	 * @throws SemanticException
	 */
	public static void updateColumnCache( DataSetHandle dataSetHandle, DataSetItemModel[] items ) throws SemanticException
	{
		if ( items.length > 0 )
		{
			dataSetHandle.setCachedMetaData( StructureFactory.createCachedMetaData( ) );

			for ( int i = 0; i < items.length; i++ )
			{
				ResultSetColumn rsc = StructureFactory.createResultSetColumn( );
				rsc.setColumnName( ( items[i].getAlias( ) == null || items[i].getAlias( )
						.trim( )
						.length( ) == 0 ) ? items[i].getDataSetColumnName( )
						: items[i].getAlias( ) );
				rsc.setDataType( toModelDataType( items[i].getDataType( ) ) );<commit_msg>Add utility class according to GUI's request.<commit_after>/*******************************************************************************
 * 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.core.data.DataType;
import org.eclipse.birt.report.designer.core.model.views.data.DataSetItemModel;
import org.eclipse.birt.report.designer.internal.ui.util.DataSetManager;
import org.eclipse.birt.report.model.api.DataSetHandle;
import org.eclipse.birt.report.model.api.StructureFactory;
import org.eclipse.birt.report.model.api.activity.SemanticException;
import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants;
import org.eclipse.birt.report.model.api.elements.structures.ResultSetColumn;

/**
 * The utility class.
 */
public final class DataSetUIUtil
{
	/**
	 * Save the column meta data to data set handle.
	 * 
	 * @param dataSetHandle
	 * @param items
	 * @throws SemanticException
	 */
	public static void updateColumnCache( DataSetHandle dataSetHandle ) throws SemanticException
	{
		DataSetItemModel[] items = DataSetManager.getCurrentInstance( ).getColumns( dataSetHandle, true);
		if ( items.length > 0 )
		{
			dataSetHandle.setCachedMetaData( StructureFactory.createCachedMetaData( ) );

			for ( int i = 0; i < items.length; i++ )
			{
				ResultSetColumn rsc = StructureFactory.createResultSetColumn( );
				rsc.setColumnName( ( items[i].getAlias( ) == null || items[i].getAlias( )
						.trim( )
						.length( ) == 0 ) ? items[i].getDataSetColumnName( )
						: items[i].getAlias( ) );
				rsc.setDataType( toModelDataType( items[i].getDataType( ) ) );
{'fraction_non_alphanumeric': 0.18602885345482156, 'fraction_numerical': 0.007593014426727411, 'mean_word_length': 4.6700143472022955, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7327410', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1107, 'n_words': 250}