|
1559 | 1559 | </xsl:variable> |
1560 | 1560 | <xsl:variable name="required"> |
1561 | 1561 | <xsl:if test="$suffix='-create'"> |
1562 | | - <!-- non-computed key properties are required, as are properties marked with Common.FieldControl=Mandatory --> |
1563 | | - <xsl:for-each select="$structuredType/edm:Property[ |
1564 | | - (@Name=../edm:Key/edm:PropertyRef/@Name and not(@Name=$read-only or @Name=$computed or concat($qualifiedName,'/',@Name) = $computed-ext or concat($aliasQualifiedName,'/',@Name) = $computed-ext)) |
1565 | | - or concat($qualifiedName,'/',@Name)=$mandatory or concat($aliasQualifiedName,'/',@Name)=$mandatory]"> |
| 1562 | + <!-- gather the RTFs for insert restrictions --> |
| 1563 | + <xsl:variable name="insert-restrictions"> |
| 1564 | + <xsl:apply-templates select="$structuredType" mode="capabilities"> |
| 1565 | + <xsl:with-param name="term" select="'InsertRestrictions'" /> |
| 1566 | + </xsl:apply-templates> |
| 1567 | + </xsl:variable> |
| 1568 | + |
| 1569 | + <!--non-computed key properties are required, as are properties marked with Common.FieldControl=Mandatory |
| 1570 | + and Capabilities.InsertRestrictions/ RequiredProperties --> |
| 1571 | + |
| 1572 | + <xsl:for-each |
| 1573 | + select=" |
| 1574 | + $structuredType/edm:Property[ |
| 1575 | + ( |
| 1576 | + @Name = ../edm:Key/edm:PropertyRef/@Name |
| 1577 | + and not( |
| 1578 | + @Name = $read-only |
| 1579 | + or @Name = $computed |
| 1580 | + or concat($qualifiedName, '/', @Name) = $computed-ext |
| 1581 | + or concat($aliasQualifiedName, '/', @Name) = $computed-ext |
| 1582 | + ) |
| 1583 | + ) |
| 1584 | + or concat($qualifiedName, '/', @Name) = $mandatory |
| 1585 | + or concat($aliasQualifiedName, '/', @Name) = $mandatory |
| 1586 | + or @Name = ( |
| 1587 | + //edm:Annotation |
| 1588 | + [ contains($insert-restrictions, concat(' ', generate-id(), ' ')) ] |
| 1589 | + /edm:Record |
| 1590 | + /edm:PropertyValue[@Property = 'RequiredProperties'] |
| 1591 | + /edm:Collection |
| 1592 | + /edm:PropertyPath |
| 1593 | + ) |
| 1594 | +
|
| 1595 | + ]"> |
| 1596 | + <xsl:if test="position()>1"> |
| 1597 | + <xsl:text>,</xsl:text> |
| 1598 | + </xsl:if> |
| 1599 | + <xsl:text>"</xsl:text> |
| 1600 | + <xsl:value-of |
| 1601 | + select="@Name" /> |
| 1602 | + <xsl:text>"</xsl:text> |
| 1603 | + </xsl:for-each> |
| 1604 | + </xsl:if> |
| 1605 | + |
| 1606 | + |
| 1607 | + <xsl:if test="$suffix = '-update'"> |
| 1608 | + <!-- gather the RTFs for update restrictions --> |
| 1609 | + <xsl:variable name="update-restrictions"> |
| 1610 | + <xsl:apply-templates select="$structuredType" mode="capabilities"> |
| 1611 | + <xsl:with-param name="term" select="'UpdateRestrictions'" /> |
| 1612 | + </xsl:apply-templates> |
| 1613 | + </xsl:variable> |
| 1614 | + <!-- Capabilities.UpdateRestrictions/ RequiredProperties --> |
| 1615 | + <xsl:for-each |
| 1616 | + select=" |
| 1617 | + $structuredType/edm:Property[ |
| 1618 | + @Name = ( |
| 1619 | + //edm:Annotation |
| 1620 | + [ contains($update-restrictions, concat(' ', generate-id(), ' ')) ] |
| 1621 | + /edm:Record |
| 1622 | + /edm:PropertyValue[@Property = 'RequiredProperties'] |
| 1623 | + /edm:Collection |
| 1624 | + /edm:PropertyPath |
| 1625 | + ) |
| 1626 | + ] |
| 1627 | + "> |
1566 | 1628 | <xsl:if test="position()>1"> |
1567 | 1629 | <xsl:text>,</xsl:text> |
1568 | 1630 | </xsl:if> |
1569 | 1631 | <xsl:text>"</xsl:text> |
1570 | | - <xsl:value-of select="@Name" /> |
| 1632 | + <xsl:value-of |
| 1633 | + select="@Name" /> |
1571 | 1634 | <xsl:text>"</xsl:text> |
1572 | 1635 | </xsl:for-each> |
1573 | 1636 | </xsl:if> |
|
2737 | 2800 | </xsl:otherwise> |
2738 | 2801 | </xsl:choose> |
2739 | 2802 | </xsl:template> |
2740 | | - |
| 2803 | + <xsl:template match="edm:EntityType" mode="capabilities"> |
| 2804 | + <xsl:param name="term" /> |
| 2805 | + <xsl:for-each select="//edm:EntitySet[ |
| 2806 | + @EntityType=concat(current()/../@Namespace,'.',current()/@Name) or |
| 2807 | + @EntityType=concat(current()/../@Alias,'.',current()/@Name)]"> |
| 2808 | + <xsl:variable name="target-path" select="concat(../../@Namespace,'.',../@Name,'/',@Name)" /> |
| 2809 | + <xsl:variable name="target-path-aliased" select="concat(../../@Alias,'.',../@Name,'/',@Name)" /> |
| 2810 | + <xsl:variable name="annos" select="key('externalAnnotations',$target-path)|key('externalAnnotations',$target-path-aliased)|." /> |
| 2811 | + <xsl:for-each select="$annos/edm:Annotation[not(@Qualifier) and |
| 2812 | + @Term=concat($capabilitiesNamespace,'.',$term) or |
| 2813 | + @Term=concat($capabilitiesAlias,'.',$term)]"> |
| 2814 | + <xsl:text> </xsl:text> |
| 2815 | + <xsl:value-of select="generate-id()" /> |
| 2816 | + <xsl:text> </xsl:text> |
| 2817 | + </xsl:for-each> |
| 2818 | + </xsl:for-each> |
| 2819 | + </xsl:template> |
2741 | 2820 | <xsl:template match="edm:EntitySet"> |
2742 | 2821 | <xsl:variable name="target-path" select="concat(../../@Namespace,'.',../@Name,'/',@Name)" /> |
2743 | 2822 | <xsl:variable name="target-path-aliased" select="concat(../../@Alias,'.',../@Name,'/',@Name)" /> |
|
0 commit comments