Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _createCode(name: string): Code {
return new Code({
spec: this._codeSpecId!,
scope: this._physicalModelId!.toString(),
value: name,
});
}
/** Create a geometry stream containing a box */
public static createCode(iModel: IModelDb, scopeModelId: CodeScopeProps, codeValue: string): Code {
const codeSpec: CodeSpec = iModel.codeSpecs.getByName(BisCodeSpec.viewDefinition);
return new Code({ spec: codeSpec.id, scope: scopeModelId, value: codeValue });
}
}
private insertSubject(): Subject {
const root = this._iModelDb.elements.getRootSubject();
const codeSpec: CodeSpec = this._iModelDb.codeSpecs.getByName(BisCodeSpec.subject);
const subjectCode = new Code({
spec: codeSpec.id,
scope: root.id,
value: this._rulesetSubjectName,
});
const subjectProps: SubjectProps = {
classFullName: Subject.classFullName,
model: root.model,
parent: {
id: root.id,
relClassName: "BisCore:SubjectOwnsSubjects",
},
code: subjectCode,
};
const id = this._iModelDb.elements.insertElement(subjectProps);
return this._iModelDb.elements.getElement(id) as Subject;
}
private querySubject(): DefinitionPartition | undefined {
const root = this._iModelDb.elements.getRootSubject();
const codeSpec: CodeSpec = this._iModelDb.codeSpecs.getByName(BisCodeSpec.subject);
const code = new Code({
spec: codeSpec.id,
scope: root.id,
value: this._rulesetSubjectName,
});
try {
return this._iModelDb.elements.getElement(code);
} catch {
return undefined;
}
}