Skip to content

Commit f8394e3

Browse files
committed
flow file entity to provide the internal URL
Signed-off-by: Arthur Schiwon <[email protected]>
1 parent 6426067 commit f8394e3

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

apps/workflowengine/lib/Entity/File.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
use OCP\EventDispatcher\Event;
2828
use OCP\EventDispatcher\GenericEvent;
29+
use OCP\Files\InvalidPathException;
2930
use OCP\Files\IRootFolder;
3031
use OCP\Files\Node;
3132
use OCP\Files\NotFoundException;
@@ -38,11 +39,12 @@
3839
use OCP\SystemTag\ISystemTagManager;
3940
use OCP\SystemTag\MapperEvent;
4041
use OCP\WorkflowEngine\EntityContext\IDisplayText;
42+
use OCP\WorkflowEngine\EntityContext\IUrl;
4143
use OCP\WorkflowEngine\GenericEntityEvent;
4244
use OCP\WorkflowEngine\IEntity;
4345
use OCP\WorkflowEngine\IRuleMatcher;
4446

45-
class File implements IEntity, IDisplayText {
47+
class File implements IEntity, IDisplayText, IUrl {
4648

4749
private const EVENT_NAMESPACE = '\OCP\Files::';
4850

@@ -208,4 +210,14 @@ public function getDisplayText(int $verbosity = 0): string {
208210
return $this->l10n->t('%s assigned %s to %s', $options);
209211
}
210212
}
213+
214+
public function getUrl(): string {
215+
try {
216+
return $this->urlGenerator->linkToRouteAbsolute('files.viewcontroller.showFile', ['fileid' => $this->getNode()->getId()]);
217+
} catch (InvalidPathException $e) {
218+
return '';
219+
} catch (NotFoundException $e) {
220+
return '';
221+
}
222+
}
211223
}

0 commit comments

Comments
 (0)