*/
private BeanProxy getMetadataProxy() {
BeanProxy metadataProxy = null;
BeanProxy selectedVariant = context.getSelectedVariant();
if (selectedVariant != null) {
BaseProxy metadataBase = (BaseProxy) selectedVariant.getPropertyProxy(PolicyModel.META_DATA);
if (metadataBase != null) {
metadataProxy = (BeanProxy) metadataBase.getConcreteProxy();
// If we have no concrete metadata, create an empty one of the
// appropriate type unless the data is read only or the variant
// type precludes this.
Proxy typeProxy = selectedVariant.getPropertyProxy(PolicyModel.VARIANT_TYPE);
if (metadataProxy == null && !metadataBase.isReadOnly() &&
typeProxy.getModelObject() != VariantType.NULL) {
MetaDataBuilder metaDataBuilder = getDefaultMetaDataBuilder();
metadataBase.setModelObject(metaDataBuilder);
// Now that we've set a concrete model object, we should
// have a concrete proxy.
metadataProxy = (BeanProxy) metadataBase.getConcreteProxy();
}
}
}
return metadataProxy;
}