assert content != null;    if ( !element.getDefn( ).isContainer( ) ) throw new ContentException( element, slotID, ContentException.DESIGN_EXCEPTION_NOT_CONTAINER ); ContainerSlot slot = element.getSlot( slotID ); if ( slot == null ) throw new ContentException( element, slotID, ContentException.DESIGN_EXCEPTION_SLOT_NOT_FOUND ); if ( !slot.contains( content ) ) throw new ContentException( element, slotID, content, ContentException.DESIGN_EXCEPTION_CONTENT_NOT_FOUND ); if ( !slot.canDrop( content ) ) throw new ContentException( element, slotID, ContentException.DESIGN_EXCEPTION_DROP_FORBIDDEN );     if ( hasDescendents( content, slotID ) ) { throw new ContentException( element, slotID, ContentException.DESIGN_EXCEPTION_HAS_DESCENDENTS ); }    ContentRecord dropRecord = new ContentRecord( element, slotID, content, false );    if ( MetaDataDictionary.getInstance( ).useID( ) ) { dropRecord.setRoot( design ); }  ActivityStack stack = getActivityStack( ); stack.startTrans( dropRecord.getLabel( ) );  try {   removeContents( content );    dropUserProperties( content ); if ( content.hasReferences( ) ) adjustReferenceClients( (ReferenceableElement) content, unresolveReference ); adjustReferredClients( content ); adjustDerived( content );    if ( content.getLocalStyle( design ) != null ) { StyleCommand styleCmd = new StyleCommand( design, content ); styleCmd.setStyle( null ); }    if ( content.getExtendsElement( ) != null ) { ExtendsCommand extendsCmd = new ExtendsCommand( design, content ); extendsCmd.setExtendsName( null ); }    if ( content.getName( ) != null ) { NameCommand nameCmd = new NameCommand( design, content ); nameCmd.dropElement( ); } } catch ( SemanticException ex ) { stack.rollback( ); throw ex; }    stack.execute( dropRecord ); stack.commit( );
remove( content, slotID, false );
	public void remove( DesignElement content, int slotID,			boolean unresolveReference ) throws SemanticException	{		assert content != null;		// Ensure that the content can be dropped from the container.		if ( !element.getDefn( ).isContainer( ) )			throw new ContentException( element, slotID,					ContentException.DESIGN_EXCEPTION_NOT_CONTAINER );		ContainerSlot slot = element.getSlot( slotID );		if ( slot == null )			throw new ContentException( element, slotID,					ContentException.DESIGN_EXCEPTION_SLOT_NOT_FOUND );		if ( !slot.contains( content ) )			throw new ContentException( element, slotID, content,					ContentException.DESIGN_EXCEPTION_CONTENT_NOT_FOUND );		if ( !slot.canDrop( content ) )			throw new ContentException( element, slotID,					ContentException.DESIGN_EXCEPTION_DROP_FORBIDDEN );		// if the content is in component slot of report design and it has		// children, then the operation is forbidden.		if ( hasDescendents( content, slotID ) )		{			throw new ContentException( element, slotID,					ContentException.DESIGN_EXCEPTION_HAS_DESCENDENTS );		}		// Prepare the transaction.		ContentRecord dropRecord = new ContentRecord( element, slotID, content,				false );		// Tell the record if we are using element IDs.		if ( MetaDataDictionary.getInstance( ).useID( ) )		{			dropRecord.setRoot( design );		}		ActivityStack stack = getActivityStack( );		stack.startTrans( dropRecord.getLabel( ) );		try		{			// Remove contents.			removeContents( content );			// Clean up references to or from the element.			dropUserProperties( content );			if ( content.hasReferences( ) )				adjustReferenceClients( (ReferenceableElement) content,						unresolveReference );			adjustReferredClients( content );			adjustDerived( content );			// Drop the style...			if ( content.getLocalStyle( design ) != null )			{				StyleCommand styleCmd = new StyleCommand( design, content );				styleCmd.setStyle( null );			}			// Drop the extends...			if ( content.getExtendsElement( ) != null )			{				ExtendsCommand extendsCmd = new ExtendsCommand( design, content );				extendsCmd.setExtendsName( null );			}			// Remove from name space...			if ( content.getName( ) != null )			{				NameCommand nameCmd = new NameCommand( design, content );				nameCmd.dropElement( );			}		}		catch ( SemanticException ex )		{			stack.rollback( );			throw ex;		}		// Remove the element itself.		stack.execute( dropRecord );		stack.commit( );	}