From 8682ebc3e306603d6eb416ea9fd144a76e4f2146 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 14 Sep 2007 09:34:00 +0000
Subject: [PATCH] Modify the aggregation definition property stylesheet to generate two server-side getter methods for each aggregation property. The first is a "default" getter of the form:
---
opendj-sdk/opends/resource/admin/property-types/aggregation.xsl | 124 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 124 insertions(+), 0 deletions(-)
diff --git a/opendj-sdk/opends/resource/admin/property-types/aggregation.xsl b/opendj-sdk/opends/resource/admin/property-types/aggregation.xsl
index 1c6402c..2927e6f 100644
--- a/opendj-sdk/opends/resource/admin/property-types/aggregation.xsl
+++ b/opendj-sdk/opends/resource/admin/property-types/aggregation.xsl
@@ -46,12 +46,21 @@
<xsl:value-of select="'.meta.'" />
<xsl:call-template name="get-definition-type" />
</xsl:element>
+ <xsl:if test="../../@multi-valued = 'true'">
+ <import>java.util.TreeSet</import>
+ </xsl:if>
<import>org.opends.server.admin.ManagedObjectPath</import>
<import>org.opends.server.admin.AggregationPropertyDefinition</import>
</xsl:template>
<xsl:template match="adm:aggregation" mode="java-value-type">
<xsl:value-of select="'String'" />
</xsl:template>
+ <xsl:template match="adm:aggregation" mode="java-value-imports">
+ <xsl:param name="interface" select="/.." />
+ <xsl:if test="$interface = 'server'">
+ <import>org.opends.server.types.DN</import>
+ </xsl:if>
+ </xsl:template>
<xsl:template match="adm:aggregation" mode="java-definition-type">
<xsl:value-of select="'AggregationPropertyDefinition'" />
</xsl:template>
@@ -110,6 +119,121 @@
<xsl:value-of select="');
'" />
</xsl:template>
<!--
+ Generate property getter declaration(s).
+ -->
+ <xsl:template match="adm:aggregation"
+ mode="java-property-getter-declaration">
+ <xsl:param name="interface" select="/.." />
+ <xsl:call-template
+ name="generate-default-property-getter-declaration">
+ <xsl:with-param name="interface" select="$interface" />
+ </xsl:call-template>
+ <xsl:if test="$interface='server'">
+ <xsl:variable name="name" select="../../@name" />
+ <xsl:variable name="java-property-name">
+ <xsl:call-template name="name-to-java">
+ <xsl:with-param name="value" select="$name" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="comment">
+ <xsl:if test="../../adm:synopsis">
+ <xsl:value-of select="'<p>
'" />
+ <xsl:value-of select="normalize-space(../../adm:synopsis)" />
+ <xsl:value-of select="'
'" />
+ </xsl:if>
+ <xsl:if test="../../adm:description">
+ <xsl:value-of select="'<p>
'" />
+ <xsl:value-of select="normalize-space(../../adm:description)" />
+ <xsl:value-of select="'
'" />
+ </xsl:if>
+ </xsl:variable>
+ <xsl:text>
</xsl:text>
+ <xsl:text>
</xsl:text>
+ <xsl:text>
</xsl:text>
+ <xsl:choose>
+ <xsl:when test="string(../../@multi-valued) != 'true'">
+ <xsl:call-template name="add-java-comment2">
+ <xsl:with-param name="indent" select="2" />
+ <xsl:with-param name="content"
+ select="concat(
+ 'Gets the "', $name,'" property as a DN.
',
+ $comment,
+ '
',
+ '@return Returns the DN value of the "', $name, '" property.
')" />
+ </xsl:call-template>
+ <xsl:value-of
+ select="concat(' DN get', $java-property-name, 'DN();
')" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="add-java-comment2">
+ <xsl:with-param name="indent" select="2" />
+ <xsl:with-param name="content"
+ select="concat(
+ 'Gets the "', $name,'" property as a set of DNs.
',
+ $comment,
+ '
',
+ '@return Returns the DN values of the "', $name, '" property.
')" />
+ </xsl:call-template>
+ <xsl:value-of
+ select="concat(' SortedSet<DN> get', $java-property-name, 'DNs();
')" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <!--
+ Generate property getter implementation(s).
+ -->
+ <xsl:template match="adm:aggregation"
+ mode="java-property-getter-implementation">
+ <xsl:param name="interface" select="/.." />
+ <xsl:call-template
+ name="generate-default-property-getter-implementation">
+ <xsl:with-param name="interface" select="$interface" />
+ </xsl:call-template>
+ <xsl:if test="$interface='server'">
+ <xsl:variable name="name" select="../../@name" />
+ <xsl:variable name="java-property-name">
+ <xsl:call-template name="name-to-java">
+ <xsl:with-param name="value" select="$name" />
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:text>
</xsl:text>
+ <xsl:text>
</xsl:text>
+ <xsl:text>
</xsl:text>
+ <xsl:call-template name="add-java-comment2">
+ <xsl:with-param name="indent" select="4" />
+ <xsl:with-param name="content" select="'{@inheritDoc}
'" />
+ </xsl:call-template>
+ <xsl:choose>
+ <xsl:when test="string(../../@multi-valued) != 'true'">
+ <xsl:value-of
+ select="concat(' public DN get', $java-property-name, 'DN() {
')" />
+ <xsl:value-of
+ select="concat(' String value = get', $java-property-name, '();
')" />
+ <xsl:value-of
+ select="concat(' return INSTANCE.get', $java-property-name, 'PropertyDefinition().getChildDN(value);
')" />
+ <xsl:value-of select="' }
'" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
+ select="concat(' public SortedSet<DN> get', $java-property-name, 'DNs() {
')" />
+ <xsl:value-of
+ select="concat(' SortedSet<String> values = get', $java-property-name, '();
')" />
+ <xsl:value-of
+ select="' SortedSet<DN> dnValues = new TreeSet<DN>();
'" />
+ <xsl:value-of
+ select="' for (String value : values) {
'" />
+ <xsl:value-of
+ select="concat(' DN dn = INSTANCE.get', $java-property-name, 'PropertyDefinition().getChildDN(value);
')" />
+ <xsl:value-of select="' dnValues.add(dn);
'" />
+ <xsl:value-of select="' }
'" />
+ <xsl:value-of select="' return dnValues;
'" />
+ <xsl:value-of select="' }
'" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:template>
+ <!--
Gets the Java client configuration interface for the referenced type.
-->
<xsl:template name="get-client-type">
--
Gitblit v1.10.0