diff --git a/src/Entity.js b/src/Entity.js index 8ebdae9e7b54ec13b0ad5583d4645a1208663b2b..1a14797e4523b17b108aee8e24680d98e69ffa8c 100644 --- a/src/Entity.js +++ b/src/Entity.js @@ -53,6 +53,14 @@ export class Entity { return this.wrappedEntity.getDescription(); } + getFilePath() { + if (!this.isFile()) { + throw `Only FILE entities can have a file path.`; + } + const fileDescriptor = this.wrappedEntity.getFileDescriptor(); + return fileDescriptor.getPath(); + } + getId() { return this.wrappedEntity.getId(); } @@ -90,4 +98,8 @@ export class Entity { isRecord() { return this.wrappedEntity.getRole() === api.v1.EntityRole.ENTITY_ROLE_RECORD; } + + isFile() { + return this.wrappedEntity.getRole() === api.v1.EntityRole.ENTITY_ROLE_FILE; + } }