Main.SideBar (edit)
|
Main /
BatchUpdateOfBCBatch Update of Business Components I recently needed to add audit columns to a load of ADF business components. the biggest pain about this was having to set the Firstly I added the column attributes to the components by synchronising with the database, so the XML for each component had the column definition in it, AND I knew that the columns had exactly the same names in each component (because I added them to the database with a script). What I needed to so was copy the XML for each business component and transform the audit columns to add the <?xml version="1.0" encoding="windows-1252" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output doctype-system="jbo_03_01.dtd" version='1.0' encoding='windows-1252' /> <xsl:template match="*"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="@*|processing-instruction()|comment()"> <xsl:copy> <xsl:apply-templates select="node()"/> </xsl:copy> </xsl:template> <xsl:template match="Attribute[@Name='CreatedBy']"> <xsl:copy> <xsl:attribute name="IsUpdateable">while_insert</xsl:attribute> <xsl:attribute name="HistoryColumn">UserHistory</xsl:attribute> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="Attribute[@Name='CreatedAt']"> <xsl:copy> <xsl:attribute name="IsUpdateable">while_insert</xsl:attribute> <xsl:attribute name="HistoryColumn">DateHistory</xsl:attribute> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="Attribute[@Name='LastModifiedBy']"> <xsl:copy> <xsl:attribute name="HistoryColumn">UserHistory</xsl:attribute> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="Attribute[@Name='LastModifiedAt']"> <xsl:copy> <xsl:attribute name="HistoryColumn">DateHistory</xsl:attribute> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> The first template matches and copies all entities and the second matches and copies other things (attributes, processing instructions and comments), then there are templates to match the columns (confusingly Oracle have named these "Attribute" in the XML) that need the |