You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2020/03/10 16:51:43 UTC
[incubator-streampipes] branch dev updated: Change type check in
adapter creation
This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 5be3b76 Change type check in adapter creation
5be3b76 is described below
commit 5be3b76f93f02a5ab2e0f62a6685c5613150f5f9
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Tue Mar 10 17:50:45 2020 +0100
Change type check in adapter creation
---
ui/src/app/connect/model/DataStreamDescription.ts | 2 +-
.../app/connect/new-adapter/new-adapter.component.ts | 18 ++++++++++--------
ui/src/app/connect/schema-editor/model/EventSchema.ts | 14 +++++++-------
3 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/ui/src/app/connect/model/DataStreamDescription.ts b/ui/src/app/connect/model/DataStreamDescription.ts
index 2bdecf8..eeb90db 100644
--- a/ui/src/app/connect/model/DataStreamDescription.ts
+++ b/ui/src/app/connect/model/DataStreamDescription.ts
@@ -43,4 +43,4 @@ export class DataStreamDescription {
this.id = id;
}
-}
\ No newline at end of file
+}
diff --git a/ui/src/app/connect/new-adapter/new-adapter.component.ts b/ui/src/app/connect/new-adapter/new-adapter.component.ts
index 7f78b27..d174d9e 100644
--- a/ui/src/app/connect/new-adapter/new-adapter.component.ts
+++ b/ui/src/app/connect/new-adapter/new-adapter.component.ts
@@ -282,13 +282,13 @@ export class NewAdapterComponent implements OnInit {
getEventSchema(adapter: AdapterDescription): EventSchema {
let eventSchema: EventSchema;
- if (adapter.constructor.name === 'GenericAdapterSetDescription') {
+ if (adapter instanceof GenericAdapterSetDescription) {
eventSchema = (adapter as GenericAdapterSetDescription).dataSet.eventSchema;
- } else if (adapter.constructor.name === 'SpecificAdapterSetDescription') {
+ } else if (adapter instanceof SpecificAdapterSetDescription) {
eventSchema = (adapter as SpecificAdapterSetDescription).dataSet.eventSchema;
- } else if (adapter.constructor.name === 'GenericAdapterStreamDescription') {
+ } else if (adapter instanceof GenericAdapterStreamDescription) {
eventSchema = (adapter as GenericAdapterStreamDescription).dataStream.eventSchema;
- } else if (adapter.constructor.name === 'SpecificAdapterStreamDescription') {
+ } else if (adapter instanceof SpecificAdapterStreamDescription) {
eventSchema = (adapter as SpecificAdapterStreamDescription).dataStream.eventSchema;
} else {
return new EventSchema();
@@ -303,14 +303,16 @@ export class NewAdapterComponent implements OnInit {
public setSchema() {
- if (this.adapter.constructor.name === 'GenericAdapterSetDescription') {
+ if (this.adapter instanceof GenericAdapterSetDescription) {
(this.adapter as GenericAdapterSetDescription).dataSet.eventSchema = this.eventSchema;
- } else if (this.adapter.constructor.name === 'SpecificAdapterSetDescription') {
+ } else if (this.adapter instanceof SpecificAdapterSetDescription) {
(this.adapter as SpecificAdapterSetDescription).dataSet.eventSchema = this.eventSchema;
- } else if (this.adapter.constructor.name === 'GenericAdapterStreamDescription') {
+ } else if (this.adapter instanceof GenericAdapterStreamDescription) {
(this.adapter as GenericAdapterStreamDescription).dataStream.eventSchema = this.eventSchema;
- } else if (this.adapter.constructor.name === 'SpecificAdapterStreamDescription') {
+ } else if (this.adapter instanceof SpecificAdapterStreamDescription) {
(this.adapter as SpecificAdapterStreamDescription).dataStream.eventSchema = this.eventSchema;
+ } else {
+ console.log('Error: Adapter type is unknown');
}
diff --git a/ui/src/app/connect/schema-editor/model/EventSchema.ts b/ui/src/app/connect/schema-editor/model/EventSchema.ts
index 86dd980..6393cff 100644
--- a/ui/src/app/connect/schema-editor/model/EventSchema.ts
+++ b/ui/src/app/connect/schema-editor/model/EventSchema.ts
@@ -16,11 +16,11 @@
*
*/
-import {EventProperty} from './EventProperty';
-import {Injectable} from '@angular/core';
-import {RdfsClass} from '../../../platform-services/tsonld/RdfsClass';
-import {RdfProperty} from '../../../platform-services/tsonld/RdfsProperty';
-import {RdfId} from '../../../platform-services/tsonld/RdfId';
+import { Injectable } from '@angular/core';
+import { RdfId } from '../../../platform-services/tsonld/RdfId';
+import { RdfsClass } from '../../../platform-services/tsonld/RdfsClass';
+import { RdfProperty } from '../../../platform-services/tsonld/RdfsProperty';
+import { EventProperty } from './EventProperty';
@Injectable()
@RdfsClass('sp:EventSchema')
@@ -32,7 +32,7 @@ export class EventSchema {
public id: string;
@RdfProperty('sp:hasEventProperty')
- public eventProperties: Array<EventProperty>;
+ public eventProperties: EventProperty[];
constructor () {
@@ -42,7 +42,7 @@ export class EventSchema {
public copy(): EventSchema {
const newEventSchema = new EventSchema();
- for (let ep of this.eventProperties) {
+ for (const ep of this.eventProperties) {
newEventSchema.eventProperties.push(ep.copy());
}