Add events hub notify calls
[sdc.git] / catalog-ui / src / app / ng2 / utils / ng1-upgraded-provider.ts
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 /**
22  * Created by rc2122 on 4/6/2017.
23  */
24 import {DataTypesService} from "../../services/data-types-service";
25 import ICacheObject = angular.ICacheObject;
26 import {SharingService} from "../../services/sharing-service";
27 import {CookieService} from "../../services/cookie-service";
28 import {CacheService} from "../../services/cache-service";
29 import {EventListenerService} from "app/services/event-listener-service";
30
31 /** Services we need to upgrade from angular1 to angular2 - in the future we need to rewrite them all to angular2 **/
32
33 export function dataTypesServiceFactory(cacheObj: ICacheObject) {
34     return cacheObj.get('Sdc.Services.DataTypesService');
35 }
36
37 export function sharingServiceFactory(cacheObj: ICacheObject) {
38     return cacheObj.get('Sdc.Services.SharingService');
39 }
40
41 export function cookieServiceFactory(cacheObj: ICacheObject) {
42     return cacheObj.get('Sdc.Services.CookieService');
43 }
44
45 export function stateServiceFactory(cacheObj: ICacheObject) {
46     return cacheObj.get('$state');
47 }
48
49 export function scopeServiceFactory(cacheObj: ICacheObject) {
50     return cacheObj.get('$scope');
51 }
52
53 export function stateParamsServiceFactory(cacheObj: ICacheObject) {
54     return cacheObj.get('$stateParams');
55 }
56
57 export function cacheServiceFactory(cacheObj: ICacheObject) {
58     return cacheObj.get('Sdc.Services.CacheService');
59 }
60
61 export function eventListenerServiceServiceFactory(cacheObj: ICacheObject) {
62     return cacheObj.get('EventListenerService');
63 }
64
65 export const DataTypesServiceProvider = {
66     provide: DataTypesService,
67     useFactory: dataTypesServiceFactory,
68     deps: ['$injector']
69 };
70
71
72 export const SharingServiceProvider = {
73     provide: SharingService,
74     useFactory: sharingServiceFactory,
75     deps: ['$injector']
76 };
77
78
79 export const CookieServiceProvider = {
80     provide: CookieService,
81     useFactory: cookieServiceFactory,
82     deps: ['$injector']
83 };
84
85 export const StateServiceFactory = {
86     provide: '$state',
87     useFactory: stateServiceFactory,
88     deps: ['$injector']
89 };
90
91 export const ScopeServiceFactory= {
92     provide: '$scope',
93     useFactory: scopeServiceFactory,
94     deps: ['$injector']
95 };
96
97 export const StateParamsServiceFactory = {
98     provide: '$stateParams',
99     useFactory: stateParamsServiceFactory,
100     deps: ['$injector']
101 };
102
103 export const CacheServiceProvider = {
104     provide: CacheService,
105     useFactory: cacheServiceFactory,
106     deps: ['$injector']
107 };
108
109 export const EventListenerServiceProvider = {
110     provide: EventListenerService,
111     useFactory: eventListenerServiceServiceFactory,
112     deps: ['$injector']
113 };