private void convertProject(PKSimProject project) { //We do not know when the project was really created so we simply set the internal version to null project.Creation = _creationMetaDataFactory.Create(); project.Creation.Version = string.Empty; project.Creation.InternalVersion = null; _converted = true; }
private void updateCreationMetaData(IObjectBase newObject) { var withCreationMetaData = newObject as IWithCreationMetaData; if (withCreationMetaData != null) { withCreationMetaData.Creation = _creationMetaDataFactory.Create(); } }
public IMoBiSimulation CreateFrom(IMoBiBuildConfiguration buildConfiguration, IModel model) { var moBiSimulation = new MoBiSimulation() { DiagramManager = _diagramManagerFactory.Create <ISimulationDiagramManager>(), BuildConfiguration = buildConfiguration, Model = model, Creation = _creationMetaDataFactory.Create(), HasChanged = true, Id = _idGenerator.NewId(), }; _simulationParameterOriginIdUpdater.UpdateSimulationId(moBiSimulation); return(moBiSimulation); }
public override async Task <ModelProject> MapToModel(SnapshotProject snapshot, ProjectContext projectContext) { _logger.AddDebug($"Loading project '{snapshot.Name}' from snapshot...", snapshot.Name); var project = new ModelProject { Name = snapshot.Name, Description = snapshot.Description, Creation = _creationMetaDataFactory.Create() }; //The entry point of our context structure. var snapshotContext = new SnapshotContext(project, snapshot.Version); project.Creation.InternalVersion = snapshot.Version; project.Creation.Version = ProjectVersions.FindBy(snapshot.Version)?.VersionDisplay; await allBuildingBlocksFrom(snapshot, snapshotContext); var observedData = await observedDataFrom(snapshot.ObservedData, snapshotContext); observedData?.Each(repository => addObservedDataToProject(project, repository)); var allSimulations = await allSimulationsFrom(project, projectContext, snapshot.Simulations, snapshotContext); allSimulations?.Each(simulation => addSimulationToProject(project, simulation)); var allSimulationComparisons = await allSimulationComparisonsFrom(snapshot.SimulationComparisons, snapshotContext); allSimulationComparisons?.Each(comparison => addComparisonToProject(project, comparison)); var allParameterIdentifications = await allParameterIdentificationsFrom(snapshot.ParameterIdentifications, snapshotContext); allParameterIdentifications?.Each(parameterIdentification => addParameterIdentificationToProject(project, parameterIdentification)); var allQualificationPlans = await allQualificationPlansFrom(snapshot.QualificationPlans, snapshotContext); allQualificationPlans?.Each(qualificationPlan => addQualificationPlanToProject(project, qualificationPlan)); //Map all classifications once project is loaded await updateProjectClassifications(snapshot, snapshotContext); return(project); }
public override async Task <ModelProject> MapToModel(SnapshotProject snapshot) { var project = new ModelProject { Description = snapshot.Description, Creation = _creationMetaDataFactory.Create() }; project.Creation.InternalVersion = snapshot.Version; project.Creation.Version = ProjectVersions.FindBy(snapshot.Version)?.VersionDisplay; var buildingBlocks = await allBuidingBlocksFrom(snapshot); buildingBlocks?.Each(project.AddBuildingBlock); var observedData = await observedDataFrom(snapshot.ObservedData); observedData?.Each(repository => addObservedDataToProject(project, repository)); var allSimulations = await allSmulationsFrom(snapshot.Simulations, project); allSimulations?.Each(simulation => addSimulationToProject(project, simulation)); var allSimulationComparisons = await allSimulationComparisonsFrom(snapshot.SimulationComparisons, project); allSimulationComparisons?.Each(comparison => addComparisonToProject(project, comparison)); var allParameterIdentifications = await allParameterIdentificationsFrom(snapshot.ParameterIdentifications, project); allParameterIdentifications?.Each(parameterIdentification => addParameterIdentificationToProject(project, parameterIdentification)); var allQualificationPlans = await allQualificationPlansFrom(snapshot.QualificationPlans, project); allQualificationPlans?.Each(qualificationPlan => addQualificationPlanToProject(project, qualificationPlan)); //Map all classifications once project is loaded await updateProjectClassifications(snapshot, project); return(project); }