* @package Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry * @internal * @since 3.0.0 */ class TransitionEntry extends ActivityEntry { // Overloaded constants public const BLOCK_CODE = 'ibo-transition-entry'; public const HTML_TEMPLATE_REL_PATH = 'layouts/activity-panel/activity-entry/transition-entry'; public const DEFAULT_TYPE = 'transition'; public const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-map-signs'; /** @var string $sOriginStateCode Code of the state before the transition */ protected $sOriginStateCode; /** @var string $sOriginStateLabel Label of the $sOriginStateCode state */ protected $sOriginStateLabel; /** @var string $sTargetStateCode Code of the state after the transition */ protected $sTargetStateCode; /** @var string $sTargetStateLabel Label of the $sTargetStateCode state */ protected $sTargetStateLabel; /** * TransitionEntry constructor. * * @param \DateTime $oDateTime * @param \User $sAuthorLogin * @param string $sObjectClass Class of the object which made the transition * @param string $sOriginStateCode * @param string $sTargetStateCode * @param string|null $sId * * @throws \CoreException * @throws \OQLException */ public function __construct( DateTime $oDateTime, string $sAuthorLogin, string $sObjectClass, string $sOriginStateCode, string $sTargetStateCode, ?string $sId = null ) { parent::__construct($oDateTime, $sAuthorLogin, null, $sId); $this->SetOriginalState($sObjectClass, $sOriginStateCode); $this->SetTargetState($sObjectClass, $sTargetStateCode); } /** * Set the code / label of the state before the transition * * @param string $sObjectClass Class of the object the state is from * @param string $sStateCode * * @return $this * @throws \CoreException */ public function SetOriginalState(string $sObjectClass, string $sStateCode) { $this->sOriginStateCode = $sStateCode; $this->sOriginStateLabel = MetaModel::GetStateLabel($sObjectClass, $sStateCode); return $this; } /** * Return the code of the state before the transition * * @return string */ public function GetOriginalStateCode() { return $this->sOriginStateCode; } /** * Return the label of the state before the transition * * @return string */ public function GetOriginalStateLabel() { return $this->sOriginStateLabel; } /** * Set the code / label of the state after the transition * * @param string $sObjectClass * @param string $sStateCode * * @return $this * @throws \CoreException */ public function SetTargetState(string $sObjectClass, string $sStateCode) { $this->sTargetStateCode = $sStateCode; $this->sTargetStateLabel = MetaModel::GetStateLabel($sObjectClass, $sStateCode); return $this; } /** * Return the code of the state after the transition * * @return string */ public function GetTargetStateCode() { return $this->sTargetStateCode; } /** * Return the label of the state after the transition * * @return string */ public function GetTargetStateLabel() { return $this->sTargetStateLabel; } }