ExtensionException.DESIGN_EXCEPTION_INVALID_DEFAULT_VALUE );
MetaDataException.DESIGN_EXCEPTION_INVALID_DEFAULT_VALUE );
		ExtensionPropertyDefn loadProperty( IConfigurationElement elementTag,				IConfigurationElement propTag, ExtensionElementDefn elementDefn )				throws ExtensionException		{			// load required parts			String name = propTag.getAttribute( NAME_ATTRIB );			String type = propTag.getAttribute( TYPE_ATTRIB );			checkRequiredAttribute( NAME_ATTRIB, name );			checkRequiredAttribute( TYPE_ATTRIB, type );			// load optional parts			String displayNameID = propTag					.getAttribute( DISPLAY_NAME_ID_ATTRIB );			String canInherit = propTag.getAttribute( CAN_INHERIT_ATTRIB );			String defaultValue = propTag.getAttribute( DEFAULT_VALUE_ATTRIB );			String isEncrypted = propTag.getAttribute( IS_ENCRYPTABLE_ATTRIB );			String defaultDisplayName = propTag					.getAttribute( DEFAULT_DISPLAY_NAME_ATTRIB );			String subType = propTag.getAttribute( SUB_TYPE_ATTRIB );			// by default set it to 'string' type			if ( StringUtil.isBlank( subType ) )				subType = PropertyType.STRING_TYPE_NAME;			MetaDataDictionary dd = MetaDataDictionary.getInstance( );			PropertyType propType = dd.getPropertyType( type );			// not well-recognized or not supported by extension, fire error			if ( propType == null					|| !getAllowedPropertyTypes( ).contains( propType ) )				throw new ExtensionException(						new String[]{type},						ExtensionException.DESIGN_EXCEPTION_INVALID_PROPERTY_TYPE );			PropertyType subPropType = null;			if ( propType.getTypeCode( ) == PropertyType.LIST_TYPE )			{				subPropType = MetaDataDictionary.getInstance( )						.getPropertyType( subType );				if ( subPropType == null						|| !getAllowedSubPropertyTypes( )								.contains( subPropType ) )					throw new ExtensionException(							new String[]{name, subType},							MetaDataException.DESIGN_EXCEPTION_UNSUPPORTED_SUB_TYPE );			}			ExtensionPropertyDefn extPropDefn = new ExtensionPropertyDefn(					( (PeerExtensionElementDefn) elementDefn )							.getReportItemFactory( ).getMessages( ) );			extPropDefn.setName( name );			extPropDefn.setDisplayNameID( displayNameID );			extPropDefn.setType( propType );			extPropDefn.setSubType( subPropType );			extPropDefn.setIntrinsic( false );			extPropDefn.setStyleProperty( false );			extPropDefn.setDefaultDisplayName( defaultDisplayName );			if ( !StringUtil.isBlank( canInherit ) )				extPropDefn.setCanInherit( Boolean.valueOf( canInherit )						.booleanValue( ) );			if ( !StringUtil.isBlank( isEncrypted ) )				extPropDefn.setIsEncryptable( Boolean.valueOf( isEncrypted )						.booleanValue( ) );			List choiceList = new ArrayList( );			IConfigurationElement[] elements = propTag.getChildren( );			for ( int k = 0; k < elements.length; k++ )			{				if ( CHOICE_TAG.equalsIgnoreCase( elements[k].getName( ) ) )				{					ExtensionChoice choiceDefn = new ExtensionChoice(							( (PeerExtensionElementDefn) elementDefn )									.getReportItemFactory( ).getMessages( ) );					loadChoice( elements[k], choiceDefn, extPropDefn );					choiceList.add( choiceDefn );				}			}			// can not define detail-type and own choice list synchronously			String detailType = propTag.getAttribute( DETAIL_TYPE_ATTRIB );			detailType = StringUtil.trimString( detailType );			if ( !StringUtil.isBlank( detailType ) && choiceList.size( ) > 0 )				throw new ExtensionException(						new String[]{detailType},						ExtensionException.DESIGN_EXCEPTION_INVALID_CHOICE_PROPERTY );			if ( choiceList.size( ) > 0 )			{				Choice[] choices = new Choice[choiceList.size( )];				choiceList.toArray( choices );				ChoiceSet choiceSet = new ChoiceSet( );				choiceSet.setChoices( choices );				extPropDefn.setDetails( choiceSet );			}			else if ( !StringUtil.isBlank( detailType ) )			{				extPropDefn.setDetails( dd.getChoiceSet( detailType ) );			}			// after loading the choices, then validates the default value			if ( !StringUtil.isBlank( defaultValue ) )			{				try				{					Object value = extPropDefn.validateXml( null, defaultValue );					extPropDefn.setDefault( value );				}				catch ( PropertyValueException e )				{					throw new ExtensionException(							new String[]{name, elementDefn.getName( )},							ExtensionException.DESIGN_EXCEPTION_INVALID_DEFAULT_VALUE );				}			}			return extPropDefn;		}