2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
22 * Created by rc2122 on 4/6/2017.
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 {ComponentFactory} from "../../utils/component-factory"
30 import { EventListenerService } from "app/services/event-listener-service";
31 import { ModalsHandler } from "app/utils";
32 import IScope = angular.IScope;
34 /** Services we need to upgrade from angular1 to angular2 - in the future we need to rewrite them all to angular2 **/
36 export function dataTypesServiceFactory(cacheObj: ICacheObject) {
37 return cacheObj.get('Sdc.Services.DataTypesService');
40 export function sharingServiceFactory(cacheObj: ICacheObject) {
41 return cacheObj.get('Sdc.Services.SharingService');
44 export function componentServiceFactory(cacheObj: ICacheObject) {
45 return cacheObj.get('Sdc.Services.ComponentFactory');
48 export function cookieServiceFactory(cacheObj: ICacheObject) {
49 return cacheObj.get('Sdc.Services.CookieService');
52 export function stateServiceFactory(cacheObj: ICacheObject) {
53 return cacheObj.get('$state');
56 export function stateParamsServiceFactory(cacheObj: ICacheObject) {
57 return cacheObj.get('$stateParams');
60 export function scopeServiceFactory(cacheObj: ICacheObject) {
61 return cacheObj.get('$scope');
64 export function cacheServiceFactory(cacheObj: ICacheObject) {
65 return cacheObj.get('Sdc.Services.CacheService');
68 export function eventListenerServiceServiceFactory(cacheObj: ICacheObject) {
69 return cacheObj.get('EventListenerService');
72 export function notificationServiceFactory(cacheObj: ICacheObject) {
73 return cacheObj.get('Notification');
77 export const ComponentFactoryProvider = {
78 provide: ComponentFactory,
79 useFactory: componentServiceFactory,
84 export function ModalsHandlerFactory(cacheObj: ICacheObject) {
85 return cacheObj.get('ModalsHandler');
88 export const DataTypesServiceProvider = {
89 provide: DataTypesService,
90 useFactory: dataTypesServiceFactory,
95 export const SharingServiceProvider = {
96 provide: SharingService,
97 useFactory: sharingServiceFactory,
102 export const CookieServiceProvider = {
103 provide: CookieService,
104 useFactory: cookieServiceFactory,
108 export const StateServiceFactory = {
110 useFactory: stateServiceFactory,
114 export const ScopeServiceFactory = {
116 useFactory: scopeServiceFactory,
120 export const StateParamsServiceFactory = {
121 provide: '$stateParams',
122 useFactory: stateParamsServiceFactory,
125 export const CacheServiceProvider = {
126 provide: CacheService,
127 useFactory: cacheServiceFactory,
131 export const EventListenerServiceProvider = {
132 provide: EventListenerService,
133 useFactory: eventListenerServiceServiceFactory,
137 export const NotificationServiceProvider = {
138 provide: 'Notification',
139 useFactory: notificationServiceFactory,
143 export const ModalsHandlerProvider = {
144 provide: ModalsHandler,
145 useFactory: ModalsHandlerFactory,