if ( targetDefn.isKindOf( elementDefn ) )
if ( elementDefn.isKindOf( targetDefn ) )
	final List perform( Module module, boolean sendEvent )	{		AbstractSemanticValidator validator = triggerDefn.getValidator( );		if ( module instanceof ReportDesign && !validator.canApplyToDesign( )				|| module instanceof Library && !validator.canApplyToLibrary( ) )			return Collections.EMPTY_LIST;		// Locate the target element of validation.		DesignElement toValidate = element;		String elementName = triggerDefn.getTargetElement( );		if ( !StringUtil.isBlank( elementName ) )		{			ElementDefn targetDefn = (ElementDefn) MetaDataDictionary					.getInstance( ).getElement( elementName );			while ( toValidate != null )			{				ElementDefn elementDefn = (ElementDefn) toValidate.getDefn( );				if ( targetDefn.isKindOf( elementDefn ) )					break;				toValidate = toValidate.getContainer( );			}		}		// If the target is not found, no validation is needed. This case is		// usually for the element which is not added into report.		if ( toValidate == null )			return Collections.EMPTY_LIST;		// Perform validation.		List errors = null;		if ( validator instanceof AbstractPropertyValidator )		{			errors = ( (AbstractPropertyValidator) validator ).validate(					module, toValidate, triggerDefn.getPropertyName( ) );		}		else if ( validator instanceof AbstractElementValidator )		{			errors = ( (AbstractElementValidator) validator ).validate( module,					toValidate );		}		assert errors != null;		// Returns if validation events are not needed		if ( !sendEvent )			return errors;		List errorDetailList = new ArrayList( );		Iterator iter = errors.iterator( );		while ( iter.hasNext( ) )		{			SemanticException e = (SemanticException) iter.next( );			ErrorDetail errorDetail = new ErrorDetail( e );			errorDetail.setValidationID( triggerDefn.getValidationID( ) );			errorDetailList.add( errorDetail );		}		ValidationEvent event = new ValidationEvent( toValidate, triggerDefn				.getValidationID( ), errorDetailList );		module.broadcastValidationEvent( toValidate, event );		return errors;	}