Catalog alignment
[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 import {ArtifactGroupModel} from "../../../models/artifacts";
6
7 export class ServiceGenericResponse extends ComponentGenericResponse implements Serializable<ServiceGenericResponse>  {
8     public forwardingPaths: { [key:string]:ForwardingPath } = {};
9     public serviceApiArtifacts: ArtifactGroupModel;
10
11     deserialize (response): ServiceGenericResponse {
12         super.deserialize(response);
13         this.serviceApiArtifacts = new ArtifactGroupModel(response.serviceApiArtifacts);
14         if(response.forwardingPaths) {
15             _.forEach(response.forwardingPaths, (pathResponse, id) => {
16                 let pathId = id;
17                 let path:ForwardingPath = new ForwardingPath();
18                 path.deserialize(pathResponse);
19                 path.uniqueId = pathId;
20                 this.forwardingPaths[pathId] = path;
21             });
22         }
23         return this;
24     }
25 }