blob: f97e60db8d0141bb29d2e76086231e2f6454babd [file] [log] [blame]
/********************************************************************************
* Copyright (c) 2015-2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
********************************************************************************/
import { Type } from 'class-transformer';
export enum ContextGroup {
ORDERED = 0,
MEASURED = 1
}
export class Attribute {
name: string;
unit: string;
dataType: string;
value: string | string [] | MDMLink | MDMLink[] | MDMLink[][];
sortIndex?: number;
readOnly?: boolean;
mandatory?: boolean;
description?: string;
}
export class MergedSensorAttribute {
name: string[];
unit: string[];
dataType: string[];
value: (string | MDMLink | MDMLink[])[];
}
export class MDMLink {
remotePath: string;
mimeType: string;
description: string;
size: string;
public getFileName() {
let fileName = '';
if (this.remotePath != undefined) {
const index = this.remotePath.lastIndexOf('/') + 1;
fileName = this.remotePath.substring(index);
}
return fileName;
}
}
export class FileSize {
remotePath: string;
size: string;
}
export class Relation {
name: string;
type: string;
entityType: string;
contextType: string;
ids: string[];
parentId: string;
}
export class Node {
name: string;
id: string;
type: string;
sourceType: string;
sourceName: string;
@Type(() => Attribute)
attributes: (Attribute)[];
@Type(() => Relation)
relations: Relation[];
active: boolean;
getClass() {
switch (this.type) {
case 'StructureLevel':
return 'pool';
case 'MeaResult':
return 'measurement';
case 'SubMatrix':
return 'channelgroup';
case 'MeaQuantity':
return 'channel';
default:
return this.type.toLowerCase();
}
}
}