<?xml version="1.0" encoding="UTF-8"?>
<!--
- Licensed Materials - Property of IBM* and/or HCL**
- UrbanCode Deploy
- UrbanCode Build
- UrbanCode Release
- AnthillPro
- (c) Copyright IBM Corporation 2011, 2017. All Rights Reserved.
- (c) Copyright HCL Technologies Ltd. 2018. All Rights Reserved.
-
- U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by
- GSA ADP Schedule Contract with IBM Corp.
-
- * Trademark of International Business Machines
- ** Trademark of HCL Technologies Limited
-->
<plugin xmlns="http://www.urbancode.com/PluginXMLSchema_v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <header>
    <identifier id="com.urbancode.air.plugin.uDeployProcess" name="UrbanCode Deploy Processes" version="13"/>
    <description>
      Supports interaction with processes and process requests.
      </description>
    <tag>UrbanCode Deploy/Processes</tag>
  </header>
  <step-type name="Set Process Request Property">
    <description>Sets a property on a process request.</description>
    <properties>
      <property name="propertyName" required="true">
        <property-ui type="textBox"
                     label="Property Name"
                     description="The name of the property to set."/>
      </property>
      <property name="propertyValue">
        <property-ui type="textBox"
                     label="Property Value"
                     description="The value to set for the property. Leave blank to remove the property."/>
      </property>
      <property name="secureValue">
        <property-ui type="secureBox"
                     label="Secure Property Value"
                     description="A secure value to set for this property. If this value is set, the resulting property will be secure and the contents of the Property Value field will be ignored."/>
      </property>
      <property name="processRequestId" required="true">
        <property-ui type="textBox"
                     default-value="${p:request.id}"
                     label="Process Request ID"
                     description="The ID of the process request to update. This can be overridden to set a property on a parent or unrelated process request."/>
      </property>
    </properties>
    <post-processing><![CDATA[
        if (properties.get("exitCode") != 0) {
            properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
        }
        else {
            properties.put("Status", "Success");
        }
     ]]></post-processing>
    <command program="${GROOVY_HOME}/bin/groovy">
      <arg value="-cp" />
      <arg path="classes:lib/uDeployRestClient.jar:lib/securedata.jar:lib/jettison.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="setProcessRequestProperty.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
  <step-type name="Set Link on Process Request">
    <description>Creates or removes a link on a process request which can direct users to supplementary information related to the process execution.</description>
    <properties>
      <property name="linkTitle" required="true">
        <property-ui type="textBox"
                     label="Link Title"
                     description="The link text which the user can click on."/>
      </property>
      <property name="linkUrl">
        <property-ui type="textBox"
                     label="URL"
                     description="The URL to link to. If this is blank, the link will be removed."/>
      </property>
      <property name="processRequestId" required="true">
        <property-ui type="textBox"
                     default-value="${p:request.id}"
                     label="Process Request ID"
                     description="The ID of the process request to update. This can be overridden to set a property on a parent or unrelated process request."/>
      </property>
    </properties>
    <post-processing><![CDATA[
        if (properties.get("exitCode") != 0) {
            properties.put(new java.lang.String("Status"), new java.lang.String("Failure"));
        }
        else {
            properties.put("Status", "Success");
        }
     ]]></post-processing>
    <command program="${GROOVY_HOME}/bin/groovy">
      <arg value="-cp" />
      <arg path="classes:lib/uDeployRestClient.jar:lib/securedata.jar:lib/jettison.jar:lib/commons-codec.jar:lib/CommonsUtil.jar" />
      <arg file="setProcessRequestProperty.groovy"/>
      <arg file="${PLUGIN_INPUT_PROPS}"/>
      <arg file="${PLUGIN_OUTPUT_PROPS}"/>
    </command>
  </step-type>
</plugin>
