/*
 * $Id$
 *
 * JSDAI(TM), a way to implement STEP, ISO 10303
 * Copyright (C) 1997-2008, LKSoftWare GmbH, Germany
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License
 * version 3 as published by the Free Software Foundation (AGPL v3).
 *
 * This program 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * JSDAI is a registered trademark of LKSoftWare GmbH, Germany
 * This software is also available under commercial licenses.
 * See also http://www.jsdai.net/
 */

package jsdai.SAltered_package_xim;

/**
 * 
 * @author Giedrius Liutkus
 * @version $$
 */

import jsdai.lang.*;
import jsdai.libutil.EMappedXIMEntity;
import jsdai.SAltered_package_mim.*;
import jsdai.SPhysical_unit_usage_view_xim.*;

public class CxSurface_prepped_terminal_armx extends CSurface_prepped_terminal_armx implements EMappedXIMEntity{


	public int attributeState = ATTRIBUTES_MODIFIED;	

	public void createAimData(SdaiContext context) throws SdaiException {
		if (attributeState == ATTRIBUTES_MODIFIED) {
			attributeState = ATTRIBUTES_UNMODIFIED;
		} else {
			return;
		}

		setTemp("AIM", CSurface_prepped_terminal.definition);

		setMappingConstraints(context, this);
		
		// Part_feature
		setMaterial_state_change(context, this);
		
		setPrecedent_feature(context, this);

		// terminal_to_be_altered
		setTerminal_to_be_altered(context, this);
		
		// surface_preparation - made DERIVED
		// setSurface_preparation(context, this);
		
		// Clean ARM
		unsetMaterial_state_change(null);
		unsetPrecedent_feature(null);

		// terminal_to_be_altered
		unsetTerminal_to_be_altered(null);

	}

	public void removeAimData(SdaiContext context) throws SdaiException {
			unsetMappingConstraints(context, this);
			
			unsetMaterial_state_change(context, this);
			
			unsetPrecedent_feature(context, this);

			// terminal_to_be_altered
			unsetTerminal_to_be_altered(context, this);

			// surface_preparation - MADE DERIVED
			// unsetSurface_preparation(context, this);
	}

	/**
	 * Sets/creates data for mapping constraints.
	 * 
	 * <p>
	 * mapping_constraints; 
	 *  surface_prepped_terminal &lt;=
	 *  altered_package_terminal &lt;= 
	 *  package_terminal &lt;= 
	 *  shape_aspect
	 * end_mapping_constraints;
	 * </p>
	 * 
	 * @param context
	 *            SdaiContext.
	 * @param armEntity
	 *            arm entity.
	 * @throws SdaiException
	 */
	public static void setMappingConstraints(SdaiContext context,
			ESurface_prepped_terminal_armx armEntity) throws SdaiException {
		unsetMappingConstraints(context, armEntity);
		CxAltered_package_terminal_armx.setMappingConstraints(context, armEntity);
	}

	/**
	 * Unsets/deletes mapping constraint data.
	 * 
	 * @param context
	 * @param armEntity
	 * @throws SdaiException
	 */
	public static void unsetMappingConstraints(SdaiContext context,
			ESurface_prepped_terminal_armx armEntity) throws SdaiException {
		CxAltered_package_terminal_armx.unsetMappingConstraints(context, armEntity);
	}


	/**
	 * Sets/creates data for material_state_change.
	 * 
	 * <p>
	 *  shape_aspect &lt;-
	 *  shape_aspect_relationship.related_shape_aspect
	 *  {shape_aspect_relationship
	 *  shape_aspect_relationship.name = 'precedent feature'}
	 *  shape_aspect_relationship.relating_shape_aspect -&gt;
	 *  shape_aspect
	 * </p>
	 * 
	 * @param context
	 *            SdaiContext.
	 * @param armEntity
	 *            arm entity.
	 * @throws SdaiException
	 */
	
////////////////////////////////////////////////////////////////////
	/**
	* Sets/creates data for material_state_change attribute.
	*  end_attribute_mapping;
	*
	* @param context SdaiContext.
	* @param armEntity arm entity.
	* @throws SdaiException
	*/
	public static void setMaterial_state_change(SdaiContext context, EPart_feature armEntity) throws SdaiException
	{
		CxPart_feature.setMaterial_state_change(context, armEntity);
	}


	/**
	* Unsets/deletes data for material_state_change attribute.
	*
	* @param context SdaiContext.
	* @param armEntity arm entity.
	* @throws SdaiException
	*/
	public static void unsetMaterial_state_change(SdaiContext context, EPart_feature armEntity) throws SdaiException
	{
		CxPart_feature.unsetMaterial_state_change(context, armEntity);		
	}


	/**
	* Sets/creates data for precedent_feature attribute.
	*
	*  attribute_mapping precedent_feature_part_feature (precedent_feature
	* , (*PATH*), part_feature);
	*  end_attribute_mapping;
	*
	* @param context SdaiContext.
	* @param armEntity arm entity.
	* @throws SdaiException
	*/
	public static void setPrecedent_feature(SdaiContext context, EPart_feature armEntity) throws SdaiException
	{
		CxPart_feature.setPrecedent_feature(context, armEntity);
	}


	/**
	* Unsets/deletes data for precedent_feature attribute.
	*
	* @param context SdaiContext.
	* @param armEntity arm entity.
	* @throws SdaiException
	*/
	public static void unsetPrecedent_feature(SdaiContext context, EPart_feature armEntity) throws SdaiException
	{
		CxPart_feature.unsetPrecedent_feature(context, armEntity);		
	}
	

	//********** "altered_package_terminal" attributes

	/**
	* Sets/creates data for terminal_to_be_altered attribute.
	*
	* @param context SdaiContext.
	* @param armEntity arm entity.
	* @throws SdaiException
	*/
	public static void setTerminal_to_be_altered(SdaiContext context, EAltered_package_terminal_armx armEntity) throws SdaiException
	{
		CxAltered_package_terminal_armx.setTerminal_to_be_altered(context, armEntity);
	}


	/**
	* Unsets/deletes data for terminal_to_be_altered attribute.
	*
	* @param context SdaiContext.
	* @param armEntity arm entity.
	* @throws SdaiException
	*/
	public static void unsetTerminal_to_be_altered(SdaiContext context, EAltered_package_terminal_armx armEntity) throws SdaiException
	{
		CxAltered_package_terminal_armx.unsetTerminal_to_be_altered(context, armEntity);
	}


	//********** "surface_prepped_terminal" attributes

	/**
	* Sets/creates data for surface_preparation attribute.
	*
	* <p>
	*  attribute_mapping surface_preparation_surface_finish_specification (surface_preparation
	* , (*PATH*), surface_finish_specification);
	* 	surface_prepped_terminal &lt;=
		altered_package_terminal &lt;=
		package_terminal
		document_reference_item = package_terminal
		document_reference_item &lt;-
		applied_document_reference.items[i]
		applied_document_reference
		applied_document_reference &lt;=
		document_reference
		document_reference.assigned_document -&gt;
		document &lt;-
		document_product_association.relating_document
		{document_product_association.name = 'equivalence'}
		document_product_association.related_product -&gt;
		product_or_formation_or_definition = product_definition
		product_definition
		{product_definition.name = 'surface finish specification'}
	*  end_attribute_mapping;
	* </p>
	* @param context SdaiContext.
	* @param armEntity arm entity.
	* @throws SdaiException
	*/
	/* MADE DERIVED
	public static void setSurface_preparation(SdaiContext context, ESurface_prepped_terminal_armx armEntity) throws SdaiException
	{
		//unset old values
		unsetSurface_preparation(context, armEntity);

		if (armEntity.testSurface_preparation(null))
		{
			ESurface_finish_specification armSurface_preparation = armEntity.getSurface_preparation(null);
			CxAP210ARMUtilities.assignDocument_definition(context, armSurface_preparation, armEntity);			
		}
	}
*/

	/**
	* Unsets/deletes data for surface_preparation attribute.
	*
	* @param context SdaiContext.
	* @param armEntity arm entity.
	* @throws SdaiException
	*/
	/* MADE DERIVED	
	public static void unsetSurface_preparation(SdaiContext context, ESurface_prepped_terminal armEntity) throws SdaiException
	{
		CxAP210ARMUtilities.unAssignDocument_definition(context, armEntity, "surface finish specification");		
	}	*/
}