cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Making UIConfig a replace rather than a merge

Making UIConfig a replace rather than a merge

 

Introduction

Provided as reference only with neither warranty nor support - this hasn't gone through our internal QM yet either, so who knows if it'll cause horrible issues for folks:

 

Problem

As discussed on Issue with UIConfig merge, if you have a scenario that requires you to 'reorder' the columns in the UIConfig, the current SailPoint model of a 'merge' is a problem - this is purely additive and won't let you reorganize your UI elements.

 

Solution

This build script will be called during the regular SSB build process. It uses XSL to to modify init.xml and init-lcm.xml to remove any UIConfig entries that match the target UIConfig merge file you specify. That way,  your custom UIConfig merge will be the sole object import providing data for the configuration in question.

 

I'm also only targeting init-lcm and init.xml, as those are the input files where I care about UIConfig, though adding the others would be trivial.

 

Installation

Place the script to be placed under the in ServicesStandardBuild/scripts, named something such as 'build.custom.UIConfig-Modify.xml' . Update 'fileName' to refer to your UIConfig Merge file. It was mostly laziness doing it this way - you can just as easily use a file loop to interate through all UIConfig files in your custom folder instead.

It also requires the addition saxon-9.1.0.8.jar to ServicesStandardBuild/lib (XSL 2.0 is required for this operation)

 

Script

<?xml version="1.0" encoding="UTF-8"?>
<project name="services.standard.build.custom.uiconfig-modify.xml">

<!-- We need the DTD for XSLT -->
<target name="-generateDTD">
        <subant target="-generateDTD" inheritall="true" >
               <fileset dir="." includes="build.java.xml"/>
             </subant>
    </target>


<target name="ui-config-extend" description="Replaces UI config elements" depends="-generateDTD">
<!-- Files which have UI records we'd like to override -->
<for list="${build.iiqBinaryExtract}/WEB-INF/config/init-lcm.xml,${build.iiqBinaryExtract}/WEB-INF/config/init.xml" param="initFile">
<sequential>
<xslt
in="@{initFile}"
out="@{initFile}.tmp">
<!-- <factory name="net.sf.saxon.TransformerFactoryImpl"/>  -->
<style>
<string><![CDATA[
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="fileName" />
<xsl:param name="updates" select="document($fileName)" />

<xsl:output method="xml" indent="yes" doctype-public="sailpoint.dtd" doctype-system="sailpoint.dtd"
/>

<xsl:variable name="updateItems"
select="$updates/sailpoint/ImportAction/UIConfig/Attributes/Map/entry" />


<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>


<xsl:template
match="UIConfig/Attributes/Map/entry[@key=$updateItems/@key]">
</xsl:template>

</xsl:stylesheet>
]]></string>
</style>
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
<param name="fileName" expression="config/UIConfig/Merge_UI_Config_-_UIConfig.xml" />
            <xmlcatalog>
              <dtd publicId="sailpoint.dtd" location="${dtd}"/>
            </xmlcatalog>
            <classpath>
               <pathelement location="../lib/saxon-9.1.0.8.jar"/>
            </classpath>
          </xslt>
         <delete file="@{initFile}" />
     <move file="@{initFile}.tmp" tofile="@{initFile}"/>
<echo
message="Patched UIConfig in file: @{initFile}" />
</sequential>
</for>
</target>


<!-- The post expansion hook is called after war file is expanded to build/extract. -->
<target name="post.expansion.hook">
<echo
message="Applying UIConfig removals ${dtd}" />
<antcall inheritall="true" target="ui-config-extend" />
</target>

<target name="post.war.hook" />

<target name="clean" />

</project>

 

Labels (1)
Version history
Revision #:
2 of 2
Last update:
‎Jul 28, 2023 12:19 AM
Updated by: