From f18fe6b9dedf4f1c8e4c708bffebcf9acb0e9e14 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Wed, 16 Oct 2019 11:48:47 +0200 Subject: [PATCH] Adding ISModel Definition --- .../src/app/is-model/reference/ER.ts | 8 ++++ .../app/is-model/reference/ISManageable.ts | 3 ++ .../is-model/reference/entities/Context.ts | 10 +++++ .../app/is-model/reference/entities/Entity.ts | 6 +++ .../app/is-model/reference/entities/Facet.ts | 6 +++ .../is-model/reference/entities/Resource.ts | 11 ++++++ .../reference/properties/Encrypted.ts | 5 +++ .../is-model/reference/properties/Header.ts | 9 +++++ .../properties/PropagationConstraint.ts | 39 +++++++++++++++++++ .../is-model/reference/properties/Property.ts | 6 +++ .../reference/relations/ConsistsOf.ts | 7 ++++ .../reference/relations/IsIdentifiedBy.ts | 7 ++++ .../reference/relations/IsParentOf.ts | 7 ++++ .../reference/relations/IsRelatedTo.ts | 6 +++ .../is-model/reference/relations/Relation.ts | 9 +++++ .../types/TypeDefinition.ts} | 2 +- .../resource-types-tree.component.ts | 10 ++--- is-monitor-frontend/src/app/type.ts | 4 +- is-monitor-frontend/src/app/types.ts | 4 +- 19 files changed, 149 insertions(+), 10 deletions(-) create mode 100644 is-monitor-frontend/src/app/is-model/reference/ER.ts create mode 100644 is-monitor-frontend/src/app/is-model/reference/ISManageable.ts create mode 100644 is-monitor-frontend/src/app/is-model/reference/entities/Context.ts create mode 100644 is-monitor-frontend/src/app/is-model/reference/entities/Entity.ts create mode 100644 is-monitor-frontend/src/app/is-model/reference/entities/Facet.ts create mode 100644 is-monitor-frontend/src/app/is-model/reference/entities/Resource.ts create mode 100644 is-monitor-frontend/src/app/is-model/reference/properties/Encrypted.ts create mode 100644 is-monitor-frontend/src/app/is-model/reference/properties/Header.ts create mode 100644 is-monitor-frontend/src/app/is-model/reference/properties/PropagationConstraint.ts create mode 100644 is-monitor-frontend/src/app/is-model/reference/properties/Property.ts create mode 100644 is-monitor-frontend/src/app/is-model/reference/relations/ConsistsOf.ts create mode 100644 is-monitor-frontend/src/app/is-model/reference/relations/IsIdentifiedBy.ts create mode 100644 is-monitor-frontend/src/app/is-model/reference/relations/IsParentOf.ts create mode 100644 is-monitor-frontend/src/app/is-model/reference/relations/IsRelatedTo.ts create mode 100644 is-monitor-frontend/src/app/is-model/reference/relations/Relation.ts rename is-monitor-frontend/src/app/{ISType.ts => is-model/types/TypeDefinition.ts} (77%) diff --git a/is-monitor-frontend/src/app/is-model/reference/ER.ts b/is-monitor-frontend/src/app/is-model/reference/ER.ts new file mode 100644 index 0000000..8b370c4 --- /dev/null +++ b/is-monitor-frontend/src/app/is-model/reference/ER.ts @@ -0,0 +1,8 @@ +import { ISManageable } from './ISManageable'; +import { Header } from './properties/Header'; + +export interface ER extends ISManageable { + + header: Header; + +} diff --git a/is-monitor-frontend/src/app/is-model/reference/ISManageable.ts b/is-monitor-frontend/src/app/is-model/reference/ISManageable.ts new file mode 100644 index 0000000..028db6e --- /dev/null +++ b/is-monitor-frontend/src/app/is-model/reference/ISManageable.ts @@ -0,0 +1,3 @@ +export interface ISManageable { + '@class': string; +} diff --git a/is-monitor-frontend/src/app/is-model/reference/entities/Context.ts b/is-monitor-frontend/src/app/is-model/reference/entities/Context.ts new file mode 100644 index 0000000..58f7687 --- /dev/null +++ b/is-monitor-frontend/src/app/is-model/reference/entities/Context.ts @@ -0,0 +1,10 @@ +import { Entity } from './Entity'; +import { IsParentOf } from '../relations/IsParentOf'; + +export interface Context extends Entity { + + name: string; + parent: IsParentOf; + children: Array>; + +} diff --git a/is-monitor-frontend/src/app/is-model/reference/entities/Entity.ts b/is-monitor-frontend/src/app/is-model/reference/entities/Entity.ts new file mode 100644 index 0000000..09e5d69 --- /dev/null +++ b/is-monitor-frontend/src/app/is-model/reference/entities/Entity.ts @@ -0,0 +1,6 @@ +import { ER } from '../ER'; + +// tslint:disable-next-line: no-empty-interface +export interface Entity extends ER { + +} diff --git a/is-monitor-frontend/src/app/is-model/reference/entities/Facet.ts b/is-monitor-frontend/src/app/is-model/reference/entities/Facet.ts new file mode 100644 index 0000000..0b5953a --- /dev/null +++ b/is-monitor-frontend/src/app/is-model/reference/entities/Facet.ts @@ -0,0 +1,6 @@ +import { Entity } from './Entity'; + +// tslint:disable-next-line: no-empty-interface +export interface Facet extends Entity { + +} diff --git a/is-monitor-frontend/src/app/is-model/reference/entities/Resource.ts b/is-monitor-frontend/src/app/is-model/reference/entities/Resource.ts new file mode 100644 index 0000000..050b291 --- /dev/null +++ b/is-monitor-frontend/src/app/is-model/reference/entities/Resource.ts @@ -0,0 +1,11 @@ +import { Entity } from './Entity'; +import { ConsistsOf } from '../relations/ConsistsOf'; +import { IsRelatedTo } from '../relations/IsRelatedTo'; +import { Facet } from './Facet'; + +export interface Resource extends Entity { + + consistsOf: Array>; + isRelatedTo: Array>; + +} diff --git a/is-monitor-frontend/src/app/is-model/reference/properties/Encrypted.ts b/is-monitor-frontend/src/app/is-model/reference/properties/Encrypted.ts new file mode 100644 index 0000000..53f39e2 --- /dev/null +++ b/is-monitor-frontend/src/app/is-model/reference/properties/Encrypted.ts @@ -0,0 +1,5 @@ +import { Property } from './Property'; + +export interface Encrypted extends Property { + value: string; +} diff --git a/is-monitor-frontend/src/app/is-model/reference/properties/Header.ts b/is-monitor-frontend/src/app/is-model/reference/properties/Header.ts new file mode 100644 index 0000000..ef48c31 --- /dev/null +++ b/is-monitor-frontend/src/app/is-model/reference/properties/Header.ts @@ -0,0 +1,9 @@ +import { Property } from './Property'; + +export interface Header extends Property { + 'uuid': string; + 'creator': string; + 'modifiedBy': string; + 'creationTime': string; + 'lastUpdateTime': string; +} diff --git a/is-monitor-frontend/src/app/is-model/reference/properties/PropagationConstraint.ts b/is-monitor-frontend/src/app/is-model/reference/properties/PropagationConstraint.ts new file mode 100644 index 0000000..94242cf --- /dev/null +++ b/is-monitor-frontend/src/app/is-model/reference/properties/PropagationConstraint.ts @@ -0,0 +1,39 @@ +import { Property } from './Property'; + +export enum RemoveConstraint { + + /* + * When the source Entity is removed also the target + * Entity is removed but if and only if the latter has no other + * incoming Relation. + */ + cascadeWhenOrphan, + + /* + * When the source Entity is removed also the target + * Entity is removed. + */ + cascade, + + /* + * When the source Entity is removed the target Entity + * is keep. + */ + keep + +} + +export enum AddConstraint { + + propagate, + + unpropagate + +} + +export interface PropagationConstraint extends Property { + + remove: RemoveConstraint; + add: AddConstraint; + +} diff --git a/is-monitor-frontend/src/app/is-model/reference/properties/Property.ts b/is-monitor-frontend/src/app/is-model/reference/properties/Property.ts new file mode 100644 index 0000000..4b47e47 --- /dev/null +++ b/is-monitor-frontend/src/app/is-model/reference/properties/Property.ts @@ -0,0 +1,6 @@ +import { ISManageable } from '../ISManageable'; + +// tslint:disable-next-line: no-empty-interface +export interface Property extends ISManageable { + +} diff --git a/is-monitor-frontend/src/app/is-model/reference/relations/ConsistsOf.ts b/is-monitor-frontend/src/app/is-model/reference/relations/ConsistsOf.ts new file mode 100644 index 0000000..0ba0650 --- /dev/null +++ b/is-monitor-frontend/src/app/is-model/reference/relations/ConsistsOf.ts @@ -0,0 +1,7 @@ +import { Resource } from '../entities/Resource'; +import { Relation } from './Relation'; +import { Facet } from '../entities/Facet'; + +export interface ConsistsOf extends Relation { + +} diff --git a/is-monitor-frontend/src/app/is-model/reference/relations/IsIdentifiedBy.ts b/is-monitor-frontend/src/app/is-model/reference/relations/IsIdentifiedBy.ts new file mode 100644 index 0000000..01b85bb --- /dev/null +++ b/is-monitor-frontend/src/app/is-model/reference/relations/IsIdentifiedBy.ts @@ -0,0 +1,7 @@ +import { Resource } from '../entities/Resource'; +import { ConsistsOf } from './ConsistsOf'; +import { Facet } from '../entities/Facet'; + +export interface IsIdentifiedBy extends ConsistsOf { + +} diff --git a/is-monitor-frontend/src/app/is-model/reference/relations/IsParentOf.ts b/is-monitor-frontend/src/app/is-model/reference/relations/IsParentOf.ts new file mode 100644 index 0000000..161978b --- /dev/null +++ b/is-monitor-frontend/src/app/is-model/reference/relations/IsParentOf.ts @@ -0,0 +1,7 @@ +import { Context } from '../entities/Context'; +import { Relation } from './Relation'; + +export interface IsParentOf + extends Relation { + +} diff --git a/is-monitor-frontend/src/app/is-model/reference/relations/IsRelatedTo.ts b/is-monitor-frontend/src/app/is-model/reference/relations/IsRelatedTo.ts new file mode 100644 index 0000000..7be3237 --- /dev/null +++ b/is-monitor-frontend/src/app/is-model/reference/relations/IsRelatedTo.ts @@ -0,0 +1,6 @@ +import { Resource } from '../entities/Resource'; +import { Relation } from './Relation'; + +export interface IsRelatedTo extends Relation { + +} diff --git a/is-monitor-frontend/src/app/is-model/reference/relations/Relation.ts b/is-monitor-frontend/src/app/is-model/reference/relations/Relation.ts new file mode 100644 index 0000000..233eac1 --- /dev/null +++ b/is-monitor-frontend/src/app/is-model/reference/relations/Relation.ts @@ -0,0 +1,9 @@ +import { Entity } from '../entities/Entity'; +import { ER } from '../ER'; + +export interface Relation extends ER { + + source: Out; + target: In; + +} diff --git a/is-monitor-frontend/src/app/ISType.ts b/is-monitor-frontend/src/app/is-model/types/TypeDefinition.ts similarity index 77% rename from is-monitor-frontend/src/app/ISType.ts rename to is-monitor-frontend/src/app/is-model/types/TypeDefinition.ts index f24a43a..e0dcfea 100644 --- a/is-monitor-frontend/src/app/ISType.ts +++ b/is-monitor-frontend/src/app/is-model/types/TypeDefinition.ts @@ -1,4 +1,4 @@ -export interface ISType { +export interface TypeDefinition { name: string; description: string | null; abstract: boolean; diff --git a/is-monitor-frontend/src/app/resource-types-tree/resource-types-tree.component.ts b/is-monitor-frontend/src/app/resource-types-tree/resource-types-tree.component.ts index 2cdf7ee..8d686d3 100644 --- a/is-monitor-frontend/src/app/resource-types-tree/resource-types-tree.component.ts +++ b/is-monitor-frontend/src/app/resource-types-tree/resource-types-tree.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { IsService } from '../is.service'; import { Type } from '../type'; -import { ISType } from '../ISType'; +import { TypeDefinition } from '../is-model/types/TypeDefinition'; @Component({ selector: 'app-resource-types-tree', @@ -20,7 +20,7 @@ export class ResourceTypesTreeComponent implements OnInit { this.isService.getResourceTypes(isTypes => { this.resources = this.analyseTypes(isTypes); }); } - analyseUnassociated(type: Type, map: Map, unassociated: Map) { + analyseUnassociated(type: Type, map: Map, unassociated: Map) { const associated: string[] = new Array(); for (const name of unassociated.keys()) { @@ -38,7 +38,7 @@ export class ResourceTypesTreeComponent implements OnInit { } - analyseType(isType: ISType, map: Map, unassociated: Map) { + analyseType(isType: TypeDefinition, map: Map, unassociated: Map) { const type: Type = new Type(isType); @@ -55,10 +55,10 @@ export class ResourceTypesTreeComponent implements OnInit { } } - analyseTypes(isTypes: ISType[]): Type[] { + analyseTypes(isTypes: TypeDefinition[]): Type[] { const map = new Map(); - const unassociated = new Map(); + const unassociated = new Map(); for (const isType of isTypes) { this.analyseType(isType, map, unassociated); diff --git a/is-monitor-frontend/src/app/type.ts b/is-monitor-frontend/src/app/type.ts index 5be4fa4..17a4e57 100644 --- a/is-monitor-frontend/src/app/type.ts +++ b/is-monitor-frontend/src/app/type.ts @@ -1,4 +1,4 @@ -import { ISType } from './ISType'; +import { TypeDefinition } from './ISType'; export class Type { @@ -8,7 +8,7 @@ export class Type { parent: Type; children: Type[]; - constructor(isType: ISType) { + constructor(isType: TypeDefinition) { this.name = isType.name; this.description = isType.description; this.abstract = isType.abstract; diff --git a/is-monitor-frontend/src/app/types.ts b/is-monitor-frontend/src/app/types.ts index c6a72b8..5228884 100644 --- a/is-monitor-frontend/src/app/types.ts +++ b/is-monitor-frontend/src/app/types.ts @@ -1,6 +1,6 @@ -import { ISType } from './ISType'; +import { TypeDefinition } from './ISType'; -export const types: ISType[] = [ +export const types: TypeDefinition[] = [ { "name": "Resource", "description": null,