closes #14 offer different strategies for model constraint violations#27
closes #14 offer different strategies for model constraint violations#27
Conversation
…d destruct if deletion mode is CASCADE
… and delete for different deletion behaviours according to deletion mode
…traint-violations # Conflicts: # projects/emfular/src/lib/referencing/referencable/container/link/re-link-container.ts # projects/emfular/src/lib/referencing/referencable/container/link/re-link-list-container.spec.ts # projects/emfular/src/lib/referencing/referencable/container/link/re-link-list-container.ts # projects/emfular/src/lib/referencing/referencable/container/link/re-link-single-container.ts # projects/emfular/src/lib/referencing/referencable/container/re-container.ts # projects/emfular/src/lib/referencing/referencable/container/shallow/re-tree-parent-container.spec.ts # projects/emfular/src/lib/referencing/referencable/container/shallow/re-tree-parent-container.ts # projects/emfular/src/lib/referencing/referencable/container/tree/re-tree-children-container.ts # projects/emfular/src/lib/referencing/referencable/container/tree/re-tree-list-container.spec.ts # projects/emfular/src/lib/referencing/referencable/container/tree/re-tree-list-container.ts # projects/emfular/src/lib/referencing/referencable/container/tree/re-tree-single-container.spec.ts # projects/emfular/src/lib/referencing/referencable/container/tree/re-tree-single-container.ts # projects/emfular/src/lib/referencing/referencable/referenceable.ts # projects/emfular/src/lib/referencing/test/re-containers-with-single-child.ts # projects/emfular/src/lib/referencing/test/referencables-with-children.ts
|
|
||
| constructor(parent: P, name: string, refMeta: ReferenceMeta) { | ||
| super(parent, name, refMeta); | ||
| constructor(parent: P, name: string, refMeta: ReferenceMeta, isRequired: boolean) { |
There was a problem hiding this comment.
can you please use the refMeta and take the min value ffrom it? if min is 1, then it is reuired - this way, we avoid many actually unnecessary changes. You can still have the private isRequired property and set it inside the constructor - if you want it
| } | ||
|
|
||
| override remove(item: T): boolean { | ||
| override remove(item: T, mode: DeletionMode): boolean { |
There was a problem hiding this comment.
this way, thisis a big breaking change. can you default it?
| }] | ||
| } | ||
| expect(r1.toJson()).toEqual(r1json) | ||
| const json: RootWithChildrenJson = r1.toJson() |
| expect(r1.$otherReferences.length).toBe(1) | ||
| }) | ||
|
|
||
| it('should allow swapping elements in a ModelList created via decorators', () => { |
| }); | ||
|
|
||
|
|
||
| it('should allow flatMap on ModelList proxies (shows proxy behaves like array)', () => { |
…, made DeletionMode argument optional with default mode RELAXED
…traint-violations
There was a problem hiding this comment.
those were the tests that saved the last change we merged, why would you delete them now? is the former mode not available any more? If yes, then we missed sth
There was a problem hiding this comment.
The incompatability stems from the fact that converstation-example.ts uses the old constructors of the containers without refMeta. The plan was to fix this by employing new tests without leveraging KEML, since the EMFular KEML code snippets I copied from the keml.web repo don't use refMeta objects either
…list-proxy deletion methods
-added missing behavior when calling ReTreeListContainer remove with deletion mode -fixed bug where calling destruct with CASCADE and the newly added behavior led to an infinite loop -added ReChild4 as an object with required link for testing -added more exhaustive tests for both deletion modes
|
I originally intended to also add tests for the single versions for tree and link containers but there are no proxy methods available when trying to test on the classes from re-containers-with-single-child.ts that access the deletion functions for said the corresponding containers |
-added deletion modes RELAXED and CASCADE
-added argument mode to remove and deletion methods
-cascade deletes in mode CASCADE even on non-containment relationships, if the deleted reference was flagged as isRequired
-do not cascade deletes in mode RELAXED even on containment relationships and just let children exist without parents