Package org.faktorips.runtime.internal
Class AbstractModelObject
java.lang.Object
org.faktorips.runtime.internal.AbstractModelObject
- All Implemented Interfaces:
IModelObject
- Direct Known Subclasses:
AbstractJaxbModelObject
Abstract base class for all policy component types.
-
Field Summary
Fields inherited from interface org.faktorips.runtime.IModelObject
CONTINUE_VALIDATION, STOP_VALIDATION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected AbstractModelObjectcreateChildFromXml(Element childEl) protected IUnresolvedReferencecreateUnresolvedReference(Object objectId, String targetRole, String targetId) protected voidinitAssociationFromXml(Element el, Object objectId, IObjectReferenceStore store) voidinitFromXml(Element objectEl, boolean initWithProductDefaultsBeforeReadingXmlData, IRuntimeRepository productRepository, IObjectReferenceStore store) Initializes the policy component's state with the data stored in the given xml element.voidinitFromXml(Element objectEl, boolean initWithProductDefaultsBeforeReadingXmlData, IRuntimeRepository productRepository, IObjectReferenceStore store, XmlCallback xmlCallback) Initializes the policy component's state with the data stored in the given xml element.protected voidinitFromXml(Element objectEl, boolean initWithProductDefaultsBeforeReadingXmlData, IRuntimeRepository productRepository, IObjectReferenceStore store, XmlCallback xmlCallback, String currPath) Initializes the policy component's state with the data stored in the given xml element.protected voidinitPropertiesFromXml(Map<String, String> propMap, IRuntimeRepository productRepository) voidRemoves the given child object from this object.validate(IValidationContext context) Validates the model object and returns a list of messages.voidvalidate(MessageList list, IValidationContext context) Validates the policy component and adds any messages generated to the given list.protected voidvalidateDependants(MessageList list, IValidationContext context) Validates the policy component's dependant components and adds any message generated to the given list.protected booleanvalidateSelf(MessageList list, IValidationContext context) Validates this policy component's state without validating the dependant components.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.faktorips.runtime.IModelObject
getDescription
-
Constructor Details
-
AbstractModelObject
public AbstractModelObject()
-
-
Method Details
-
removeChildModelObjectInternal
Removes the given child object from this object. If the given object is not a child of this model object or the given object isnull, the method does nothing.- Parameters:
child- The child you want to remove
-
validate
Description copied from interface:IModelObjectValidates the model object and returns a list of messages. If no message is generated the method returns an empty list. Note that also messages like warnings or informations can be returned for valid objects.- Specified by:
validatein interfaceIModelObject- Parameters:
context- provides additional external information that might be necessary to execute the validation. E.g. the business context, the locale to provide locale specific message texts, user information. The parameter must not benull.
-
validate
Validates the policy component and adds any messages generated to the given list. Calls validateSelf() and validateDependences().- Parameters:
context- provides additional external information that might be necessary to execute the validation. E.g. the business context, the locale to provide locale specific message texts, user information- Throws:
NullPointerException- if the list isnulland a message is generated. This method is model internal, it is not part of the published interface and should not be used by clients
-
validateDependants
Validates the policy component's dependant components and adds any message generated to the given list.The default implementation does nothing. Should be overridden in subclasses.
- Parameters:
list- The message listcontext- provides additional external information that might be necessary to execute the validation. E.g. the business context, the locale to provide locale specific message texts, user information- Throws:
NullPointerException- if list isnulland a message is generated.
-
validateSelf
Validates this policy component's state without validating the dependant components. Adds any message generated to the given list.The default implementation does nothing. Should be overridden in subclasses.
- Parameters:
list- the message listcontext- provides additional external information that might be necessary to execute the validation. E.g. the business context, the locale to provide locale specific message texts, user information- Returns:
trueif this model object should continue validating,falseelse.- Throws:
NullPointerException- if list isnulland a message is generated.
-
initFromXml
public void initFromXml(Element objectEl, boolean initWithProductDefaultsBeforeReadingXmlData, IRuntimeRepository productRepository, IObjectReferenceStore store) Initializes the policy component's state with the data stored in the given xml element.- Parameters:
objectEl- Xml element containing the state data.initWithProductDefaultsBeforeReadingXmlData-trueif the policy component should be initialized with the product defaults.productRepository- The repository that contains the product components.store- The store where unresolved references are stored in (so that they can be resolved after all objects have been initialized from xml).
-
initFromXml
public void initFromXml(Element objectEl, boolean initWithProductDefaultsBeforeReadingXmlData, IRuntimeRepository productRepository, IObjectReferenceStore store, XmlCallback xmlCallback) Initializes the policy component's state with the data stored in the given xml element.- Parameters:
objectEl- Xml element containing the state data.initWithProductDefaultsBeforeReadingXmlData-trueif the policy component should be initialized with the product defaults.productRepository- The repository that contains the product components.store- The store where unresolved references are stored in (so that they can be resolved after all objects have been initialized from xml).xmlCallback- An XML callback class which could handle enhanced xml initialization of the current element.
-
initFromXml
protected void initFromXml(Element objectEl, boolean initWithProductDefaultsBeforeReadingXmlData, IRuntimeRepository productRepository, IObjectReferenceStore store, XmlCallback xmlCallback, String currPath) Initializes the policy component's state with the data stored in the given xml element.- Parameters:
objectEl- Xml element containing the state data.initWithProductDefaultsBeforeReadingXmlData-trueif the policy component should be initialized with the product defaults.productRepository- The repository that contains the product components.store- The store where unresolved references are stored in (so that they can be resolved after all objects have been initialized from xml).xmlCallback- An XML callback class which could handle enhanced xml initialization of the current element.currPath- The path inside the XML tree structure. Starting from the root element.
-
initPropertiesFromXml
protected void initPropertiesFromXml(Map<String, String> propMap, IRuntimeRepository productRepository) - Parameters:
propMap- The property mapproductRepository- the runtime repository
-
createChildFromXml
- Parameters:
childEl- The child element
-
initAssociationFromXml
-
createUnresolvedReference
protected IUnresolvedReference createUnresolvedReference(Object objectId, String targetRole, String targetId) throws Exception - Parameters:
objectId- object idtargetRole- target roletargetId- target id- Throws:
Exception
-