import { DatasetProfileDefinitionModel } from '../../models/DatasetProfileDefinitionModel'; import { DatasetWizardModel } from '../../models/datasets/DatasetWizardModel'; import { DatasetProfileCriteria } from '../../models/criteria/dataset-profile/DatasetProfileCriteria'; import 'rxjs/add/operator/map'; import { HttpHeaders, HttpResponse, HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { HostConfiguration } from './../../app.constants'; import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service'; import { Observable } from 'rxjs/Observable'; import { DataManagementPlanModel } from '../../models/data-managemnt-plans/DataManagementPlanModel'; import { DataManagementPlanCriteria } from '../../models/criteria/data-management-plan/DataManagementPlanCriteria'; import { RequestItem } from '../../models/criteria/RequestItem'; import { DatasetProfileModel } from '../../models/datasetprofile/DatasetProfileModel'; import { ResponseContentType } from '@angular/http'; @Injectable() export class DatasetWizardService { private actionUrl: string; private headers: HttpHeaders; constructor(private http: BaseHttpService, private httpClient: HttpClient) { this.actionUrl = HostConfiguration.Server + 'datasetwizard/'; this.headers = new HttpHeaders(); this.headers = this.headers.set('Content-Type', 'application/json'); this.headers = this.headers.set('Accept', 'application/json'); } public userDmps(criteria: RequestItem): Observable { return this.http.post(this.actionUrl + 'userDmps', criteria, { headers: this.headers }); } public getAvailableProfiles(criteria: RequestItem): Observable { return this.http.post(this.actionUrl + 'getAvailableProfiles/', criteria, { headers: this.headers }); } public getSingle(id: String): Observable { return this.http.get(this.actionUrl + 'getSingle/' + id, { headers: this.headers }); } createDataset(datasetModel: DatasetWizardModel): Observable { return this.http.post(this.actionUrl + 'createOrUpdate', datasetModel, { headers: this.headers }); } public downloadPDF(id: string): Observable> { return this.httpClient.get(this.actionUrl + 'getPDF/' + id, { responseType: 'blob', observe: 'response' }) } public downloadXML(id: string): Observable> { return this.httpClient.get(this.actionUrl + 'getXml/' + id, { responseType: 'blob', observe: 'response' }) } public getDefinition(id: String): Observable { return this.http.get(this.actionUrl + 'get/' + id, { headers: this.headers }); } }