Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.campaign.model
Class ScenarioModel

    java.lang.Object
      com.bea.p13n.model.Model
          com.bea.p13n.model.XmlObjectModel
              com.bea.campaign.model.ScenarioModel

All Implemented Interfaces
  Serializable, Cloneable

    public class ScenarioModel

extends XmlObjectModel

A model representing a campaign scenario. This will have, as children, either a single `RuleSetLink` or `RuleModels` from the embedded rule-set. Adding a RuleModel as a child to a ScenarioModel with a RuleSetLink will remove the RuleSetLink and embed a rule-set. Adding a RuleSetLink as a child to a ScenarioModel with RuleModel children will remove the RuleModels.

See Also
  Serialized Form

Nested Class Summary
`class` | `ScenarioModel.RuleSetLink` An object representing a link to a rule model.

Nested classes/interfaces inherited from class com.bea.p13n.model.Model
`Model.ChangeEvent, Model.ChangeListener, Model.ChangeSupport, Model.Debug`

Field Summary
`static String` | `DOCUMENT_LINK_NS`

Fields inherited from class com.bea.p13n.model.XmlObjectModel
`copyRootXmlObject, instanceUri, isComplete`

Fields inherited from class com.bea.p13n.model.Model
`childrenModels, docModel, parentModel, roChildrenModels`

Constructor Summary
`ScenarioModel()` Default constructor.
`ScenarioModel(com.bea.campaign.schema.scenario.ScenarioDocument.Scenario scenario)` Constructor from a Scenario xml object.

Method Summary
`RuleModel` | `addCopyRuleModel(RuleModel rm)` Add a copy of the specified RuleModel to this scenario.
`void` | `addRuleModel(RuleModel model)` Add a Rule to the Scenario.
`protected boolean` | `childAdded(Model child)` Override to start listening to changes to child rule names.
`protected boolean` | `childRemoved(Model child)` Override to stop listening to changes to child rule names.
`void` | `clearCachedData()` Clear any cached data this model is holding onto, so that it will recomputed upon next access.
`Model` | `copy()` Create a copy of this scenario model.
`org.apache.xmlbeans.XmlObject` | `createNewXmlObject()` Create a new, empty scenario xml object.
`protected boolean` | `determineIsComplete()` Is this scenario complete? A scenario is complete if: It has a non-empty name All RuleModel children are complete All RuleModel children have unique names
`String` | `findUniqueRuleName(RuleModel model)` Find a unique rule name amongst our children RuleModels for the specified RuleModel (using its name as the basis).
`String` | `getDescription()` Returns the description of the Scenario.
`String` | `getId()` Gets the id of the Scenario.
`String` | `getLongDescription()` Returns the long description of the Scenario.
`String` | `getName()` Returns the name of the Scenario.
`ScenarioModel.RuleSetLink` | `getRuleSetLink()` Get our rule set link, if we have one.
`com.bea.campaign.schema.scenario.ScenarioDocument.Scenario` | `getScenario()` Get the Scenario rool xml object.
`String[]` | `getValidClassifications()` Get all the names of all the valid classifications for the Scenario.
`boolean` | `hasRuleSetLink()` Tell if this scenario is setup with a `ScenarioModel.RuleSetLink`, instead of an embeded ruleset and RuleModel children.
`void` | `initializeNew()` Initialize this a new, empty scenario.
`boolean` | `isActive()` Gets the Scenario's active attribute
`boolean` | `isValidClassificationsOrLogic()` Returns if the state of the operator for the valid-classification logic is a boolean "or".
`boolean` | `removeRuleModel(int index)` Remove the RuleModel at the specified index.
`boolean` | `removeRuleModel(RuleModel rule)` Remove the specified RuleModel child from this scenario.
`void` | `setActive(boolean active)`
`static void` | `setDataId(org.apache.xmlbeans.XmlObject o, String id)` Set the data:id attribute on XmlObject.
`void` | `setDescription(String newDesc)` Sets the description of the Scenario.
`void` | `setId(String newId)` Sets the two id's of the Scenario.
`protected void` | `setIsComplete(boolean isComplete)` Override to set on our `scenario` object also.
`void` | `setLongDescription(String newDesc)` Sets the description of the Scenario.
`void` | `setName(String newName)` Sets the name of the Scenario.
`void` | `setRuleSetLink(ScenarioModel.RuleSetLink link)` Set the RuleSetLink for this scenario.
`void` | `setValidClassifications(String... names)` Sets the list of all the names of all the valid classifications for the Scenario.
`void` | `setValidClassificationsOrLogic(boolean orLogic)` Sets the value of the operator for the valid-classification tag.
`void` | `setXmlObject(org.apache.xmlbeans.XmlObject object)` Set the root xml object for this scenario.

