コード例 #1
0
ファイル: FormController.cs プロジェクト: BEXIS2/Core
        private void AdvanceTaskManagerBasedOnExistingMetadata(long MetadataStructureId)
        {
            TaskManager = (CreateTaskmanager)Session["CreateDatasetTaskmanager"];

            MetadataStructureManager metadataStructureManager = new MetadataStructureManager();

            List<MetadataPackageUsage> metadataPackageList = metadataStructureManager.GetEffectivePackages(MetadataStructureId).ToList();

            List<StepModelHelper> stepModelHelperList = new List<StepModelHelper>();
            if (TaskManager.Bus.ContainsKey(CreateTaskmanager.METADATA_STEP_MODEL_HELPER))
            {
                TaskManager.Bus[CreateTaskmanager.METADATA_STEP_MODEL_HELPER] = stepModelHelperList;
            }
            else
            {
                TaskManager.Bus.Add(CreateTaskmanager.METADATA_STEP_MODEL_HELPER, stepModelHelperList);
            }

            TaskManager.StepInfos = new List<StepInfo>();

            foreach (MetadataPackageUsage mpu in metadataPackageList)
            {
                //only add none optional usages
                StepInfo si = new StepInfo(mpu.Label)
                {
                    Id = TaskManager.GenerateStepId(),
                    parentTitle = mpu.MetadataPackage.Name,
                    Parent = TaskManager.Root,
                    IsInstanze = false,
                };

                TaskManager.StepInfos.Add(si);
                StepModelHelper stepModelHelper = new StepModelHelper(si.Id, 1, mpu, "Metadata//" + mpu.Label.Replace(" ", string.Empty) + "[1]", null);

                stepModelHelperList.Add(stepModelHelper);

                si = LoadStepsBasedOnUsage(mpu, si, "Metadata//" + mpu.Label.Replace(" ", string.Empty) + "[1]", stepModelHelper);
                TaskManager.Root.Children.Add(si);

                TaskManager.Bus[CreateTaskmanager.METADATA_STEP_MODEL_HELPER] = stepModelHelperList;

            }

            TaskManager.Bus[CreateTaskmanager.METADATA_STEP_MODEL_HELPER] = stepModelHelperList;
            Session["CreateDatasetTaskmanager"] = TaskManager;
        }
コード例 #2
0
ファイル: TestController.cs プロジェクト: BEXIS2/Core
        private void testMetadataStructure()
        {
            MetadataStructureManager mdsManager = new MetadataStructureManager();
            MetadataPackageManager mdpManager = new MetadataPackageManager();
            MetadataAttributeManager mdaManager = new MetadataAttributeManager();

            MetadataStructure root = mdsManager.Repo.Get(p => p.Name == "Root").FirstOrDefault();
            if (root == null) root = mdsManager.Create("Root", "This is the root metadata structure", "", "", null);

            MetadataStructure s1 = mdsManager.Repo.Get(p => p.Name == "S1").FirstOrDefault();
            if (s1 == null) s1 = mdsManager.Create("S1", "This is S1 metadata structure", "", "", root);

            MetadataStructure s11 = mdsManager.Repo.Get(p => p.Name == "S1.1").FirstOrDefault();
            if (s11 == null) s11 = mdsManager.Create("S1.1", "This is S1.1 metadata structure", "", "", s1);

            MetadataStructure s2 = mdsManager.Repo.Get(p => p.Name == "S2").FirstOrDefault();
            if (s2 == null) s2 = mdsManager.Create("S2", "This is S2 metadata structure", "", "", root);

            MetadataPackage p1 = mdpManager.MetadataPackageRepo.Get(p => p.Name == "P1").FirstOrDefault();
            if (p1 == null) p1 = mdpManager.Create("P1", "Sample Package 1", true);

            MetadataPackage p2 = mdpManager.MetadataPackageRepo.Get(p => p.Name == "P2").FirstOrDefault();
            if (p2 == null) p2 = mdpManager.Create("P2", "Sample Package 2", true);

            MetadataPackage p3 = mdpManager.MetadataPackageRepo.Get(p => p.Name == "P3").FirstOrDefault();
            if (p3 == null) p3 = mdpManager.Create("P3", "Sample Package 3", true);

            MetadataPackage p4 = mdpManager.MetadataPackageRepo.Get(p => p.Name == "P4").FirstOrDefault();
            if (p4 == null) p4 = mdpManager.Create("P4", "Sample Package 4", true);

            if (s1.MetadataPackageUsages.Where(p => p.MetadataPackage == p1).Count() <= 0)
                mdsManager.AddMetadataPackageUsage(s1, p1, "P1 in S1", "", 0, 1);

            if (s1.MetadataPackageUsages.Where(p => p.MetadataPackage == p2).Count() <= 0)
                mdsManager.AddMetadataPackageUsage(s1, p2, "P2 in S1", "", 1, 1);

            if (s11.MetadataPackageUsages.Where(p => p.MetadataPackage == p3).Count() <= 0)
                mdsManager.AddMetadataPackageUsage(s11, p3, "P3 in S1.1", "", 0, 10);

            if (s11.MetadataPackageUsages.Where(p => p.MetadataPackage == p4).Count() <= 0)
                mdsManager.AddMetadataPackageUsage(s11, p4, "P4 in S1.1", "", 2, 5);

            var usages = mdsManager.GetEffectivePackages(3);
        }