Class MacroComponentModel

java.lang.Object
com.highdeal.pnr.hci.RateComponentModel
com.highdeal.pnr.hci.MacroComponentModel
All Implemented Interfaces:
XMLMarshallable, ContextualNode
Direct Known Subclasses:
InMacroComponentModel, PreMacroComponentModel

public abstract class MacroComponentModel extends RateComponentModel
This abstract class represents a rate component that runs a pricing macro. It defines the pricing macro name and input/output property mapping.
  • Field Details

  • Constructor Details

    • MacroComponentModel

      public MacroComponentModel()
      Constructs a macro component model.
  • Method Details

    • getMacro

      public PricingMacroModel getMacro()
      Returns the pricing macro for this macro component.
      Returns:
      the pricing macro for this macro component.
    • setMacro

      public void setMacro(PricingMacroModel r)
      Sets the pricing macro for this component. When a new macro is set, the previously set mapping is cleared.
      Parameters:
      r - the pricing macro for this component.
    • getMacroCode

      public String getMacroCode()
      Gets the code of the macro used in this component.
      Returns:
      the code of the macro used in this component.
    • setMacroCode

      public void setMacroCode(String c)
      Sets the code of the macro used in this component.
      Parameters:
      c - the code of the macro used in this component.
    • getAmountPropertyName

      public String getAmountPropertyName()
      Returns the name of the property in which the amount will be put. Note that this applies only when the component is a POST or IN type macro component.
      Returns:
      the amount property name.
    • setAmountPropertyName

      public void setAmountPropertyName(String name)
      Sets the amount property name for this component.
      Parameters:
      name - the name of the amount property.
    • getInMapping

      public Vector<String> getInMapping()
      Returns an ordered mapping for the macro.
      Returns:
      a vector of String that represent properties in the rating context.
    • getOutMapping

      public Vector<String> getOutMapping()
      Returns an ordered mapping for the macro.
      Returns:
      a vector of String that represent properties in the rating context.
    • checkValidity

      public boolean checkValidity()
      Returns true if the component is valid. Component is valid if all the following conditions are met:
      • The name is not null or empty.
      • The component has one and only one child.
      • The component has one embedded pricing macro.
      • All the in and out properties of the referenced pricing macro have a valid defined mapping.
      Specified by:
      checkValidity in class RateComponentModel
      Returns:
      true if the component is valid, false otherwise.
    • getPropertyReferences

      public List<com.highdeal.pnr.hci.PropertyReference> getPropertyReferences()
      Description copied from class: RateComponentModel
      Returns the list of the properties that are used in this component.
      Specified by:
      getPropertyReferences in class RateComponentModel
      Returns:
      the list of the properties that are used in this component
    • setAttributes

      public void setAttributes(XMLAttributes atts)
      Description copied from interface: XMLMarshallable
      Sets the attributes of the XML representation of the element being processed.
      Specified by:
      setAttributes in interface XMLMarshallable
      Overrides:
      setAttributes in class RateComponentModel
      Parameters:
      atts - The XML attributes of the current element
    • addChild

      public void addChild(String tagName, XMLMarshallable child)
      Description copied from interface: XMLMarshallable
      Adds a child to the object, the child representing the marshallable object which must be added to the element.
      Specified by:
      addChild in interface XMLMarshallable
      Overrides:
      addChild in class RateComponentModel
      Parameters:
      tagName - The name of tag for the child
      child - The child to be added