import 'rxjs/add/operator/map'; import { HttpClient, HttpHeaders } 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 { ExternalSourcesItemModel } from '../../models/external-sources/ExternalSourcesItemModel'; import { BaseCriteria } from '../../models/criteria/BaseCriteria'; import { RequestItem } from '../../models/criteria/RequestItem'; import { ResearcherCriteria } from '../../models/criteria/researchers/ResearcherCriteria'; import { ExternalDatasetCriteria } from '../../models/criteria/external-dataset/ExternalDatasetCriteria'; import { RegistryCriteria } from '../../models/criteria/registry/RegistryCriteria'; import { DataRepositoryCriteria } from '../../models/criteria/data-repository/DataRepositoryCriteria'; import { ServicesCriteria } from '../../models/criteria/services/ServicesCriteria'; @Injectable() export class ExternalSourcesService { private actionUrl: string; private headers: HttpHeaders; constructor(private http: BaseHttpService) { this.actionUrl = HostConfiguration.Server + 'external/'; this.headers = new HttpHeaders(); this.headers = this.headers.set('Content-Type', 'application/json'); this.headers = this.headers.set('Accept', 'application/json'); } public searchDatasetRegistry(requestItem: RequestItem): Observable { return this.http.get(this.actionUrl + "registries" + "?query=" + requestItem.criteria.like + "&type=" + requestItem.criteria.type, { headers: this.headers }); } public searchDatasetRepository(requestItem: RequestItem): Observable { return this.http.get(this.actionUrl + "datarepos" + "?query=" + requestItem.criteria.like + "&type=" + requestItem.criteria.type, { headers: this.headers }); } public searchDatasetService(requestItem: RequestItem): Observable { return this.http.get(this.actionUrl + "services" + "?query=" + requestItem.criteria.like + "&type=" + requestItem.criteria.type, { headers: this.headers }); } public searchDatasetSExternalDatasetservice(requestItem: RequestItem): Observable { return this.http.get(this.actionUrl + "datasets" + "?query=" + requestItem.criteria.like + "&type=" + requestItem.criteria.type, { headers: this.headers }); } public searchDMPResearchers(requestItem: RequestItem): Observable { return this.http.post(HostConfiguration.Server + "/researchers/getWithExternal", requestItem, { headers: this.headers }); } public searchDMPOrganizations(like: string): Observable { return this.http.get(this.actionUrl + "organisations" + "?query=" + like, { headers: this.headers }); }//organizationscriteria.criteria.like public searchDMPProfiles(like: string): Observable { return this.http.get(this.actionUrl + "datasetprofiles/get" + "?query=" + like, { headers: this.headers }); } }