e53e3a7bfc2b5cf533c73513ca6e8f5cddfabdc4
[osm/riftware.git] /
1 /*
2  * STANDARD_RIFT_IO_COPYRIGHT
3  */
4 /**
5  * Created by onvelocity on 11/23/15.
6  */
7
8 'use strict';
9
10 import Position from '../../graph/Position'
11 import DescriptorModel from '../DescriptorModel'
12 import DescriptorModelFactory from '../DescriptorModelFactory'
13
14 export default class InternalConnectionPoint extends DescriptorModel {
15
16         static get type() {
17                 return 'internal-connection-point';
18         }
19
20         static get className() {
21                 return 'InternalConnectionPoint';
22         }
23
24         static get qualifiedType() {
25                 return 'vnfd.vdu.' + InternalConnectionPoint.type;
26         }
27
28         constructor(model, parent) {
29                 super(model, parent);
30                 // evil type collides with the YANG property 'type' for this object
31                 this.type = 'internal-connection-point';
32                 this.uiState['qualified-type'] = InternalConnectionPoint.qualifiedType;
33                 this.className = 'InternalConnectionPoint';
34                 this.location = 'bottom-left';
35                 this.position = new Position(parent.position.value());
36                 this.position.top = parent.position.bottom;
37                 this.position.width = 14;
38                 this.position.height = 14;
39         }
40
41         get key() {
42                 return this.id;
43         }
44
45         toInternalConnectionPointRef() {
46                 return DescriptorModelFactory.newInternalConnectionPointRef(this.id);
47         }
48
49         canConnectTo(obj) {
50                 return DescriptorModelFactory.isInternalVirtualLink(obj) || (DescriptorModelFactory.isInternalConnectionPoint(obj) && obj.parent !== this.parent);
51         }
52
53         remove() {
54                 return this.parent.removeInternalConnectionPoint(this);
55         }
56
57 }