CIM uses validator objects to check user input for formatting or other errors. Validators return either true or false, and allow you to conditionally display messages or perform navigation commands.

Validators can be used at two levels in a script:

For each validator, you need to specify:

Step validators can be described in terms of the point at which they perform their check; this information is required in the phase attribute of the validator tag. The phases are:

To use a validator in a step, add the snippet below as a child of a <step> element. Multiple validators can be added to a single step. They are processed in order depending on their phase attribute.

<step>

   other xml...

   <validators>
      <validator id="DemoFileExistsValidator" phase="PRESTEP" >
         <if-true>
            <command type="DISPLAY_TEXT" value="file exists at
${DemoFileExistsValidator.absPathToFile}"/>
            <command type="GOTO_STEP" value="ThirdStep" />
         </if-true>
         <if-false>
            <command type="DISPLAY_TEXT" value="file DOES NOT exist at
${DemoFileExistsValidator.absPathToFile}"/>
            <command type="GOTO_STEP" value="FirstStep" />
         </if-false>
      </validator>
   </validators>

... other xml...

</step>

To use a validator in a task, use the following XML:

<task id="CreateJBossAppServerInstanceTask"
  class="atg.cim.tasks.CreateJBossAppServerInstanceTask"
   <property name="serverInstanceName">
   <value>pub_commerce</value>

      <input type="text">
         <label>Enter a unique server instance name:</label>
         <validator id="NoWhiteSpaceValidator"
            phase="POSTINPUT">
            <if-false>
               <command type="DISPLAY_TEXT"
                  value="No white space allowed" />
               <command type="REDO_INPUT" />
            </if-false>
         </validator>
      </input>

etc.

For an example, see the Example CIM Plugin section of this chapter, or review the files located at <ATG10dir>/CIM/plugins/base in your Oracle ATG Web Commerce installation.


Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices