How to use the @bentley/imodeljs-common.Code function in @bentley/imodeljs-common

To help you get started, we’ve selected a few @bentley/imodeljs-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / test-apps / agent-test-app / src / changeSetUtility / ChangesetGenerator.ts View on Github external
private _createCode(name: string): Code {
        return new Code({
            spec: this._codeSpecId!,
            scope: this._physicalModelId!.toString(),
            value: name,
        });
    }
    /** Create a geometry stream containing a box */
github imodeljs / imodeljs / core / backend / src / ViewDefinition.ts View on Github external
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 });
  }
}
github imodeljs / imodeljs / presentation / backend / src / RulesetEmbedder.ts View on Github external
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;
  }
github imodeljs / imodeljs / presentation / backend / src / RulesetEmbedder.ts View on Github external
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;
    }
  }