You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.1 KiB
TypeScript

import { Property } from './Property';
type RemoveConstraint = 'cascadeWhenOrphan' | 'cascade' | 'keep';
export const 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: 'cascadeWhenOrphan' as RemoveConstraint,
/*
* When the source Entity is removed also the target
* Entity is removed. */
cascade: 'cascade' as RemoveConstraint,
/*
* When the source Entity is removed the target Entity
* is keep.
*/
keep: 'keep' as RemoveConstraint
};
type AddConstraint = 'propagate' | 'unpropagate';
export const AddConstraint = {
propagate: 'propagate' as AddConstraint,
unpropagate: 'unpropagate' as AddConstraint
};
export class PropagationConstraint extends Property {
remove: RemoveConstraint;
add: AddConstraint;
constructor(remove: RemoveConstraint, add: AddConstraint) {
super();
this.remove = remove;
this.add = add;
}
}