Skip to content

Commit

Permalink
Merge pull request #13127 from kaltura/moderation-catalog-item
Browse files Browse the repository at this point in the history
Add moderation catalog item
  • Loading branch information
ImryAshu authored Feb 26, 2025
2 parents 8c7bf78 + d6d0f01 commit b8bbe08
Show file tree
Hide file tree
Showing 15 changed files with 178 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ protected static function getObjectByServiceFeature($serviceFeature)
VendorServiceFeature::QUIZ => new KalturaVendorQuizCatalogItem(),
VendorServiceFeature::SUMMARY => new KalturaVendorSummaryCatalogItem(),
VendorServiceFeature::VIDEO_ANALYSIS => new KalturaVendorVideoAnalysisCatalogItem(),
VendorServiceFeature::MODERATION => new KalturaVendorModerationCatalogItem(),
default => new KalturaVendorCaptionsCatalogItem(),
};
}
Expand Down
3 changes: 3 additions & 0 deletions plugins/reach/admin/CatalogItemConfigureAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ protected function handlePost($action, ConfigureForm $form, $catalogItemId = nul
case Kaltura_Client_Reach_Enum_VendorServiceFeature::VIDEO_ANALYSIS:
$catalogItem = $form->getObject('Kaltura_Client_Reach_Type_VendorVideoAnalysisCatalogItem', $formData, false, true);
break;
case Kaltura_Client_Reach_Enum_VendorServiceFeature::MODERATION:
$catalogItem = $form->getObject('Kaltura_Client_Reach_Type_VendorModerationCatalogItem', $formData, false, true);
break;
}

$form->resetUnUpdatebleAttributes($catalogItem);
Expand Down
2 changes: 2 additions & 0 deletions plugins/reach/admin/PartnerCatalogItemConfigureAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ protected function getCatalogItemFilter($serviceFeature)
return new Kaltura_Client_Reach_Type_VendorSummaryCatalogItemFilter();
case Kaltura_Client_Reach_Enum_VendorServiceFeature::VIDEO_ANALYSIS:
return new Kaltura_Client_Reach_Type_VendorVideoAnalysisCatalogItemFilter();
case Kaltura_Client_Reach_Enum_VendorServiceFeature::MODERATION:
return new Kaltura_Client_Reach_Type_VendorModerationCatalogItemFilter();
default:
return new Kaltura_Client_Reach_Type_VendorCatalogItemFilter();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class KExportEntryVendorTaskEngine extends KObjectExportEngine
12 => "QUIZ",
13 => "SUMMARY",
14 => "VIDEO_ANALYSIS",
15 => "MODERATION",
"N/A" => "N/A",
);

Expand Down
1 change: 1 addition & 0 deletions plugins/reach/config/lang/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
'Kaltura_Client_Reach_Enum_VendorServiceFeature::QUIZ' => 'QUIZ',
'Kaltura_Client_Reach_Enum_VendorServiceFeature::SUMMARY' => 'SUMMARY',
'Kaltura_Client_Reach_Enum_VendorServiceFeature::VIDEO_ANALYSIS' => 'VIDEO_ANALYSIS',
'Kaltura_Client_Reach_Enum_VendorServiceFeature::MODERATION' => 'MODERATION',

'Kaltura_Client_Reach_Enum_VendorServiceType::HUMAN' => 'HUMAN',
'Kaltura_Client_Reach_Enum_VendorServiceType::MACHINE' => 'MACHINE',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

