569228bde913a335a6b7fa87cefa5c5e2537cf91
[groupbasedpolicy.git] / groupbasedpolicy-ui / module / src / main / resources / gbp / endpoints / sxp-mapping.service.js
1 define([], function () {
2     'use strict';
3
4     angular.module('app.gbp').service('SxpMappingService', SxpMappingService);
5
6     function SxpMappingService() {
7         /* methods */
8         this.createObject = createObject;
9
10         /**
11          * EndpointSgt constructor
12          * @constructor
13          */
14         function EndpointSgt() {
15             /* properties */
16             this.data = {};
17
18             /* methods */
19             this.setData = setData;
20
21             /* Implementation */
22             /**
23              * fills EndpointSgt object with data
24              * @param data
25              */
26
27             function setData(data) {
28                 this.data = {};
29                 this.data.sgt = data.sgt;
30                 this.data['endpoint-groups'] = data['endpoint-groups'];
31                 this.data.conditions = data.conditions;
32                 this.data.tenant = data.tenant;
33             }
34         }
35
36         /**
37          * creates EndpointSgt object and fills it with data if available
38          * @param data
39          * @returns {EndpointSgt}
40          */
41         function createObject(data) {
42             var obj = new EndpointSgt();
43
44             if (data) {
45                 obj.setData(data);
46             }
47
48             return obj;
49         }
50     }
51
52     return SxpMappingService;
53 });