gy-foo
Version:
A library that contains all models for the gy-web-project.
82 lines (81 loc) • 2.81 kB
TypeScript
import { Occurrence } from './occurrence.model';
import { EntityStructure } from './entityStructure.model';
export declare class Entity {
private occs;
private structure;
constructor(entity?: {
structure: EntityStructure;
occs?: Occurrence[];
} | Entity, keepModes?: boolean);
/**
* Checks if entity has the structure of an entity
* @param entity entity to check
*/
static isEntity(entity: Entity): boolean;
/**
* Gets the number of the Occurrences of this Entity
*/
getOccsLength(): number;
/**
* Get all Occurences of this entity.
*/
getOccs(): Occurrence[];
/**
* Sets all Occurrences of the Entity to the given array.
* @param occs array of the new Occurrences
*/
setOccs(occs: Occurrence[]): void;
/**
* Checks if the given occurence is in this Entity
* @param pk the pk of the occurrence
*/
hasOcc(pk: string): boolean;
/**
* Sets the given Occurence on the given value. If pk is missing, the first Occurrence is set.
* @param occ the new Occurrence
* @param pk the pk of the Occurrence
*/
setOcc(occ: Occurrence, pk?: string): void;
/**
* Gets the Occurrence with the given pk, if no pk is given it gets the first Occurence
* @param pk PK of the Occurrence
*/
getOcc(pk?: string): Occurrence;
/**
* Gets the structure of the Entity
*/
getStructure(): EntityStructure;
/**
* Adds an Occurrence to the Entity
* @param occ the new Occurrence
* @param modeFlag decides, if the add mode should be set for occ
* @param isUserChange is that a User Change
* @returns the pk of the new Occ
*/
addOcc(occ?: Occurrence, add?: boolean, isUserChange?: boolean): string;
/**
* Copys an Occurrence to the Entity
* @param pk pk of the occurrence that should be copied
* @param modeFlag decides, if the copy mode should be set for the new occ
* @param isUserChange is this a User Change?
* @returns the pk of the new Occ
*/
copyOcc(pk: string, cpy?: boolean, isUserChange?: boolean): string;
/**
* Adds the Occurrences of an Entity to this Occurrences
* @param entity the Entity that should be added
*/
addEntity(entity: Entity): void;
private convertOccurences;
/**
* Sets the modified flag for all occs in the entity
* @param modified occ is modified?
* @param setSubEntites should the modified flag be set also in the subentites? (default: false)
*/
setModified(modified: boolean, setSubEntites?: boolean): void;
/**
* Has the Entity been modified?
* @param checkSubEnt check Subentities (default: true)
*/
isModified(checkSubEnt?: boolean): boolean;
}