UNPKG

@eclipse-emfcloud/model-service

Version:
69 lines 2.66 kB
"use strict"; // ***************************************************************************** // Copyright (C) 2023-2024 STMicroelectronics. // // This program and the accompanying materials are made available under the // terms of the Eclipse Public License v. 2.0 which is available at // http://www.eclipse.org/legal/epl-2.0. // // This Source Code may also be made available under the following Secondary // Licenses when the conditions for such availability set forth in the Eclipse // Public License v. 2.0 are satisfied: MIT License which is // available at https://opensource.org/licenses/MIT. // // SPDX-License-Identifier: EPL-2.0 OR MIT // ***************************************************************************** Object.defineProperty(exports, "__esModule", { value: true }); exports.AbstractModelServiceContribution = void 0; const nullPersistenceContribution = () => ({ canHandle: () => Promise.resolve(false), async loadModel() { throw new Error("Unsupported operation 'loadModel'"); }, async saveModel() { throw new Error("Unsupported operation 'saveModel'"); }, }); class AbstractModelServiceContribution { /** * Initializes me with my required unique identifier and, optionally, * contribution delegates for persistence support and model validation. */ initialize({ id, persistenceContribution, validationContribution, triggerContribution, modelAccessorContribution, }) { this._id = id; this._persistenceContribution = persistenceContribution ?? nullPersistenceContribution(); this._validationContribution = validationContribution; this._triggerContribution = triggerContribution; this._modelAccessorContribution = modelAccessorContribution; } get id() { return this._id; } get persistenceContribution() { return this._persistenceContribution; } get validationContribution() { return this._validationContribution; } get triggerContribution() { return this._triggerContribution; } get modelAccessorContribution() { return this._modelAccessorContribution; } setModelManager(modelManager) { this.modelManager = modelManager; } setModelHub(modelHub) { this.modelHub = modelHub; } setValidationService(validationService) { this.validationService = validationService; } setModelAccessorBus(modelAccessorBus) { this.modelAccessorBus = modelAccessorBus; } } exports.AbstractModelServiceContribution = AbstractModelServiceContribution; //# sourceMappingURL=model-service-contribution.js.map