Sync Integ to Master
[sdc.git] / catalog-ui / src / app / ng2 / services / responses / service-generic-response.ts
1 import * as _ from "lodash";
2 import {Serializable} from "../utils/serializable";
3 import {ComponentGenericResponse} from "./component-generic-response";
4 import {ForwardingPath} from "../../../models/forwarding-path";
5
6 export class ServiceGenericResponse extends ComponentGenericResponse implements Serializable<ServiceGenericResponse>  {
7     public forwardingPaths: { [key:string]:ForwardingPath } = {};
8
9     deserialize (response): ServiceGenericResponse {
10         super.deserialize(response);
11         if(response.forwardingPaths) {
12             _.forEach(response.forwardingPaths, (pathResponse, id) => {
13                 let pathId = id;
14                 let path:ForwardingPath = new ForwardingPath();
15                 path.deserialize(pathResponse);
16                 path.uniqueId = pathId;
17                 this.forwardingPaths[pathId] = path;
18             });
19         }
20         return this;
21     }
22 }