Class QMenuItemRunProcess

java.lang.Object
com.kingsrook.qqq.backend.core.model.metadata.menus.items.QMenuItemBase
com.kingsrook.qqq.backend.core.model.metadata.menus.items.QMenuItemRunProcess
All Implemented Interfaces:
QMenuItemInterface, QMetaDataObject, Serializable, Cloneable

public class QMenuItemRunProcess extends QMenuItemBase
Menu item that triggers the execution of a QQQ process.

This menu item type is used to provide menu-driven access to processes defined in the QQQ application. When selected, it will execute the specified process.

The label and icon for this menu item can be automatically derived from the process's metadata if not explicitly set.

The process must be associated with the same table that contains this menu item.

See Also:
  • Constructor Details

    • QMenuItemRunProcess

      public QMenuItemRunProcess()
      Default constructor.
    • QMenuItemRunProcess

      public QMenuItemRunProcess(String processName)
      Constructor that initializes the run process item with a process name.
      Parameters:
      processName - the name of the process to execute
  • Method Details

    • getLabel

      public String getLabel()
      Returns the label for this menu item, automatically deriving it from the process's metadata if not explicitly set.

      If no label has been set on this menu item, this method attempts to retrieve the label from the process's metadata and sets it automatically.

      Specified by:
      getLabel in interface QMenuItemInterface
      Overrides:
      getLabel in class QMenuItemBase
      Returns:
      the label for this menu item
      See Also:
    • getIcon

      public QIcon getIcon()
      Returns the icon for this menu item, automatically deriving it from the process's metadata if not explicitly set.

      If no icon has been set on this menu item, this method attempts to retrieve the icon from the process's metadata and sets it automatically.

      Specified by:
      getIcon in interface QMenuItemInterface
      Overrides:
      getIcon in class QMenuItemBase
      Returns:
      the icon for this menu item, or null if none is available
      See Also:
    • getItemType

      public String getItemType()
      Returns the item type identifier for run process menu items.
      Returns:
      always returns "RUN_PROCESS"
    • getValues

      public Map<String,Serializable> getValues()
      Returns the values map containing the process name.
      Returns:
      a map containing the process name under the key "processName"
    • getProcessName

      public String getProcessName()
      Getter for processName
      See Also:
    • setProcessName

      public void setProcessName(String processName)
      Setter for processName
      See Also:
    • withProcessName

      public QMenuItemRunProcess withProcessName(String processName)
      Fluent setter for processName
      Parameters:
      processName - The name of the process to run. Required to be a valid process in the instance, and associated with the table in which this menu item is defined (via process.tableName).
      Returns:
      this
    • validate

      public void validate(QInstanceValidator validator, QInstance qInstance, QMetaDataObject parentObject)
      Validates that the run process menu item has a valid process name and that the process exists and is associated with the correct table.

      Ensures that:

      • A process name is specified
      • The process exists in the QQQ instance
      • The process is associated with the same table as the menu item (if parent is a QTableMetaData)
      Parameters:
      validator - the validator instance to use for reporting errors
      qInstance - the QQQ instance being validated
      parentObject - the parent metadata object containing this menu item
    • clone

      public QMenuItemRunProcess clone()
      Creates and returns a shallow copy of this run process menu item.
      Specified by:
      clone in interface QMenuItemInterface
      Overrides:
      clone in class QMenuItemBase
      Returns:
      a clone of this menu item