Class DefaultValueTrigger

java.lang.Object
com.orchestranetworks.schema.trigger.TableTrigger
com.apgar.common.lib.trigger.DefaultValueTrigger

public class DefaultValueTrigger extends TableTrigger
Table trigger to fill a String field (path as a parameter) with a default value (as a parameter).

The trigger is defined as follows for the table it is applied on in the XSD of its dataset.

 <xs:complexType name="SampleTable_Type">
     <xs:annotation>
         <xs:documentation xml:lang="en-US">
             <osd:label>Sample Table</osd:label>
         </xs:documentation>
         <xs:appinfo>
             <osd:table>...</osd:table>
             <osd:trigger class="com.apgar.common.lib.trigger.DefaultValueTrigger">
                 <defaultValue>value</defaultValue>
                 <pathToField>./pathToField</pathToField>
             </osd:trigger>
         </xs:appinfo>
     </xs:annotation>
 </xs:complexType>
 
Author:
APGAR Consulting
  • Constructor Details

    • DefaultValueTrigger

      public DefaultValueTrigger()
  • Method Details

    • handleNewContext

      public void handleNewContext(NewTransientOccurrenceContext context)
      Overrides:
      handleNewContext in class TableTrigger
    • handleBeforeCreate

      public void handleBeforeCreate(BeforeCreateOccurrenceContext context) throws OperationException
      Overrides:
      handleBeforeCreate in class TableTrigger
      Throws:
      OperationException
    • setup

      public void setup(TriggerSetupContext context)
      Performs type check
      Specified by:
      setup in class TableTrigger
    • getDefaultValue

      public String getDefaultValue()
      Returns the string value to be set to the field
      Returns:
      the string value to be set to the field
    • setDefaultValue

      public void setDefaultValue(String defaultValue)
      Sets the default string value which the field the trigger is applied on will be set to
      Parameters:
      defaultValue - String value to be set
    • getPathToField

      public String getPathToField()
      Returns the path of the field to be set as a string
      Returns:
      the formatted String path of the field set by the trigger
    • setPathToField

      public void setPathToField(String pathToField)
      Sets the path of the field
      Parameters:
      pathToField - path of the field to be set