Class DateRestriction

All Implemented Interfaces:
Serializable, Comparable

public class DateRestriction extends GeneratedDateRestriction
This restriction restricts vouchers to start/end date.
See Also:
  • Constructor Details

    • DateRestriction

      public DateRestriction()
  • Method Details

    • createItem

      protected Item createItem(SessionContext ctx, ComposedType type, Item.ItemAttributeMap allAttributes) throws JaloBusinessException
      Description copied from class: Item
      Has to be implemented for each concrete subtype of item. This method is responsible for creating a new item instance ( by calling managers, ejb homes, etc. ) during ComposedType.newInstance(Map).

      In case this method uses any of the attribute values during creation it is required to override Item.getNonInitialAttributes(SessionContext, ItemAttributeMap) too.
      Sn example:

      
       public static final String MY_ATTRIBUTE = "someAttribute"; ... protected Item createItem(SessionContext
       ctx, ComposedType type, Map allAttributes ) throws JaloBusinessException { MyManager man = ... return
       man.createMyItem( (String)allAttributes.get(MY_ATTRIBUTE) );
       // here MY_ATTRIBUTE is used for creation, so it must not be set again } protected Map getNonInitialAttributes(
       SessionContext ctx, Map allAttributes ) { // let superclass remove its own initial attributes Map ret =
       super.getNonInitialAttributes( ctx, allAttributes );
       // remove MY_ATTRIBUTE from all attributes since if has already been set ret.remove(MY_ATTRIBUTE); return ret; }
      
       
      Overrides:
      createItem in class GeneratedRestriction
      Parameters:
      ctx - the current session context which this item is created within
      type - the actual item type ( since subtypes may not provide a own jalo class this may be different from the type which this method was implemented for )
      Returns:
      the new item instance
      Throws:
      JaloBusinessException - indicates an error during creation - any changes will be rollbacked
    • setStartDate

      public void setStartDate(Date value)
      Description copied from class: GeneratedDateRestriction
      Generated method - Setter of the DateRestriction.startDate attribute.
      Overrides:
      setStartDate in class GeneratedDateRestriction
      Parameters:
      value - the startDate - the date past which the given voucher is valid.
    • setEndDate

      public void setEndDate(Date value)
      Description copied from class: GeneratedDateRestriction
      Generated method - Setter of the DateRestriction.endDate attribute.
      Overrides:
      setEndDate in class GeneratedDateRestriction
      Parameters:
      value - the endDate - the date until the given voucher is valid.
    • validateStartEndDate

      protected void validateStartEndDate(Date startDate, Date endDate)
    • getMessageAttributeValues

      protected String[] getMessageAttributeValues()
      Description copied from class: Restriction
      Returns the values for making violation messages more useful.
      Overrides:
      getMessageAttributeValues in class Restriction
    • isFulfilledInternal

      protected boolean isFulfilledInternal(AbstractOrder anOrder)
      Returns true if the specified abstract order fulfills this restriction. More formally, returns true if the point of time when this check is executed is within the valid period specified by this restriction (start date, end date and positive).
      Specified by:
      isFulfilledInternal in class Restriction
      Parameters:
      anOrder - the abstract order to check whether it fullfills this restriction.
      Returns:
      true if the specified abstract order fulfills this restriction, false else.
      See Also:
    • isFulfilledInternal

      protected boolean isFulfilledInternal(Product aProduct)
      Returns true if the specified product fulfills this restriction.
      Specified by:
      isFulfilledInternal in class Restriction
      Parameters:
      aProduct - the product to check whether it fullfills this restriction.
      Returns:
      true if the specified product fulfills this restriction, false else.
      See Also: