Class MRecentItem

All Implemented Interfaces:
Serializable, Cloneable, Comparator<Object>, I_AD_RecentItem, I_Persistent, Evaluatee, ImmutablePOSupport

public class MRecentItem extends X_AD_RecentItem implements ImmutablePOSupport
Recent Item model
Author:
Carlos Ruiz - GlobalQSS
See Also:
  • Field Details

  • Constructor Details

    • MRecentItem

      public MRecentItem(Properties ctx, String AD_RecentItem_UU, String trxName)
      UUID based Constructor
      Parameters:
      ctx - Context
      AD_RecentItem_UU - UUID key
      trxName - Transaction
    • MRecentItem

      public MRecentItem(Properties ctx, int AD_RecentItem_ID, String trxName)
      Standard Constructor
      Parameters:
      ctx - context
      AD_RecentItem_ID - id
      trxName - transaction
    • MRecentItem

      public MRecentItem(Properties ctx, ResultSet rs, String trxName)
      Load Constructor
      Parameters:
      ctx - ctx
      rs - result set
      trxName - transaction
    • MRecentItem

      public MRecentItem(MRecentItem copy)
      Copy constructor
      Parameters:
      copy -
    • MRecentItem

      public MRecentItem(Properties ctx, MRecentItem copy)
      Copy constructor
      Parameters:
      ctx -
      copy -
    • MRecentItem

      public MRecentItem(Properties ctx, MRecentItem copy, String trxName)
      Copy constructor
      Parameters:
      ctx -
      copy -
      trxName -
  • Method Details

    • get

      public static MRecentItem get(Properties ctx, int AD_RecentItem_ID)
      Get from Cache using ID (immutable)
      Parameters:
      ctx - context
      AD_RecentItem_ID - id
      Returns:
      recent item
    • getCopy

      public static MRecentItem getCopy(Properties ctx, int AD_RecentItem_ID, String trxName)
      Get updateable copy of MRecentItem from cache
      Parameters:
      ctx -
      AD_RecentItem_ID -
      trxName -
      Returns:
      MRecentItem
    • get

      public static MRecentItem get(Properties ctx, int AD_Table_ID, int Record_ID, String Record_UU, int AD_User_ID)
      Get Recent Item from Cache using table+recordID (immutable)
      Parameters:
      ctx - context
      AD_Table_ID - tableID
      Record_ID - record ID
      Record_UU - record UUID
      Returns:
      recent item
    • addModifiedField

      public static void addModifiedField(Properties ctx, int AD_Table_ID, int Record_ID, String Record_UU, int AD_User_ID, int AD_Role_ID, int AD_Window_ID, int AD_Tab_ID)
      addModifiedField / method to be called when a field is modified on a window.
      It adds a record in recent item, or touches the record if it was added before.
      Parameters:
      ctx -
      AD_Table_ID -
      Record_ID -
      Record_UU -
      AD_User_ID -
      AD_Role_ID -
      AD_Window_ID -
      AD_Tab_ID -
    • publishChangedEvent

      public static void publishChangedEvent(int AD_User_ID)
      Publish ON_RECENT_ITEM_CHANGED_TOPIC message to message service.
      If message service is not available, fall back to postOnChangedEvent(int).
      Parameters:
      AD_User_ID -
    • postOnChangedEvent

      public static void postOnChangedEvent(int AD_User_ID)
      Parameters:
      AD_User_ID -
    • touchUpdatedRecord

      public static void touchUpdatedRecord(Properties ctx, int AD_Table_ID, int Record_ID, String Record_UU, int AD_User_ID)
      touchUpdatedRecord / method to be called when a record is saved or updated in database.
      It touches the record added before.
      Also delete recent items beyond the number of records allowed per user.
      Parameters:
      ctx -
      AD_Table_ID -
      Record_UU -
      AD_User_ID -
    • getFromUser

      public static List<MRecentItem> getFromUser(Properties ctx, int AD_User_ID)
      Get the recent items from user - for performance obtain the ids and then get the MRecentItem from cache
      Parameters:
      ctx -
      AD_User_ID -
      Returns:
      list of recent item record
    • getLabel

      public String getLabel()
      Build label for this item from window name and title logic. Fall back to record identifier if title logic is not available.
      Returns:
      label
    • clearLabel

      public static void clearLabel(int AD_Table_ID, int Record_ID, String Record_UU)
      Clear the label (to display) cache in a recent item instance.
      Parameters:
      AD_Table_ID -
      Record_ID -
      Record_UU -
    • markImmutable

      public MRecentItem markImmutable()
      Description copied from interface: ImmutablePOSupport
      mark PO as immutable
      Specified by:
      markImmutable in interface ImmutablePOSupport
      Returns:
      PO
    • toString

      public String toString()
      Description copied from class: PO
      String representation
      Overrides:
      toString in class X_AD_RecentItem
      Returns:
      String representation