|| element.getExtendsElement( ) != null )
|| element.getExtendsName( ) != null )
	private void doAdd( DesignElement content, int slotID, int newPos )			throws ContentException, NameException	{		assert content.getContainer( ) == null;		// Ensure that the content can be put into the container.		ElementDefn metaData = (ElementDefn) element.getDefn( );		if ( !metaData.isContainer( ) )			throw new ContentException( element, slotID,					ContentException.DESIGN_EXCEPTION_NOT_CONTAINER );		SlotDefn slotInfo = (SlotDefn) metaData.getSlot( slotID );		if ( slotInfo == null )			throw new ContentException( element, slotID,					ContentException.DESIGN_EXCEPTION_SLOT_NOT_FOUND );		if ( !slotInfo.canContain( content ) )			throw new ContentException( element, slotID, content,					ContentException.DESIGN_EXCEPTION_WRONG_TYPE );		// Can not change the structure of child element or a virtual element(		// inside the child ).		if ( element.isVirtualElement( )				|| element.getExtendsElement( ) != null )			throw new ContentException(					element,					slotID,					content,					ContentException.DESIGN_EXCEPTION_STRUCTURE_CHANGE_FORBIDDEN );		// This element is already the content of the element to add.		if ( element.isContentOf( content ) )			throw new ContentException( element, slotID, content,					ContentException.DESIGN_EXCEPTION_RECURSIVE );		// If this is a single-item slot, ensure that the slot is empty.		if ( !slotInfo.isMultipleCardinality( )				&& element.getSlot( slotID ).getCount( ) > 0 )		{			throw new ContentException( element, slotID,					ContentException.DESIGN_EXCEPTION_SLOT_IS_FULL );		}		if ( slotID == Module.COMPONENT_SLOT )		{			if ( StringUtil.isBlank( content.getName( ) ) )				throw new ContentException( element, slotID, content,						ContentException.DESIGN_EXCEPTION_CONTENT_NAME_REQUIRED );		}		if ( !element.canContain( module, slotID, content ) )			throw new ContentException(					element,					slotID,					content,					ContentException.DESIGN_EXCEPTION_INVALID_CONTEXT_CONTAINMENT );		// do some checks about the template issues		TemplateCommand cmd = new TemplateCommand( module, element );		TemplateParameterDefinition templateParam = cmd.checkAdd( content,				slotID );		ContentRecord addTemplateParam = null;		if ( templateParam != null )			addTemplateParam = new ContentRecord( module, module,					ReportDesign.TEMPLATE_PARAMETER_DEFINITION_SLOT,					templateParam, true );		// Add the item to the container.		ContentRecord addRecord;		if ( newPos == -1 )		{			addRecord = new ContentRecord( module, element, slotID, content,					true );		}		else		{			addRecord = new ContentRecord( module, element, slotID, content,					newPos );		}		ActivityStack stack = getActivityStack( );		stack.startTrans( addRecord.getLabel( ) );		try		{			// add the template parameter definition first			if ( addTemplateParam != null )				stack.execute( addTemplateParam );			// add the element			stack.execute( addRecord );			// check the name of the content and all its children and add names			// of them to the namespace			addElementNames( content );		}		catch ( NameException e )		{			stack.rollback( );			throw e;		}		stack.commit( );	}