Methods inherited from class com.bea.p13n.model.XmlObjectModel
`checkElement, fixQName, getApplicationInstanceUri, getChild, getCopyXmlObject, getDocument, getLocalName, getParent, getQName, getRootXmlObject, isComplete, isNil, preRemove, propertyChanged, removeAllChildren, removeChild, setApplicationInstanceUri, setIsComplete, setParent, setRootXmlObject`

Methods inherited from class com.bea.p13n.model.Model
`addChangeListener, addChild, addChild, clone, doubleEquals, equals, getChildren, getDebug, getDebug, getDocument, getParent, longEquals, removeChangeListener, removeChild, removeChild, removeEmpties, setDocument`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DOCUMENT_LINK_NS

    public static final String DOCUMENT_LINK_NS

See Also
  Constants Summary

Constructor Detail

### ScenarioModel

    public ScenarioModel()

  Default constructor. Call either `setXmlObject(org.apache.xmlbeans.XmlObject)` or `initializeNew()` to enable this instance.

### ScenarioModel

    public ScenarioModel(com.bea.campaign.schema.scenario.ScenarioDocument.Scenario scenario)

  Constructor from a Scenario xml object.

Method Detail

### childAdded

    protected boolean childAdded(Model child)

  Override to start listening to changes to child rule names.

  Overrides:
    `childAdded` in class `XmlObjectModel`
  Parameters
    `child` - the child that was added.
  Returns
    true if we handled this changed, false if it was ignored.
  See Also
    `XmlObjectModel.setIsComplete(boolean)`

### childRemoved

    protected boolean childRemoved(Model child)

  Override to stop listening to changes to child rule names.

  Overrides:
    `childRemoved` in class `XmlObjectModel`
  Parameters
    `child` - the child that was removed.
  Returns
    true if we handled this changed, false if it was ignored.
  See Also
    `XmlObjectModel.setIsComplete(boolean)`

### setXmlObject

    public void setXmlObject(org.apache.xmlbeans.XmlObject object)
                      throws IllegalArgumentException

  Set the root xml object for this scenario.

  Parameters
    `object` - the xml object (should be a Scenario).
  Throws
    `IllegalArgumentException` - if object isn't valid.

### getScenario

    public com.bea.campaign.schema.scenario.ScenarioDocument.Scenario getScenario()

  Get the Scenario rool xml object. No changes done through this will get picked up by this model object.

### clearCachedData

    public void clearCachedData()

  Clear any cached data this model is holding onto, so that it will recomputed upon next access.

  Specified by:
    `clearCachedData` in class `XmlObjectModel`

### copy

    public Model copy()

  Create a copy of this scenario model.

  Specified by:
    `copy` in class `Model`

### createNewXmlObject

    public org.apache.xmlbeans.XmlObject createNewXmlObject()

  Create a new, empty scenario xml object.

### initializeNew

    public void initializeNew()

  Initialize this a new, empty scenario.

### getId

    public String getId()

  Gets the id of the Scenario.

### setId

    public void setId(String newId)

  Sets the two id's of the Scenario.

### getName

    public String getName()

  Returns the name of the Scenario. Assumes an XML-Schema valid document. Returns null on XPathAPI exceptions.

