aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/services/responses/service-generic-response.ts
blob: d32ed26bb25ce327c974c175c29aa2d986638348 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import * as _ from "lodash";
import {Serializable} from "../utils/serializable";
import {ComponentGenericResponse} from "./component-generic-response";
import {ForwardingPath} from "../../../models/forwarding-path";

export class ServiceGenericResponse extends ComponentGenericResponse implements Serializable<ServiceGenericResponse>  {
    public forwardingPaths: { [key:string]:ForwardingPath } = {};

    deserialize (response): ServiceGenericResponse {
        super.deserialize(response);
        if(response.forwardingPaths) {
            _.forEach(response.forwardingPaths, (pathResponse, id) => {
                let pathId = id;
                let path:ForwardingPath = new ForwardingPath();
                path.deserialize(pathResponse);
                path.uniqueId = pathId;
                this.forwardingPaths[pathId] = path;
            });
        }
        return this;
    }
}