Skip to content

Commit

Permalink
avniproject/avni-client#1420 - safe display or details of media queue…
Browse files Browse the repository at this point in the history
… item
  • Loading branch information
petmongrels committed Jun 11, 2024
1 parent ae7382e commit 65a6e48
Showing 1 changed file with 108 additions and 89 deletions.
197 changes: 108 additions & 89 deletions src/MediaQueue.js
Original file line number Diff line number Diff line change
@@ -1,96 +1,115 @@
import General from "./utility/General";
import BaseEntity from "./BaseEntity";
import _ from "lodash";

class MediaQueue extends BaseEntity {
static schema = {
name: "MediaQueue",
primaryKey: "uuid",
properties: {
uuid: "string",
entityUUID: "string",
entityName: "string",
entityTargetField: "string",
fileName: "string",
type: "string",
conceptUUID: {type: "string", optional: true},
},
};

constructor(that = null) {
super(that);
}

get entityUUID() {
return this.that.entityUUID;
}

set entityUUID(x) {
this.that.entityUUID = x;
}

get entityName() {
return this.that.entityName;
}

set entityName(x) {
this.that.entityName = x;
}

get entityTargetField() {
return this.that.entityTargetField;
}

set entityTargetField(x) {
this.that.entityTargetField = x;
}

get fileName() {
return this.that.fileName;
}

set fileName(x) {
this.that.fileName = x;
}

get type() {
return this.that.type;
}

set type(x) {
this.that.type = x;
}

get conceptUUID() {
return this.that.conceptUUID;
}

set conceptUUID(x) {
this.that.conceptUUID = x;
}

static create(entityUUID, entityName, fileName, type, entityTargetField, conceptUUID, uuid = General.randomUUID()) {
var mediaQueue = new MediaQueue();
mediaQueue.entityUUID = entityUUID;
mediaQueue.uuid = uuid;
mediaQueue.entityName = entityName;
mediaQueue.entityTargetField = entityTargetField;
mediaQueue.fileName = fileName;
mediaQueue.type = type;
mediaQueue.conceptUUID = conceptUUID;
return mediaQueue;
}

clone() {
const mediaQueueItem = new MediaQueue();
mediaQueueItem.uuid = this.uuid;
mediaQueueItem.entityUUID = this.entityUUID;
mediaQueueItem.entityName = this.entityName;
mediaQueueItem.entityTargetField = this.entityTargetField;
mediaQueueItem.fileName = this.fileName;
mediaQueueItem.type = this.type;
mediaQueueItem.conceptUUID = this.conceptUUID;
return mediaQueueItem;
}
static schema = {
name: "MediaQueue",
primaryKey: "uuid",
properties: {
uuid: "string",
entityUUID: "string",
entityName: "string",
entityTargetField: "string",
fileName: "string",
type: "string",
conceptUUID: {type: "string", optional: true},
},
};

constructor(that = null) {
super(that);
}

get entityUUID() {
return this.that.entityUUID;
}

set entityUUID(x) {
this.that.entityUUID = x;
}

get entityName() {
return this.that.entityName;
}

set entityName(x) {
this.that.entityName = x;
}

get entityTargetField() {
return this.that.entityTargetField;
}

set entityTargetField(x) {
this.that.entityTargetField = x;
}

get fileName() {
return this.that.fileName;
}

set fileName(x) {
this.that.fileName = x;
}

get type() {
return this.that.type;
}

set type(x) {
this.that.type = x;
}

get conceptUUID() {
return this.that.conceptUUID;
}

set conceptUUID(x) {
this.that.conceptUUID = x;
}

static create(entityUUID, entityName, fileName, type, entityTargetField, conceptUUID, uuid = General.randomUUID()) {
const mediaQueue = new MediaQueue();
mediaQueue.entityUUID = entityUUID;
mediaQueue.uuid = uuid;
mediaQueue.entityName = entityName;
mediaQueue.entityTargetField = entityTargetField;
mediaQueue.fileName = fileName;
mediaQueue.type = type;
mediaQueue.conceptUUID = conceptUUID;
return mediaQueue;
}

clone() {
const mediaQueueItem = new MediaQueue();
mediaQueueItem.uuid = this.uuid;
mediaQueueItem.entityUUID = this.entityUUID;
mediaQueueItem.entityName = this.entityName;
mediaQueueItem.entityTargetField = this.entityTargetField;
mediaQueueItem.fileName = this.fileName;
mediaQueueItem.type = this.type;
mediaQueueItem.conceptUUID = this.conceptUUID;
return mediaQueueItem;
}

getDisplayText() {
// generate safe to string
let str = "";
if (!_.isNil(this.entityName))
str += "EntityName: " + this.entityName + ", ";
if (!_.isNil(this.entityUUID))
str += "EntityUUID: " + this.entityUUID + ", ";
if (!_.isNil(this.entityTargetField))
str += "EntityTargetField: " + this.entityTargetField + ", ";
if (!_.isNil(this.fileName))
str += "FileName: " + this.fileName + ", ";
if (!_.isNil(this.type))
str += "Type: " + this.type + ", ";
if (!_.isNil(this.conceptUUID))
str += "ConceptUUID: " + this.conceptUUID;
return str;
}
}

export default MediaQueue;

0 comments on commit 65a6e48

Please sign in to comment.