/**
* @package plugins.reach
* @subpackage api.objects
* @relatedService EntryVendorTaskService
*/
class KalturaModerationVendorTaskData extends KalturaVendorTaskData
{
/**
* A comma seperated string of rule IDs.
*
* @var string
*/
public $ruleIds;

/**
* A comma seperated string of policy IDs.
*
* @var string
*/
public $policyIds;

/**
* JSON string containing the moderation output.
*
* @var string
*/
public $moderationOutputJson;


private static $map_between_objects = array
(
'ruleIds',
'policyIds',
'moderationOutputJson'
);

public function getMapBetweenObjects()
{
return array_merge(parent::getMapBetweenObjects(), self::$map_between_objects);
}

public function toObject($dbObject = null, $propsToSkip = array())
{
if (!$dbObject)
{
$dbObject = new kModerationVendorTaskData();
}

return parent::toObject($dbObject, $propsToSkip);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public static function getInstance($sourceObject, KalturaDetachedResponseProfile
case 'kSummaryVendorTaskData':
$taskData = new KalturaSummaryVendorTaskData();
break;

case 'kModerationVendorTaskData':
$taskData = new KalturaModerationVendorTaskData();
break;
}

if ($taskData)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ public static function getObjectByServiceFeature($serviceFeature)
return new KalturaVendorSummaryCatalogItem();
case VendorServiceFeature::VIDEO_ANALYSIS:
return new KalturaVendorVideoAnalysisCatalogItem();
case VendorServiceFeature::MODERATION:
return new KalturaVendorModerationCatalogItem();
default:
return new KalturaVendorCaptionsCatalogItem();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* @package plugins.reach
* @subpackage api.objects
*/
class KalturaVendorModerationCatalogItem extends KalturaVendorCatalogItem
{
protected function getServiceFeature(): int
{
return VendorServiceFeature::MODERATION;
}

public function toInsertableObject($object_to_fill = null, $props_to_skip = array())
{
if (is_null($object_to_fill))
{
$object_to_fill = new VendorModerationCatalogItem();
}

return parent::toInsertableObject($object_to_fill, $props_to_skip);
}

public function toObject($object_to_fill = null, $props_to_skip = array())
{
if(is_null($object_to_fill))
{
$object_to_fill = new VendorModerationCatalogItem();
}

return parent::toObject($object_to_fill, $props_to_skip);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

/**
* @package plugins.reach
* @subpackage api.filters
*/
class KalturaVendorModerationCatalogItemFilter extends KalturaVendorCatalogItemFilter
{
public function getTypeListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null, $type = null)
{
if (!$type)
{
$type = KalturaVendorServiceFeature::MODERATION;
}

return parent::getTypeListResponse($pager, $responseProfile, $type);
}
}
4 changes: 4 additions & 0 deletions plugins/reach/lib/model/VendorCatalogItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ public static function translateServiceFeatureEnum($catalogItemId)
$serviceFeatureName = 'video analysis';
break;

case VendorServiceFeature::MODERATION:
$serviceFeatureName = 'moderation';
break;

default:
$serviceFeatureName = '';
}
Expand Down
2 changes: 2 additions & 0 deletions plugins/reach/lib/model/VendorCatalogItemPeer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class VendorCatalogItemPeer extends BaseVendorCatalogItemPeer
const QUIZ_OM_CLASS = 'VendorQuizCatalogItem';
const SUMMARY_OM_CLASS = 'VendorSummaryCatalogItem';
const VIDEO_ANALYSIS_OM_CLASS = 'VendorVideoAnalysisCatalogItem';
const MODERATION_OM_CLASS = 'VendorModerationCatalogItem';

// cache classes by their type
protected static $class_types_cache = array(
Expand All @@ -46,6 +47,7 @@ class VendorCatalogItemPeer extends BaseVendorCatalogItemPeer
VendorServiceFeature::QUIZ => self::QUIZ_OM_CLASS,
VendorServiceFeature::SUMMARY => self::SUMMARY_OM_CLASS,
VendorServiceFeature::VIDEO_ANALYSIS => self::VIDEO_ANALYSIS_OM_CLASS,
VendorServiceFeature::MODERATION => self::MODERATION_OM_CLASS,
);

public static function setDefaultCriteriaFilter ()
Expand Down
12 changes: 12 additions & 0 deletions plugins/reach/lib/model/data/VendorModerationCatalogItem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
/**
* @package plugins.reach
* @subpackage model
*/
class VendorModerationCatalogItem extends VendorCatalogItem
{
public function applyDefaultValues(): void
{
$this->setServiceFeature(VendorServiceFeature::MODERATION);
}
}
42 changes: 42 additions & 0 deletions plugins/reach/lib/model/data/kModerationVendorTaskData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

/**
* @package plugins.reach
* @subpackage model
*/
class kModerationVendorTaskData extends kVendorTaskData
{
protected string $ruleIds = "";
protected string $policyIds = "";
protected string $moderationOutputJson = "";

public function getRuleIds(): string
{
return $this->ruleIds;
}

public function setRuleIds(string $ruleIds): void
{
$this->ruleIds = $ruleIds;
}

public function getPolicyIds(): string
{
return $this->policyIds;
}

public function setPolicyIds(string $policyIds): void
{
$this->policyIds = $policyIds;
}

public function getModerationOutputJson(): string
{
return $this->moderationOutputJson;
}

public function setModerationOutputJson(string $moderationOutputJson): void
{
$this->moderationOutputJson = $moderationOutputJson;
}
}
1 change: 1 addition & 0 deletions plugins/reach/lib/model/enums/VendorServiceFeature.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ interface VendorServiceFeature extends BaseEnum
const QUIZ = 12;
const SUMMARY = 13;
const VIDEO_ANALYSIS = 14;
const MODERATION = 15;
}

0 comments on commit b8bbe08

Please sign in to comment.