namespace OC\LanguageModel\Db;
use OCP\AppFramework\Db\Entity;
+use OCP\LanguageModel\AbstractLanguageModelTask;
use OCP\LanguageModel\ILanguageModelTask;
/**
]);
return $task;
}
+
+ public function toLanguageModelTask(): ILanguageModelTask {
+ $task = AbstractLanguageModelTask::factory($this->getType(), $this->getInput(), $this->getuserId(), $this->getAppId(), $this->getIdentifier());
+ $task->setId($this->getId());
+ $task->setStatus($this->getStatus());
+ $task->setOutput($this->getOutput());
+ return $task;
+ }
}
public function getTask(int $id): ILanguageModelTask {
try {
$taskEntity = $this->taskMapper->find($id);
- return AbstractLanguageModelTask::fromTaskEntity($taskEntity);
+ return $taskEntity->toLanguageModelTask();
} catch (DoesNotExistException $e) {
throw new NotFoundException('Could not find task with the provided id');
} catch (MultipleObjectsReturnedException $e) {
namespace OCP\LanguageModel;
-use OC\LanguageModel\Db\Task;
-
/**
* This is an abstract LanguageModel task that implements basic
* goodies for downstream tasks
];
}
-
- /**
- * @param Task $taskEntity
- * @return ILanguageModelTask
- * @since 28.0.0
- */
- final public static function fromTaskEntity(Task $taskEntity): ILanguageModelTask {
- $task = self::factory($taskEntity->getType(), $taskEntity->getInput(), $taskEntity->getuserId(), $taskEntity->getAppId(), $taskEntity->getIdentifier());
- $task->setId($taskEntity->getId());
- $task->setStatus($taskEntity->getStatus());
- $task->setOutput($taskEntity->getOutput());
- return $task;
- }
-
/**
* @param string $type
* @param string $input