コード例 #1
0
 /// <summary>
 /// Generate all
 /// </summary>
 /// <returns></returns>
 public bool Generate()
 {
     // Generate modules
     foreach (string fileName in processFiles)
     {
         GenerateFile(fileName);
     }
     Rep.RefreshModelView(_pkg.PackageID);
     return(true);
 }
コード例 #2
0
        /// <summary>
        /// Import ReqIF Specification
        /// </summary>
        /// <param name="file"></param>
        /// <param name="eaObjectType"></param>
        /// <param name="eaStereotype"></param>
        /// <param name="reqIfContentIndex"></param>
        /// <param name="reqIfSpecIndex"></param>
        /// <param name="stateNew"></param>
        /// <returns></returns>
        private bool ImportSpecification(string file, string eaObjectType, string eaStereotype, int reqIfContentIndex, int reqIfSpecIndex, string stateNew)
        {
            CopyEmbeddedFilesToTarget(file);

            // Deserialize
            ReqIfDeserialized = DeSerializeReqIf(file, validate: Settings.ValidateReqIF);
            if (ReqIfDeserialized == null)
            {
                return(MessageBox.Show("", @"Continue with next reqif file or cancel", MessageBoxButtons.OKCancel) == DialogResult.OK);
            }

            _moduleAttributeDefinitions = GetTypesModule(ReqIfDeserialized, reqIfContentIndex, reqIfSpecIndex);

            // prepare EA, existing requirements to detect deleted and changed requirements
            ReadEaPackageRequirements();
            CreateEaPackageDeletedObjects();


            // Add requirements recursive for module to requirement table
            InitializeReqIfRequirementsTable(ReqIfDeserialized);
            Specification reqIfModule = ReqIfDeserialized.CoreContent[reqIfContentIndex].Specifications[reqIfSpecIndex];

            Rep.BatchAppend     = true;
            Rep.EnableUIUpdates = false;
            UpdatePackage();

            // Read the requirements and put them to data Table
            AddReqIfRequirementsToDataTable(DtRequirements, reqIfModule.Children, 1);

            // Check imported ReqIF requirements
            if (CheckImportedRequirements(file))
            {
                //Rep.RefreshModelView(Pkg.PackageID);
                CreateUpdateDeleteEaRequirements(eaObjectType, eaStereotype, stateNew, "", file);

                //Rep.RefreshModelView(Pkg.PackageID);
                MoveDeletedRequirements();


                // handle links
                ReqIfRelation relations = new ReqIfRelation(ReqIfDeserialized, Rep, Settings);
            }

            Rep.BatchAppend     = false;
            Rep.EnableUIUpdates = true;

            // Update package content
            Rep.ReloadPackage(Pkg.PackageID);
            Rep.RefreshModelView(Pkg.PackageID);
            return(true);
        }
コード例 #3
0
        public override bool ImportForFile(string eaObjectType = "Requirement",
                                           string eaStereotype = "",
                                           string stateNew     = "")
        {
            CountPackage = 0;
            bool result = true;

            _errorMessage1 = false;
            // handle Export fields
            _exportFields = new ExportFields(Settings.WriteAttrNameList);

            _subModuleIndex = 0;


            // decompress reqifz file and its embedded files
            string[] importReqIfFiles = Decompress(ImportModuleFile);
            if (importReqIfFiles.Length == 0)
            {
                return(false);
            }

            // Inventory all reqIf files with their specifications
            ReqIfFileList reqIfFileList = new ReqIfFileList(importReqIfFiles, Settings);

            if (reqIfFileList.ReqIfFileItemList.Count == 0)
            {
                return(false);
            }

            // Check import settings
            if (!CheckImportFile())
            {
                return(false);
            }

            // over all packages/guids
            int packageIndex = 0;

            foreach (var item in Settings.PackageGuidList)
            {
                if (!String.IsNullOrWhiteSpace(item.ReqIfReqIfFleStorage))
                {
                    Settings.EmbeddedFileStorageDictionary = item.ReqIfReqIfFleStorage;
                }
                _prefixTv = Settings.GetPrefixTaggedValueType(packageIndex);

                string pkgGuid     = item.Guid;
                string reqIfSpecId = item.ReqIfModuleId;
                try
                {
                    // Use reqIF Specification ID or iterate by sequence (package index)
                    ReqIfFileItem reqIfFileItem = String.IsNullOrWhiteSpace(reqIfSpecId)
                        ? reqIfFileList.GetItemForIndex(packageIndex)
                        : reqIfFileList.GetItemForReqIfId(reqIfSpecId);
                    // couldn't find a GUID, Error message output
                    if (reqIfFileItem == null)
                    {
                        continue;
                    }

                    // estimate package of guid list in settings
                    Pkg = Rep.GetPackageByGuid(pkgGuid);
                    if (Pkg == null)
                    {
                        MessageBox.Show($@"GUID={pkgGuid}
SpecificationID={reqIfSpecId}
Consider:
- Integrity EA Check + repair
- Compact EA Repository
- Check configuration/package guid

", @"Exception invalid package in configuration, skip package");
                        continue;
                    }
                    try
                    {
                        Rep.RefreshModelView(Pkg.PackageID);
                        Rep.ShowInProjectView(Pkg);
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show($@"GUID={pkgGuid}
SpecificationID={reqIfSpecId}
Consider:
- Integrity EA Check + repair
- Compact EA Repository

{e}", @"Exception import into package");
                        return(false);
                    }


                    ImportSpecification(reqIfFileItem.FilePath, eaObjectType, eaStereotype,
                                        reqIfFileItem.SpecContentIndex, reqIfFileItem.SpecIndex,
                                        stateNew);

                    if (result == false || _errorMessage1)
                    {
                        return(false);
                    }

                    // List all what is done
                    _reqIfLogList.Add(new ReqIfLog(reqIfFileItem.FilePath, Pkg.Name, Pkg.PackageGUID, reqIfSpecId, ""));


                    // next package
                    packageIndex += 1;
                }
                catch (Exception e)
                {
                    MessageBox.Show($@"GUID={pkgGuid}
SpecificationID={reqIfSpecId}

{e}", @"Exception import into package");
                    return(false);
                }
            }
            return(result && (!_errorMessage1));
        }