File

src/models/events/odm/domain-management-object-removed-event.ts

Description

Serializable REDHAWK Domain Object Removed Event

Extends

DomainManagementObjectEvent

Implements

ISerializable

Index

Properties
Methods

Methods

deserialize
deserialize(input: any)

Deserializes a JSON object into this class

Parameters :
Name Type Optional Description
input any
Returns : this

Properties

Public sourceCategory
sourceCategory: SourceCategory
Type : SourceCategory

Category of this event (i.e., the type of REDHAWK entity producing it)

import { ISerializable } from '../../serialization/index';

import { SourceCategory } from './enums/index';
import { DomainManagementObjectEvent } from './domain-management-object-event';

/**
 * Serializable REDHAWK Domain Object Removed Event
 */
export class DomainManagementObjectRemovedEvent
    extends DomainManagementObjectEvent
    implements ISerializable<DomainManagementObjectRemovedEvent> {

    /** Category of this event (i.e., the type of REDHAWK entity producing it) */
    public sourceCategory: SourceCategory;

    /** Deserializes a JSON object into this class */
    deserialize(input: any) {
        super.deserialize(input);
        this.sourceCategory = fromString(input.sourceCategory.value);
        return this;
    }
}

function fromString (category: string): SourceCategory {
    let out = SourceCategory.UNKNOWN;
    switch (category) {
        case 'DEVICE_MANAGER':
            out = SourceCategory.DEVICE_MANAGER;
            break;
        case 'DEVICE':
            out = SourceCategory.DEVICE;
            break;
        case 'APPLICATION_FACTORY':
            out = SourceCategory.APPLICATION_FACTORY;
            break;
        case 'APPLICATION':
            out = SourceCategory.APPLICATION;
            break;
        case 'SERVICE':
            out = SourceCategory.SERVICE;
            break;
        default:
            // Do anything?
            break;
    }
    return out;
}

results matching ""

    No results matching ""