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

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

    deserialize (response): ServiceGenericResponse {
        super.deserialize(response);
        this.serviceApiArtifacts = new ArtifactGroupModel(response.serviceApiArtifacts);
        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;
    }
}