### setName

    public void setName(String newName)

  Sets the name of the Scenario. This always returns non-null.

### getDescription

    public String getDescription()

  Returns the description of the Scenario.

  Returns
    the description, or null if not set.

### setDescription

    public void setDescription(String newDesc)

  Sets the description of the Scenario.

### getLongDescription

    public String getLongDescription()

  Returns the long description of the Scenario.

  Returns
    the long description, or null if not set

### setLongDescription

    public void setLongDescription(String newDesc)

  Sets the description of the Scenario.

### isActive

    public boolean isActive()

  Gets the Scenario's active attribute

### setActive

    public void setActive(boolean active)

### isValidClassificationsOrLogic

    public boolean isValidClassificationsOrLogic()

  Returns if the state of the operator for the valid-classification logic is a boolean "or". If the state is "and", every classification must be present in order for the scenario to be active. If the state is "or", only one of the classifications need be present for the scenario to be active.

### setValidClassificationsOrLogic

    public void setValidClassificationsOrLogic(boolean orLogic)

  Sets the value of the operator for the valid-classification tag. String must be either "and" or "or"; returns without doing anything for any other strings. String argument can be ScenarioModel.AND or ScenarioModel.OR, for convenience.

### getValidClassifications

    public String[] getValidClassifications()

  Get all the names of all the valid classifications for the Scenario.

### setValidClassifications

    public void setValidClassifications(String... names)

  Sets the list of all the names of all the valid classifications for the Scenario.

### hasRuleSetLink

    public boolean hasRuleSetLink()

  Tell if this scenario is setup with a `ScenarioModel.RuleSetLink`, instead of an embeded ruleset and RuleModel children.

### getRuleSetLink

    public ScenarioModel.RuleSetLink getRuleSetLink()

  Get our rule set link, if we have one.

  Returns
    the RuleSetLink, or null if we don't have a RuleSetLink (either no children yet, or RuleModel children).
  See Also
    `hasRuleSetLink()`

### setRuleSetLink

    public void setRuleSetLink(ScenarioModel.RuleSetLink link)

  Set the RuleSetLink for this scenario.

  Parameters
    `the` - new RuleSetLink, or null to clear out the existing RuleSetLink.

### removeRuleModel

    public boolean removeRuleModel(RuleModel rule)

  Remove the specified RuleModel child from this scenario.

  Returns
    true if the RuleModel was removed, false if not

### removeRuleModel

    public boolean removeRuleModel(int index)

  Remove the RuleModel at the specified index.

  Returns
    true if the RuleModel was removed, false if not

### findUniqueRuleName

    public String findUniqueRuleName(RuleModel model)

  Find a unique rule name amongst our children RuleModels for the specified RuleModel (using its name as the basis).

  See Also
    `RuleSetModel.findUniqueRuleName(Model, RuleModel)`

### addRuleModel

    public void addRuleModel(RuleModel model)

  Add a Rule to the Scenario. This will changed the RuleModel's name to something that is unique amongst all of the other RuleModels in this scenario.
  If this Scenario has a `RuleSetLink`, it will be removed.

### addCopyRuleModel

    public RuleModel addCopyRuleModel(RuleModel rm)

  Add a copy of the specified RuleModel to this scenario.

  Returns
    the RuleModel actually added.
  See Also
    `addRuleModel(com.bea.p13n.rules.model.RuleModel)`

### setIsComplete

    protected void setIsComplete(boolean isComplete)

  Override to set on our `scenario` object also.

  Overrides:
    `setIsComplete` in class `XmlObjectModel`

### determineIsComplete

    protected boolean determineIsComplete()

  Is this scenario complete? A scenario is complete if:
  1. It has a non-empty name
  2. All RuleModel children are complete
  3. All RuleModel children have unique names

  Overrides:
    `determineIsComplete` in class `XmlObjectModel`

### setDataId

    public static void setDataId(org.apache.xmlbeans.XmlObject o,
                                 String id)

  Set the data:id attribute on XmlObject.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.