<commit_before>import * as ng from 'angular';

import { IArrayUtility } from '../../array/array.service';

import { IBaseDataService, BaseDataService, IBaseDomainObject, ITransformFunction } from '../baseDataService/baseData.service';
import { IBaseDataServiceView } from '../baseDataService/baseDataServiceView';
import { IBaseSingletonDataService } from '../baseSingletonDataService/baseSingletonData.service';

export interface IBaseParentDataService<TDataType extends IBaseDomainObject, TSearchParams, TResourceDictionaryType>
	extends IBaseDataService<TDataType, TSearchParams>{
	childContracts(id?: number): TResourceDictionaryType;
	baseChildContracts(): TResourceDictionaryType;
}

export class BaseParentDataService<TDataType extends IBaseDomainObject, TSearchParams, TResourceDictionaryType>
	extends BaseDataService<TDataType, TSearchParams> implements IBaseParentDataService<TDataType, TSearchParams, TResourceDictionaryType> {
	private _childContracts: TResourceDictionaryType;

	constructor($http: ng.IHttpService, $q: ng.IQService, array: IArrayUtility, endpoint: string, mockData: TDataType[]
		, protected resourceDictionaryBuilder: { (): TResourceDictionaryType }
		, transform?: ITransformFunction<TDataType>
		, useMock?: boolean
        , logRequests?: boolean) {
		super($http, $q, array, endpoint, mockData, transform, useMock, logRequests);
		this._childContracts = this.resourceDictionaryBuilder();
	}

	childContracts(id?: number): TResourceDictionaryType {
		if (_.isUndefined(id)) {
			return <any>_.mapValues(this._childContracts, (dataService: any): IBaseDataService<TDataType, TSearchParams> => {
				let contract: any = dataService.clone();
				contract.endpoint = this.endpoint + contract.endpoint;
				return contract;
			});
		} else {
			let dictionary: {[index: string]: any} = this._childContracts;
			return <any>_.mapValues(dictionary, (dataService: IBaseDataServiceView<TDataType, TSearchParams>): IBaseSingletonDataService<TDataType> | IBaseDataService<TDataType, TSearchParams> => {
				let contract: any = dataService;

				if (_.isFunction(contract.AsSingleton)) {
					contract = contract.AsSingleton(id);
				} else {
					contract = contract.clone();
				}
				contract.endpoint = this.endpoint + '/' + id + contract.endpoint;
				return contract;
			});
		}
	}

	baseChildContracts(): TResourceDictionaryType {
		return this._childContracts;
	}
}<commit_msg>Revert "Added a function for getting the underlying resources for mocking."<commit_after>import * as ng from 'angular';

import { IArrayUtility } from '../../array/array.service';

import { IBaseDataService, BaseDataService, IBaseDomainObject, ITransformFunction } from '../baseDataService/baseData.service';
import { IBaseDataServiceView } from '../baseDataService/baseDataServiceView';
import { IBaseSingletonDataService } from '../baseSingletonDataService/baseSingletonData.service';

export interface IBaseParentDataService<TDataType extends IBaseDomainObject, TSearchParams, TResourceDictionaryType>
	extends IBaseDataService<TDataType, TSearchParams>{
	childContracts(id?: number): TResourceDictionaryType;
}

export class BaseParentDataService<TDataType extends IBaseDomainObject, TSearchParams, TResourceDictionaryType>
	extends BaseDataService<TDataType, TSearchParams> implements IBaseParentDataService<TDataType, TSearchParams, TResourceDictionaryType> {
	private _childContracts: TResourceDictionaryType;

	constructor($http: ng.IHttpService, $q: ng.IQService, array: IArrayUtility, endpoint: string, mockData: TDataType[]
		, protected resourceDictionaryBuilder: { (): TResourceDictionaryType }
		, transform?: ITransformFunction<TDataType>
		, useMock?: boolean
        , logRequests?: boolean) {
		super($http, $q, array, endpoint, mockData, transform, useMock, logRequests);
		this._childContracts = this.resourceDictionaryBuilder();
	}

	childContracts(id?: number): TResourceDictionaryType {
		if (_.isUndefined(id)) {
			return <any>_.mapValues(this._childContracts, (dataService: any): IBaseDataService<TDataType, TSearchParams> => {
				let contract: any = dataService.clone();
				contract.endpoint = this.endpoint + contract.endpoint;
				return contract;
			});
		} else {
			let dictionary: {[index: string]: any} = this._childContracts;
			return <any>_.mapValues(dictionary, (dataService: IBaseDataServiceView<TDataType, TSearchParams>): IBaseSingletonDataService<TDataType> | IBaseDataService<TDataType, TSearchParams> => {
				let contract: any = dataService;

				if (_.isFunction(contract.AsSingleton)) {
					contract = contract.AsSingleton(id);
				} else {
					contract = contract.clone();
				}
				contract.endpoint = this.endpoint + '/' + id + contract.endpoint;
				return contract;
			});
		}
	}
}
{'fraction_non_alphanumeric': 0.11003372681281619, 'fraction_numerical': 0.0, 'mean_word_length': 5.947291361639825, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '536306', 'n_tokens_mistral': 1430, 'n_tokens_neox': 1341, 'n_words': 286}