| /* |
| ****************************************************************************** |
| * Copyright © 2018 PTA GmbH. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| ****************************************************************************** |
| */ |
| import { Injectable } from '@angular/core'; |
| import { Observable } from 'rxjs/Observable'; |
| import 'rxjs/add/observable/throw'; |
| import 'rxjs/add/operator/catch'; |
| import 'rxjs/add/operator/map'; |
| import { Globals } from '../common/globals'; |
| import { SessionContext } from '../common/session-context'; |
| import { Status } from '../model/status'; |
| import { Branch } from './../model/branch'; |
| import { CostCenter } from './../model/cost-center'; |
| import { BaseHttpService, HttpCallInfo, HttpMethodEn } from './base-http.service'; |
| import { BranchLevel } from '../model/branch-level'; |
| import { Territory } from '../model/territory'; |
| |
| @Injectable() |
| export class BaseDataService { |
| |
| constructor( |
| private baseHttpService: BaseHttpService, |
| private sessionContext: SessionContext) { |
| } |
| |
| public getBranches(): Observable<Branch[]> { |
| return this.baseHttpService.callService( |
| new HttpCallInfo(Globals.GRID_MEASURES_SERVICE_NAME, HttpMethodEn.get, '/getBranches', null), this.sessionContext); |
| } |
| |
| public getBranchLevels(branchId: number): Observable<BranchLevel[]> { |
| return this.baseHttpService.callService( |
| new HttpCallInfo(Globals.GRID_MEASURES_SERVICE_NAME, HttpMethodEn.get, '/getBranchLevelsByBranch/' + branchId, null), |
| this.sessionContext); |
| } |
| |
| public getStatuses(): Observable<Status[]> { |
| return this.baseHttpService.callService( |
| new HttpCallInfo(Globals.GRID_MEASURES_SERVICE_NAME, HttpMethodEn.get, '/getGmStatus', null), this.sessionContext); |
| } |
| |
| public getCostCenters(): Observable<CostCenter[]> { |
| return this.baseHttpService.callService( |
| new HttpCallInfo(Globals.GRID_MEASURES_SERVICE_NAME, HttpMethodEn.get, '/getCostCenters', null), this.sessionContext); |
| } |
| |
| public getEmailAddressesFromTemplates(): Observable<string[]> { |
| return this.baseHttpService.callService( |
| new HttpCallInfo(Globals.GRID_MEASURES_SERVICE_NAME, HttpMethodEn.get, '/getEmailAddressesFromTemplates', null), this.sessionContext); |
| } |
| |
| public getEmailAddressesFromGridmeasures(): Observable<string[]> { |
| return this.baseHttpService.callService( |
| new HttpCallInfo(Globals.GRID_MEASURES_SERVICE_NAME, HttpMethodEn.get, '/getMailAddressesFromGridmeasures', null), |
| this.sessionContext); |
| } |
| |
| public getTerritories(): Observable<Territory[]> { |
| return this.baseHttpService.callService( |
| new HttpCallInfo(Globals.GRID_MEASURES_SERVICE_NAME, HttpMethodEn.get, '/getTerritories', null), this.sessionContext); |
| } |
| } |
| |