From 445bf9f579c2eb8deb00230dd99ee0cdcc108fb4 Mon Sep 17 00:00:00 2001 From: SaadBendou Date: Thu, 21 Sep 2023 15:19:47 +0200 Subject: [PATCH] fix: remove dead Code --- .../core/services/asset-property-mapper.ts | 75 +------------------ 1 file changed, 2 insertions(+), 73 deletions(-) diff --git a/src/app/core/services/asset-property-mapper.ts b/src/app/core/services/asset-property-mapper.ts index 650abe0e8..26fc1bb38 100644 --- a/src/app/core/services/asset-property-mapper.ts +++ b/src/app/core/services/asset-property-mapper.ts @@ -1,10 +1,5 @@ -import {Inject, Injectable} from '@angular/core'; +import {Injectable} from '@angular/core'; import {UiAsset} from '@sovity.de/edc-client'; -import {AssetEditorDialogFormValue} from '../../routes/connector-ui/asset-page/asset-create-dialog/asset-editor-dialog-form-model'; -import {ActiveFeatureSet} from '../config/active-feature-set'; -import {APP_CONFIG, AppConfig} from '../config/app-config'; -import {removeNullValues} from '../utils/record-utils'; -import {trimmedOrNull} from '../utils/string-utils'; import {AssetProperties} from './asset-properties'; import {AdditionalAssetProperty, Asset} from './models/asset'; @@ -15,11 +10,6 @@ import {AdditionalAssetProperty, Asset} from './models/asset'; providedIn: 'root', }) export class AssetPropertyMapper { - constructor( - @Inject(APP_CONFIG) private config: AppConfig, - private activeFeatureSet: ActiveFeatureSet, - ) {} - buildUiAssetfromprops(props: Record): UiAsset { return { assetId: props[AssetProperties.id] ?? '', @@ -91,14 +81,13 @@ export class AssetPropertyMapper { ]; for (let propName of propertiesToConvert) { - const propValue = asset[propName as AssetKey]; + const propValue = asset[propName]; if (propValue) { for (let key in propValue) { result.push({key: key, value: propValue[key]}); } } } - return result; } @@ -122,70 +111,10 @@ export class AssetPropertyMapper { return result; } - buildProperties( - formValue: AssetEditorDialogFormValue, - ): Record { - const {metadata, advanced, datasource} = formValue; - const props: Record = {}; - props[AssetProperties.id] = trimmedOrNull(metadata?.id); - props[AssetProperties.name] = trimmedOrNull(metadata?.name); - props[AssetProperties.version] = trimmedOrNull(metadata?.version); - props[AssetProperties.curatorOrganizationName] = trimmedOrNull( - this.config.curatorOrganizationName, - ); - props[AssetProperties.keywords] = trimmedOrNull( - metadata?.keywords?.join(', '), - ); - props[AssetProperties.contentType] = trimmedOrNull(metadata?.contentType); - props[AssetProperties.description] = trimmedOrNull(metadata?.description); - props[AssetProperties.language] = metadata?.language?.id ?? null; - - props[AssetProperties.publisher] = trimmedOrNull(metadata?.publisher); - props[AssetProperties.standardLicense] = trimmedOrNull( - metadata?.standardLicense, - ); - props[AssetProperties.endpointDocumentation] = trimmedOrNull( - metadata?.endpointDocumentation, - ); - - if (this.activeFeatureSet.hasMdsFields()) { - props[AssetProperties.dataCategory] = advanced?.dataCategory?.id ?? null; - props[AssetProperties.dataSubcategory] = - advanced?.dataSubcategory?.id ?? null; - props[AssetProperties.dataModel] = trimmedOrNull(advanced?.dataModel); - props[AssetProperties.geoReferenceMethod] = trimmedOrNull( - advanced?.geoReferenceMethod, - ); - props[AssetProperties.transportMode] = - advanced?.transportMode?.id ?? null; - } - - if (datasource?.dataAddressType === 'Http') { - props[AssetProperties.httpProxyMethod] = this._encodeBoolean( - datasource?.httpProxyMethod, - ); - props[AssetProperties.httpProxyPath] = this._encodeBoolean( - datasource?.httpProxyPath, - ); - props[AssetProperties.httpProxyQueryParams] = this._encodeBoolean( - datasource?.httpProxyQueryParams, - ); - props[AssetProperties.httpProxyBody] = this._encodeBoolean( - datasource?.httpProxyBody, - ); - } - - return removeNullValues(props); - } - private _parseBooleanFromString(value: string | null): boolean | undefined { if (!value) { return undefined; } return value === 'true'; } - - private _encodeBoolean(value?: boolean | null): string { - return value ? 'true' : 'false'; - } }