From 2de738aa8477211d74faeb8620da64054e085914 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 20 Jul 2007 08:43:07 +0000
Subject: [PATCH] Fix issues 1966 and 1792.
---
opendj-sdk/opends/resource/admin/metaMO.xsl | 86 ++++++++++++++++++++++--------------------
1 files changed, 45 insertions(+), 41 deletions(-)
diff --git a/opendj-sdk/opends/resource/admin/metaMO.xsl b/opendj-sdk/opends/resource/admin/metaMO.xsl
index 638fd55..6c4cb38 100644
--- a/opendj-sdk/opends/resource/admin/metaMO.xsl
+++ b/opendj-sdk/opends/resource/admin/metaMO.xsl
@@ -793,57 +793,57 @@
<xsl:with-param name="value" select="@managed-object-name" />
</xsl:call-template>
</xsl:variable>
+ <xsl:variable name="java-relation-builder-type">
+ <xsl:choose>
+ <xsl:when test="adm:one-to-one">
+ <xsl:text>SingletonRelationDefinition</xsl:text>
+ </xsl:when>
+ <xsl:when test="adm:one-to-zero-or-one">
+ <xsl:text>OptionalRelationDefinition</xsl:text>
+ </xsl:when>
+ <xsl:when test="adm:one-to-many">
+ <xsl:text>InstantiableRelationDefinition</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="yes">
+ <xsl:value-of
+ select="concat('Unknown relation type "', local-name(*), '" in relation "', @name, '".')" />
+ </xsl:message>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:value-of
+ select="concat('.Builder<', $java-managed-object-name, 'CfgClient, ', $java-managed-object-name, 'Cfg>')" />
+ </xsl:variable>
<xsl:value-of
select="concat(' // Build the "', $relation-name, '" relation definition.
',
' static {
',
- ' RD_', $java-relation-name, ' = new ')" />
- <xsl:choose>
- <xsl:when test="adm:one-to-one">
- <xsl:text>SingletonRelationDefinition<</xsl:text>
- </xsl:when>
- <xsl:when test="adm:one-to-zero-or-one">
- <xsl:text>OptionalRelationDefinition<</xsl:text>
- </xsl:when>
- <xsl:when test="adm:one-to-many">
- <xsl:text>InstantiableRelationDefinition<</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message terminate="yes">
- <xsl:value-of
- select="concat('Unknown relation type "', local-name(*), '" in relation "', @name, '".')" />
- </xsl:message>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:value-of
- select="concat($java-managed-object-name, 'CfgClient, ', $java-managed-object-name, 'Cfg>(
',
- ' INSTANCE, "', @name, '", ')" />
+ ' ', $java-relation-builder-type, ' builder =
',
+ ' new ', $java-relation-builder-type, '(INSTANCE, "', @name, '", ')" />
<xsl:if test="adm:one-to-many">
<xsl:value-of
select="concat('"', adm:one-to-many/@plural-name, '", ')" />
</xsl:if>
<xsl:value-of
- select="concat($java-managed-object-name, 'CfgDefn.getInstance()')" />
- <xsl:if test="adm:one-to-many">
- <xsl:value-of select="', '" />
- <xsl:choose>
- <xsl:when test="adm:one-to-many/@naming-property">
- <xsl:variable name="java-property-name">
- <xsl:call-template name="name-to-java">
- <xsl:with-param name="value"
- select="adm:one-to-many/@naming-property" />
- </xsl:call-template>
- </xsl:variable>
- <xsl:value-of
- select="concat($java-managed-object-name,
+ select="concat($java-managed-object-name, 'CfgDefn.getInstance());
')" />
+ <xsl:if test="adm:one-to-many/@naming-property">
+ <xsl:variable name="java-property-name">
+ <xsl:call-template name="name-to-java">
+ <xsl:with-param name="value"
+ select="adm:one-to-many/@naming-property" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of
+ select="concat(' builder.setNamingProperty(',
+ $java-managed-object-name,
'CfgDefn.getInstance().get',
- $java-property-name, 'PropertyDefinition()')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="'null'" />
- </xsl:otherwise>
- </xsl:choose>
+ $java-property-name, 'PropertyDefinition());
')" />
</xsl:if>
- <xsl:value-of select="');
'" />
+ <xsl:if test="@hidden='true'">
+ <xsl:value-of
+ select="' builder.setOption(RelationOption.HIDDEN);
'" />
+ </xsl:if>
+ <xsl:value-of
+ select="concat(' RD_', $java-relation-name, ' = builder.getInstance();
')" />
<xsl:value-of
select="concat(' INSTANCE.registerRelationDefinition(RD_', $java-relation-name,');
')" />
<xsl:value-of select="' }
'" />
@@ -1742,6 +1742,10 @@
select="concat(@managed-object-package, '.server.', $java-class-name, 'Cfg')" />
</xsl:element>
</xsl:for-each>
+ <xsl:if
+ test="$this-local-relations[@hidden='true']">
+ <import>org.opends.server.admin.RelationOption</import>
+ </xsl:if>
<xsl:if test="$this-all-relations/adm:one-to-many">
<import>
org.opends.server.admin.InstantiableRelationDefinition
--
Gitblit v1.10.0