import { Injectable } from '@angular/core' ; import { Organization } from "../api-services/models/organization.class" ; import { NetworkService } from "../api-services/models/network-service.interface" ; import { Network } from "../api-services/models/network.class" ; import { IpAddress } from "../api-services/models/ip-address.interface" ; @ Injectable ( ) export class WsCacheService { private _cache : any ; constructor ( ) { this . _cache = { } ; } public cacheIpAddress ( ipAddress ) { this . _cache [ ipAddress . uuid ] = ipAddress ; } public cacheIpAddresses ( ipAddresses ) { for ( let ipAddress of ipAddresses ) { this . cacheIpAddress ( ipAddress ) ; } } public cacheNetwork ( network ) { this . _cache [ network . uuid ] = network ; } public cacheNetworks ( networks ) { for ( let network of networks ) { this . cacheNetwork ( network ) ; } } public cacheNetworkService ( networkService ) { this . _cache [ networkService . uuid ] = networkService ; } public cacheNetworkServices ( networkServices ) { for ( let networkService of networkServices ) { this . cacheNetworkService ( networkService ) ; } } public cacheOrganization ( organization ) { this . _cache [ organization . uuid ] = organization ; } public cacheOrganizations ( organizations ) { for ( let organization of organizations ) { this . cacheOrganization ( organization ) ; } } public get ( uuid ) { return this . _cache [ uuid ] ; } }