Class ProductComponentGeneration

java.lang.Object
org.faktorips.runtime.internal.RuntimeObject
org.faktorips.runtime.internal.ProductComponentGeneration
All Implemented Interfaces:
IClRepositoryObject, IXmlPersistenceSupport, IProductComponentGeneration, IProductComponentLinkSource, IProductObject, IRuntimeObject

public abstract class ProductComponentGeneration extends RuntimeObject implements IProductComponentGeneration, IXmlPersistenceSupport
Base class for product component generations

Deliberately implements IXmlPersistenceSupport directly. Letting IProductComponentGeneration extend IXmlPersistenceSupport would have published it, which is undesired.

  • Constructor Details

    • ProductComponentGeneration

      public ProductComponentGeneration(ProductComponent productCmpt)
  • Method Details

    • createPolicyComponent

      public IConfigurableModelObject createPolicyComponent()
      Description copied from interface: IProductObject
      Creates a new policy component that is configured by this product component generation. After creating the policy component it is automatically initialized. The new policy component is not added to any parent structure.
      Specified by:
      createPolicyComponent in interface IProductObject
    • getProductComponent

      public final IProductComponent getProductComponent()
      Description copied from interface: IProductComponentGeneration
      Returns the product component this generation belongs to. This method never returns null.
      Specified by:
      getProductComponent in interface IProductComponentGeneration
    • getPreviousGeneration

      public final IProductComponentGeneration getPreviousGeneration()
      Description copied from interface: IProductComponentGeneration
      Returns the previous generation if available if not null will be returned.
      Specified by:
      getPreviousGeneration in interface IProductComponentGeneration
    • getNextGeneration

      public final IProductComponentGeneration getNextGeneration()
      Description copied from interface: IProductComponentGeneration
      Returns the next generation if available if not null will be returned.
      Specified by:
      getNextGeneration in interface IProductComponentGeneration
    • getRepository

      public IRuntimeRepository getRepository()
      Description copied from interface: IProductComponentGeneration
      Returns the repository this product component generation belongs to. This method never returns null.
      Specified by:
      getRepository in interface IProductComponentGeneration
      Specified by:
      getRepository in interface IProductComponentLinkSource
      Returns:
      The IRuntimeRepository that was used to create this IProductComponentLinkSource
    • getValidFromInMillisec

      public final long getValidFromInMillisec(TimeZone zone)
    • getValidFrom

      public DateTime getValidFrom()
      Description copied from interface: IProductObject
      Returns the date from which this generation is valid.
      Specified by:
      getValidFrom in interface IProductObject
      Returns:
      The valid from date of this generation
    • getValidFrom

      public final Date getValidFrom(TimeZone zone)
      Description copied from interface: IProductObject
      Returns the point in time this generation is valid from in the given time zone. This method never returns null.
      Specified by:
      getValidFrom in interface IProductObject
    • setValidFrom

      public void setValidFrom(DateTime newValidFrom)
      Sets the new valid from date.

      Attention: Conceptually, the valid from date of the first generation must be equal to the valid from date of the product component itself. Therefore, if clients call this method on the first generation of a product component, to achieve data consistency, clients must set the valid from date of the product component, too.

      Throws:
      IllegalRepositoryModificationException - if the repository this generation belongs to does not allow to modify its contents
      See Also:
    • getFormulaEvaluator

      public IFormulaEvaluator getFormulaEvaluator()
    • initFromXml

      public void initFromXml(Element genElement)
      Initializes the generation with the data from the xml element.
      Specified by:
      initFromXml in interface IClRepositoryObject
      Throws:
      IllegalRepositoryModificationException - if the component has already been initialized and the repository prohibit changing its contents.
      NullPointerException - if genElement is null.
    • doInitPropertiesFromXml

      protected void doInitPropertiesFromXml(Map<String,Element> map)
      Initializes the properties with the data in the map.
      Parameters:
      map - the map of property elements
    • doInitReferencesFromXml

      protected void doInitReferencesFromXml(Map<String,List<Element>> map)
      Initializes the links with the data in the map.
      Parameters:
      map - the map of property elements
    • doInitTableUsagesFromXml

      protected void doInitTableUsagesFromXml(Map<String,Element> map)
      Initializes the table content usages with the data in the map. The map contains the table structure usage roles as key and the qualified table content name as value.
      Parameters:
      map - the map of property elements
    • doInitFormulaFromXml

      protected void doInitFormulaFromXml(Element genElement)
      Initializes all formulas contained by genElement. If formula evaluation is supported, the map contains the compiled expression for every formula.
    • isFormulaAvailable

      protected boolean isFormulaAvailable(String formularSignature)
      Returns true if the expression of the given formulaSignature not empty.
    • doInitValidationRuleConfigsFromXml

      protected void doInitValidationRuleConfigsFromXml(Element genElement)
      Creates a map containing the validation rule configurations found in the indicated generation's XML element. For each validation rule configuration the map contains an entry with the rule name as a key and an ValidationRuleConfiguration instance as value.
      Parameters:
      genElement - An XML element containing a product component generation's data.
      Throws:
      NullPointerException - if genElement is null.
    • getRangeElement

      protected Element getRangeElement(Element configElement)
    • getEnumNodeList

      protected NodeList getEnumNodeList(Element configElement)
    • addToCardinalityMap

      public static void addToCardinalityMap(Map<String,org.faktorips.valueset.IntegerRange> cardinalityMap, String targetId, Element relationElement)
      This method for implementations of the doInitReferencesFromXml method to read the cardinality bounds from an xml dom element. An IntegerRange object is created and added to the provided cardinalityMap.
    • setValidationRuleActivated

      public void setValidationRuleActivated(String ruleName, boolean active)
      Description copied from interface: IProductObject
      Enables or disables validation for a specific rule.
      Specified by:
      setValidationRuleActivated in interface IProductObject
      Parameters:
      ruleName - the name of the rule in question
      active - indicating whether the validation rule is configured as active
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setProductCmpt

      protected void setProductCmpt(ProductComponent productCmpt)
      Sets the product component this generation belongs to.
    • getLink

      public IProductComponentLink<? extends IProductComponent> getLink(String linkName, IProductComponent target)
      Description copied from interface: IProductComponentLinkSource
      Returns the IProductComponentLink for the association with the given role name to the given product component or null if no such association exists.
      Specified by:
      getLink in interface IProductComponentLinkSource
    • getLinks

      public List<IProductComponentLink<? extends IProductComponent>> getLinks()
      Description copied from interface: IProductComponentLinkSource
      Returns a List of all the IProductComponentLinks from this product component generation to other product components.
      Specified by:
      getLinks in interface IProductComponentLinkSource
    • isValidationRuleActivated

      public boolean isValidationRuleActivated(String ruleName)
      Description copied from interface: IProductObject
      Returns whether the validation rule with the given name is configured as active in this IProductObject. If there is no configuration for the given rule, false is returned.

      Please be aware that only one of IProductComponent or IProductComponentGeneration can configure any given rule depending on its changing-over-time configuration.

      Specified by:
      isValidationRuleActivated in interface IProductObject
      Parameters:
      ruleName - the name of the rule in question
      Returns:
      true if the rule was activated, false else.
    • toXml

      public Element toXml(Document document)
      Creates an XML Element that represents this product component generation's data.

      Throws an UnsupportedOperationException if the support for toXml ("Generate toXml Support") is not activated in the FIPS standard builder.

      Specified by:
      toXml in interface IXmlPersistenceSupport
      Parameters:
      document - a document, that can be used to create XML elements.
      Returns:
      an Element that represents this object as XML element
    • writeTableUsagesToXml

      protected void writeTableUsagesToXml(Element element)
      This is a utility method called by generated code. The given Element is the element representing this ProductComponentGeneration.
      Parameters:
      element - the element all table usages should be added to
    • writeTableUsageToXml

      protected void writeTableUsageToXml(Element element, String structureUsage, String tableContentName)
      This method is used for writing a table usage to the XML of the given Element.
      Parameters:
      element - the element where the table usage will be added to
      structureUsage - the value for the structureUsage XML attribute
      tableContentName - the name of the used table content
    • writeReferencesToXml

      protected void writeReferencesToXml(Element element)
      This is a utility method called by generated code. The given Element is the element representing this ProductComponentGeneration.
      Parameters:
      element - the element all table usages should be added to
    • writeFormulaToXml

      protected void writeFormulaToXml(Element element)
      This method is used for writing a formulas to the XML of the given Element.
    • writeValidationRuleConfigsToXml

      protected void writeValidationRuleConfigsToXml(Element genElement)
    • writePropertiesToXml

      protected void writePropertiesToXml(Element generationElement)
      Subclasses override this method to write their properties into the given XML element.

      The standard implementation throws an UnsupportedOperationException if the support for toXml ("Generate toXml Support") is not activated in the FIPS standard builder. Generated classes override but do NOT call super.

      Parameters:
      generationElement - the XML element to write the properties to