Пример #1
0
        public void GenerateSeedData()
        {
            FeatureManager   featureManager   = new FeatureManager();
            OperationManager operationManager = new OperationManager();

            try
            {
                Feature rootDataToolsFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Data Tools"));
                if (rootDataToolsFeature == null)
                {
                    rootDataToolsFeature = featureManager.Create("Data Tools", "Data Tools");
                }

                Feature luiFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("LUI Tool"));
                if (luiFeature == null)
                {
                    luiFeature = featureManager.Create("LUI Tool", "LUI Tool", rootDataToolsFeature);
                }

                operationManager.Create("LUI", "Main", "*", luiFeature);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                featureManager.Dispose();
                operationManager.Dispose();
            }
        }
        public void GenerateSeedData()
        {
            FeatureManager   featureManager   = new FeatureManager();
            OperationManager operationManager = new OperationManager();

            try
            {
                #region SECURITY

                //Features
                List <Feature> features = featureManager.FeatureRepository.Get().ToList();

                Feature OAIPMH = features.FirstOrDefault(f => f.Name.Equals("OAI-PMH"));
                if (OAIPMH == null)
                {
                    OAIPMH = featureManager.Create("OAI-PMH", "Open Archives Initiative Protocol for Metadata Harvesting ");
                }

                Feature AdminFeature = features.FirstOrDefault(f =>
                                                               f.Name.Equals("Admin") &&
                                                               f.Parent != null &&
                                                               f.Parent.Id.Equals(OAIPMH.Id));

                if (AdminFeature == null)
                {
                    AdminFeature = featureManager.Create("Admin", "Settings and customization of the protocol", OAIPMH);
                }

                Feature ApiFeature = features.FirstOrDefault(f =>
                                                             f.Name.Equals("API") &&
                                                             f.Parent != null &&
                                                             f.Parent.Id.Equals(OAIPMH.Id));

                if (ApiFeature == null)
                {
                    ApiFeature = featureManager.Create("Api", "Api of the OAI PMH", OAIPMH);
                }

                //Operations
                operationManager.Create("OAIPMH", "Admin", "*", OAIPMH);
                operationManager.Create("OAIPMH", "Home", "*", OAIPMH);
                operationManager.Create("API", "oai", "*", OAIPMH);

                var featurePermissionManager = new FeaturePermissionManager();

                if (!featurePermissionManager.Exists(null, ApiFeature.Id, PermissionType.Grant))
                {
                    featurePermissionManager.Create(null, ApiFeature.Id, PermissionType.Grant);
                }

                #endregion SECURITY
            }
            finally
            {
                featureManager.Dispose();
                operationManager.Dispose();
            }
        }
        public void GenerateSeedData()
        {
            #region SECURITY

            OperationManager operationManager = new OperationManager();
            FeatureManager   featureManager   = new FeatureManager();

            try {
                List <Feature> features = featureManager.FeatureRepository.Get().ToList();

                Feature rootResearchAreaFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Research Area Management"));
                if (rootResearchAreaFeature == null)
                {
                    rootResearchAreaFeature = featureManager.Create("Research Area Management", "Research Area Management");
                }


                Feature researchAreasFeature = features.FirstOrDefault(f => f.Name.Equals("Research Areas"));
                if (researchAreasFeature == null)
                {
                    researchAreasFeature = featureManager.Create("Research Areas", "Research Areas", rootResearchAreaFeature);
                }

                Feature researchAreasAdminFeature = features.FirstOrDefault(f => f.Name.Equals("Research Areas Admin"));
                if (researchAreasAdminFeature == null)
                {
                    researchAreasAdminFeature = featureManager.Create("Research Areas Admin", "Research Areas Admin", rootResearchAreaFeature);
                }


                operationManager.Create("PMM", "Main", "*", researchAreasFeature);

                operationManager.Create("PMM", "MainAdmin", "*", researchAreasAdminFeature);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            finally
            {
                operationManager.Dispose();
                featureManager.Dispose();
            }
        }
Пример #4
0
        public ActionResult Subjects_Select(long featureId)
        {
            FeaturePermissionManager featurePermissionManager = null;
            SubjectManager           subjectManager           = null;
            FeatureManager           featureManager           = null;

            try
            {
                featurePermissionManager = new FeaturePermissionManager();
                subjectManager           = new SubjectManager();
                featureManager           = new FeatureManager();

                var feature = featureManager.FindById(featureId);

                var featurePermissions = new List <FeaturePermissionGridRowModel>();

                if (feature == null)
                {
                    return(View(new GridModel <FeaturePermissionGridRowModel> {
                        Data = featurePermissions
                    }));
                }
                var subjects = subjectManager.Subjects.ToList();

                foreach (var subject in subjects)
                {
                    var rightType = featurePermissionManager.GetPermissionType(subject.Id, feature.Id);
                    var hasAccess = featurePermissionManager.HasAccess(subject.Id, feature.Id);

                    featurePermissions.Add(FeaturePermissionGridRowModel.Convert(subject, featureId, rightType, hasAccess));
                }

                return(View(new GridModel <FeaturePermissionGridRowModel> {
                    Data = featurePermissions
                }));
            }
            finally
            {
                featureManager?.Dispose();
                featurePermissionManager?.Dispose();
                subjectManager?.Dispose();
            }
        }
Пример #5
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            var featureManager = new FeatureManager();

            try
            {
                ViewBag.Title = PresentationModel.GetViewTitleForTenant("Manage Features", this.Session.GetTenant());

                var features = featureManager.Features.Select(f => FeatureTreeViewModel.Convert(f, f.Permissions.Any(p => p.Subject == null), f.Parent.Id)).ToList();

                foreach (var feature in features)
                {
                    feature.Children = features.Where(f => f.ParentId == feature.Id).ToList();
                }

                return(View(features.Where(f => f.ParentId == null).AsEnumerable()));
            }
            finally
            {
                featureManager.Dispose();
            }
        }
        public void GenerateSeedData()
        {
            OperationManager operationManager = new OperationManager();
            FeatureManager   featureManager   = new FeatureManager();

            try
            {
                List <Feature> features = featureManager.FeatureRepository.Get().ToList();

                Feature FileManagement = features.FirstOrDefault(f => f.Name.Equals("File Management"));
                if (FileManagement == null)
                {
                    FileManagement = featureManager.Create("File Management", "File Management");
                }

                List <string> controllers = GetController();
                foreach (string c in controllers)
                {
                    Feature feature = features.FirstOrDefault(f => f.Name.Equals(c));
                    if (feature == null)
                    {
                        feature = featureManager.Create(c, c, FileManagement);
                    }

                    operationManager.Create("FMT", c, "*", feature);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            finally
            {
                operationManager.Dispose();
                featureManager.Dispose();
            }
        }
Пример #7
0
        public ActionResult Subjects_Select(GridCommand command, long featureId)
        {
            FeaturePermissionManager featurePermissionManager = null;
            SubjectManager           subjectManager           = null;
            FeatureManager           featureManager           = null;

            try
            {
                featurePermissionManager = new FeaturePermissionManager();
                subjectManager           = new SubjectManager();
                featureManager           = new FeatureManager();

                var feature = featureManager.FindById(featureId);

                var featurePermissions = new List <FeaturePermissionGridRowModel>();

                if (feature == null)
                {
                    return(View(new GridModel <FeaturePermissionGridRowModel> {
                        Data = featurePermissions
                    }));
                }

                var subjects = new List <Subject>();
                int count    = subjectManager.Subjects.Count();
                ViewData["subjectsGridTotal"] = count;
                if (command != null)// filter subjects based on grid filter settings
                {
                    FilterExpression  filter  = TelerikGridHelper.Convert(command.FilterDescriptors.ToList());
                    OrderByExpression orderBy = TelerikGridHelper.Convert(command.SortDescriptors.ToList());

                    subjects = subjectManager.GetSubjects(filter, orderBy, command.Page, command.PageSize, out count);
                }
                else
                {
                    subjects = subjectManager.Subjects.ToList();
                }


                //foreach (var subject in subjects)
                //{
                //    var rightType = featurePermissionManager.GetPermissionType(subject.Id, feature.Id);
                //    var hasAccess = featurePermissionManager.HasAccess(subject.Id, feature.Id);

                //    featurePermissions.Add(FeaturePermissionGridRowModel.Convert(subject, featureId, rightType, hasAccess));
                //}

                var subjectIds        = subjects.Select(s => s.Id);
                var userPermissionDic = featurePermissionManager.GetPermissionType(subjectIds, feature.Id);
                var userHasAccessDic  = featurePermissionManager.HasAccess(subjects, feature.Id);

                foreach (var item in userPermissionDic)
                {
                    var subject   = subjects.Where(s => s.Id.Equals(item.Key)).FirstOrDefault();
                    var rightType = item.Value;
                    var hasAccess = userHasAccessDic[item.Key];

                    featurePermissions.Add(FeaturePermissionGridRowModel.Convert(subject, featureId, rightType, hasAccess));
                }


                return(View(new GridModel <FeaturePermissionGridRowModel> {
                    Data = featurePermissions, Total = count
                }));
            }
            finally
            {
                featureManager?.Dispose();
                featurePermissionManager?.Dispose();
                subjectManager?.Dispose();
            }
        }
Пример #8
0
        public void GenerateSeedData()
        {
            FeatureManager           featureManager           = null;
            FeaturePermissionManager featurePermissionManager = new FeaturePermissionManager();
            OperationManager         operationManager         = new OperationManager();

            try
            {
                featureManager = new FeatureManager();
                List <Feature> features = featureManager.FeatureRepository.Get().ToList();

                Feature dataPlanning = features.FirstOrDefault(f => f.Name.Equals("Data Planning"));
                if (dataPlanning == null)
                {
                    dataPlanning = featureManager.Create("Data Planning", "Data Planning Management");
                }

                Feature datastructureFeature = features.FirstOrDefault(f =>
                                                                       f.Name.Equals("Datastructure Management") &&
                                                                       f.Parent != null &&
                                                                       f.Parent.Id.Equals(dataPlanning.Id));

                if (datastructureFeature == null)
                {
                    datastructureFeature = featureManager.Create("Datastructure Management", "Datastructure Management", dataPlanning);
                }

                if (!operationManager.Exists("RPM", "DataStructureSearch", "*"))
                {
                    operationManager.Create("RPM", "DataStructureSearch", "*", datastructureFeature);
                }

                if (!operationManager.Exists("RPM", "DataStructureEdit", "*"))
                {
                    operationManager.Create("RPM", "DataStructureEdit", "*", datastructureFeature);
                }

                if (!operationManager.Exists("RPM", "Structures", "*"))
                {
                    operationManager.Create("RPM", "Structures", "*", datastructureFeature);
                }

                if (!operationManager.Exists("RPM", "DataStructureIO", "*"))
                {
                    operationManager.Create("RPM", "DataStructureIO", "*", datastructureFeature);
                }

                Feature atributeFeature = features.FirstOrDefault(f =>
                                                                  f.Name.Equals("Variable Template Management") &&
                                                                  f.Parent != null &&
                                                                  f.Parent.Id.Equals(dataPlanning.Id));

                if (atributeFeature == null)
                {
                    atributeFeature = featureManager.Create("Variable Template Management", "Variable Template Management", dataPlanning);
                }
                ;

                if (!operationManager.Exists("RPM", "DataAttribute", "*"))
                {
                    operationManager.Create("RPM", "DataAttribute", "*", atributeFeature);
                }

                Feature unitFeature = features.FirstOrDefault(f =>
                                                              f.Name.Equals("Unit Management") &&
                                                              f.Parent != null &&
                                                              f.Parent.Id.Equals(dataPlanning.Id));

                if (unitFeature == null)
                {
                    unitFeature = featureManager.Create("Unit Management", "Unit Management", dataPlanning);
                }

                if (!operationManager.Exists("RPM", "Unit", "*"))
                {
                    operationManager.Create("RPM", "Unit", "*", unitFeature);
                }

                Feature dataTypeFeature = features.FirstOrDefault(f =>
                                                                  f.Name.Equals("Data Type Management") &&
                                                                  f.Parent != null &&
                                                                  f.Parent.Id.Equals(dataPlanning.Id));

                if (dataTypeFeature == null)
                {
                    dataTypeFeature = featureManager.Create("Data Type Management", "Data Type Management", dataPlanning);
                }

                if (!operationManager.Exists("RPM", "Home", "*"))
                {
                    operationManager.Create("RPM", "Home", "*", dataTypeFeature);
                }

                if (!operationManager.Exists("RPM", "Help", "*"))
                {
                    operationManager.Create("RPM", "Help", "*");
                }


                Feature api = features.FirstOrDefault(f =>
                                                      f.Name.Equals("API") &&
                                                      f.Parent != null &&
                                                      f.Parent.Id.Equals(dataPlanning.Id));

                if (api == null)
                {
                    api = featureManager.Create("API", "API", dataPlanning);
                }

                if (!operationManager.Exists("API", "Structures", "*"))
                {
                    operationManager.Create("API", "Structures", "*", api);
                }

                //set api public
                featurePermissionManager.Create(null, api.Id, Security.Entities.Authorization.PermissionType.Grant);
            }
            finally
            {
                featureManager.Dispose();
                featurePermissionManager.Dispose();
                operationManager.Dispose();
            }

            //create seed data from csv files
            MappingReader    mappingReader    = new MappingReader();
            AttributeCreator attributeCreator = new AttributeCreator();
            string           filePath         = AppConfiguration.GetModuleWorkspacePath("RPM");

            // read data types from csv file
            DataTable mappedDataTypes = mappingReader.readDataTypes(filePath);

            // create read data types in bpp
            attributeCreator.CreateDataTypes(ref mappedDataTypes);

            //// read dimensions from csv file
            DataTable mappedDimensions = mappingReader.readDimensions(filePath);

            // create dimensions in bpp
            attributeCreator.CreateDimensions(ref mappedDimensions);

            //// read units from csv file
            DataTable mappedUnits = mappingReader.readUnits(filePath);

            // create read units in bpp
            attributeCreator.CreateUnits(ref mappedUnits);

            //// read attributes from csv file
            DataTable mappedAttributes = mappingReader.readAttributes(filePath);

            // free memory
            mappedDataTypes.Clear();
            mappedDimensions.Clear();
            // create read attributes in bpp
            attributeCreator.CreateAttributes(ref mappedAttributes);

            createResearchPlan();
            //createSeedDataTypes();
            //createSIUnits();
            //createEmlDatasetAdv();
            //createABCD();


            //ImportSchema("Basic ABCD", "ABCD_2.06.XSD","Dataset","BExIS.Dlm.Entities.Data.Dataset");
            //ImportSchema("Basic Eml", "eml.xsd","dataset","BExIS.Dlm.Entities.Data.Dataset");

            DataStructureManager dsm = null;

            try
            {
                dsm = new DataStructureManager();
                foreach (StructuredDataStructure sds in dsm.StructuredDataStructureRepo.Get())
                {
                    DataStructureIO.convertOrder(sds);
                }
            }
            finally
            {
                dsm.Dispose();
            }
        }
Пример #9
0
        public void GenerateSeedData()
        {
            #region ENTITIES

            List <EntityStruct> entities = new List <EntityStruct>();
            entities.Add(new EntityStruct("SingleResource", typeof(SingleResource), typeof(BExIS.Rbm.Services.Resource.SingleResourceStore)));
            entities.Add(new EntityStruct("ResourceStructure", typeof(ResourceStructure), typeof(BExIS.Rbm.Services.ResourceStructure.ResourceStructureStore)));
            entities.Add(new EntityStruct("ResourceStructureAttribute", typeof(ResourceStructureAttribute), typeof(BExIS.Rbm.Services.ResourceStructure.ResourceStructureAttributeStore)));
            entities.Add(new EntityStruct("Activity", typeof(Activity), typeof(BExIS.Rbm.Services.Booking.ActivityStore)));
            entities.Add(new EntityStruct("BookingEvent", typeof(BookingEvent), typeof(BExIS.Rbm.Services.Booking.BookingEventStore)));
            entities.Add(new EntityStruct("Notification", typeof(Notification), typeof(BExIS.Rbm.Services.Booking.NotificationStore)));
            entities.Add(new EntityStruct("Schedule", typeof(Schedule), typeof(BExIS.Rbm.Services.Booking.ScheduleStore)));



            Dictionary <string, Type> rbmEntities = new Dictionary <string, Type>();
            rbmEntities.Add("SingleResource", typeof(SingleResource));
            rbmEntities.Add("ResourceStructure", typeof(ResourceStructure));
            rbmEntities.Add("ResourceStructureAttribute", typeof(ResourceStructureAttribute));
            rbmEntities.Add("Activity", typeof(Activity));
            rbmEntities.Add("BookingEvent", typeof(BookingEvent));
            rbmEntities.Add("Notification", typeof(Notification));
            rbmEntities.Add("Schedule", typeof(Schedule));

            using (var entityManager = new EntityManager())
            {
                foreach (var et in entities)
                {
                    Entity entity = entityManager.Entities.Where(e => e.Name.ToUpperInvariant() == et.Name.ToUpperInvariant()).FirstOrDefault();

                    if (entity == null)
                    {
                        entity                 = new Entity();
                        entity.Name            = et.Name;
                        entity.EntityType      = et.Type;
                        entity.EntityStoreType = et.StoreType;
                        //entity.UseMetadata = true;
                        entity.Securable = true;
                        entityManager.Create(entity);
                    }
                }
            }

            try
            {
                ResourceStructureAttribute rsa = new ResourceStructureAttribute();
                using (var rsaManager = new ResourceStructureAttributeManager())
                    rsa = rsaManager.CreateResourceStructureAttribute("Exploratory", "Biodiversity Exploratories funded by DFG Priority Programme 1374. They serve as open research platform for all biodiversity and ecosystem research groups of Germany.");

                var dcManager = new DataContainerManager();

                string[]          keys        = { "Hainich-Dün", "Schorfheide-Chorin", "Schwäbische Alb" };
                List <DomainItem> domainItems = CreateDomainItems(keys);
                DomainConstraint  dc          = new DomainConstraint(ConstraintProviderSource.Internal, "", "en-US", "a simple domain validation constraint", false, null, null, null, domainItems);
                dcManager.AddConstraint(dc, rsa);


                ResourceStructureAttribute rsa2 = new ResourceStructureAttribute();
                using (var rsaManager2 = new ResourceStructureAttributeManager())
                    rsa2 = rsaManager2.CreateResourceStructureAttribute("Type", "Type of resource.");

                var dcManager2 = new DataContainerManager();

                string[]          keys2        = { "Area", "Equipment", "Sleeping place" };
                List <DomainItem> domainItems2 = CreateDomainItems(keys2);
                DomainConstraint  dc2          = new DomainConstraint(ConstraintProviderSource.Internal, "", "en-US", "a simple domain validation constraint", false, null, null, null, domainItems2);
                dcManager2.AddConstraint(dc2, rsa2);

                ResourceStructureAttribute rsa3 = new ResourceStructureAttribute();
                using (var rsaManager3 = new ResourceStructureAttributeManager())
                    rsa3 = rsaManager3.CreateResourceStructureAttribute("Information File", "Important information as file");

                ResourceStructureManager rsManager = new ResourceStructureManager();;
                ResourceStructure        rs        = rsManager.Create("Explo resources", "Resources related to exploratories.", null, null);

                using (var rsaManager = new ResourceStructureAttributeManager())
                    rsaManager.CreateResourceAttributeUsage(rsa, rs, true, false);
                using (var rsaManager = new ResourceStructureAttributeManager())
                    rsaManager.CreateResourceAttributeUsage(rsa2, rs, true, false);

                using (var rsaManager = new ResourceStructureAttributeManager())
                    rsaManager.CreateResourceAttributeUsage(rsa3, rs, true, true);

                ActivityManager aManager = new ActivityManager();
                aManager.CreateActivity("Adding of material (litter, dead wood, chemicals ....)", "", false);
                aManager.CreateActivity("Adding of organisms (seeds and others)", "", false);
                aManager.CreateActivity("Conference", "", false);
                aManager.CreateActivity("Contact stakeholder", "", false);
                aManager.CreateActivity("Dismantling of experiments", "", false);
                aManager.CreateActivity("Installation of equipment remaining for some time", "", false);
                aManager.CreateActivity("Measuring and marking of subplots/experiments/study organisms", "", false);
                aManager.CreateActivity("Observation/capture of organisms without removal", "", false);
                aManager.CreateActivity("Plot maintenance", "", false);
                aManager.CreateActivity("Removal of org. material without killing", "", false);
                aManager.CreateActivity("Removal of organisms", "", false);
                aManager.CreateActivity("Removal of soil samples", "", false);
                aManager.CreateActivity("Visit without activity", "", false);

                ResourceManager             rManager = new ResourceManager();;
                List <newResourceStructure> rs_new   = new List <newResourceStructure>();

                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all EPs (SCH)", color = "#ec5959", description = "Visit of all forest EPs in Schorfheide-Chorin", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all MIPs (SCH)", color = "#ec5959", description = "Visit of all forest MIPs in Schorfheide-Chorin", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all VIPs (SCH)", color = "#ec5959", description = "Visit of all forest VIPs in Schorfheide-Chorin", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Altenhof", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Arnimswalde", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Chorin", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Eichheide", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Glambeck", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Liepe", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Maienpfuhl", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Melzow", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Poratz", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Ringenwalde", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Senftenthal", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Theerofen", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Voigtswiese", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - Forstgut Altkuenkendorf", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - Fuerstliche Forstverwaltung Oettingen-Spielberg", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - Stiftung Schorfheide-Chorin", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - FOX (SCH)", color = "#ec5959", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - RP/UP (SCH)", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - ABP Landwirtschaft Neugrimnitz GmbH", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AEVG Stegelitz-Flieth", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Agrargemeinschaft Greiffenberg GmbH", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all EPs (SCH)", color = "#ff0000", description = "Visit of all grassland EPs in Schorfheide-Chorin", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all MIPs (SCH)", color = "#ff0000", description = "Visit of all grassland MIPs in Schorfheide-Chorin", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all VIPs (SCH)", color = "#ff0000", description = "Visit of all grassland VIPs in Schorfheide-Chorin", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Gut Biesenbrow", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Ingolf Limber", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Lehrschaeferei Friedrichsfelde", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - LW-Betrieb Haferkamp", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Naturrind GmbH Boeckenberg", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Reiner Wegner", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Weidewirtschaft Liepe", color = "#ff0000", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "no plot visit (SCH)", color = "#e28f8f", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schorfheide-Chorin"
                });


                rs_new.Add(new newResourceStructure()
                {
                    name = "Sleeping place (SCH)", color = "#9c3939", description = "Sleeping places in Schorfheide-Chorin", duration = 1, quantity = 8, withActivity = false, resourceStructure = rs, type = "Sleeping place", explo = "Schorfheide-Chorin"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Drying cabinet (SCH)", color = "#940b0b", description = "Drying cabinet in Schorfheide-Chorin", duration = 1, quantity = 5, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Fridge (SCH)", color = "#940b0b", description = "Fridge in Schorfheide-Chorin", duration = 1, quantity = 2, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Freezer (SCH)", color = "#940b0b", description = "Freezer in Schorfheide-Chorin", duration = 1, quantity = 2, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Metal detector (Magna Trak 100) (SCH)", color = "#940b0b", description = "Metal detector (Magna Trak 100) in Schorfheide-Chorin", duration = 1, quantity = 1, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Binocular (SCH)", color = "#940b0b", description = "", duration = 1, quantity = 1, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Chest freezer (SCH)", color = "#940b0b", description = "", duration = 1, quantity = 1, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schorfheide-Chorin"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Helmet (SCH)", color = "#940b0b", description = "", duration = 1, quantity = 8, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schorfheide-Chorin"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all EPs (HAI)", color = "#8cca0d", description = "Visit of all forest EPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all GPs (HAI)", color = "#8cca0d", description = "Visit of all forestGPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all MIPs (HAI)", color = "#8cca0d", description = "Visit of all forest MIPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all VIPs (HAI)", color = "#8cca0d", description = "Visit of all forest VIPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - FOX (HAI)", color = "8cca0d", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Anrode", color = "#8cca0d", description = "Forest - district Anrode", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - city of Mühlhausen", color = "#8cca0d", description = "Forest - city of Mühlhausen", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Behringen", color = "#8cca0d", description = "Forest - district Behringen", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Geney", color = "#8cca0d", description = "Forest - district Geney", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Keula", color = "#8cca0d", description = "Forest - district Keula", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Langula", color = "#8cca0d", description = "Forest - district Langula", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Sollstedt", color = "#8cca0d", description = "Forest - district Sollstedt", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Zehnsberg", color = "#8cca0d", description = "Forest - district Zehnsberg", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - national park", color = "#8cca0d", description = "Forest - national park", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - national park Weberstedterholz (core zone)", color = "#8cca0d", description = "Forest - national park Weberstedterholz (core zone)", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - district Westerwald", color = "#8cca0d", description = "Forest - district Westerwald", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all GPs (HAI)", color = "#9acd32", description = "Visit of all grassland GPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all EPs (HAI)", color = "#9acd32", description = "Visit of all grassland EPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all MIPs (HAI)", color = "#9acd32", description = "Visit of all grassland MIPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all VIPs (HAI)", color = "#9acd32", description = "Visit of all grassland VIPs in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - RP/UP (HAI)", color = "9acd32", description = "Visit of all new landuse experiment plots in HAI (HEG1,2,3,6,14,15)", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });


                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Diedorf", color = "#9acd32", description = "Grassland - AG Diedorf", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Großenlupnitz", color = "#9acd32", description = "Grassland - AG Großenlupnitz", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Kirchheiligen", color = "#9acd32", description = "Grassland - AG Kirchheiligen", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Bollstedt", color = "#9acd32", description = "Grassland - AG Bollstedt", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Lengefeld", color = "#9acd32", description = "Grassland - AG Lengefeld", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Mülverstedt", color = "#9acd32", description = "Grassland - AG Mülverstedt", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Wartburgblick", color = "#9acd32", description = "Grassland - AG Wartburgblick", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG Wenigenlupnitz", color = "#9acd32", description = "Grassland - AG Wenigenlupnitz", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - AG-Struth-Eigenrieden", color = "#9acd32", description = "Grassland - AG-Struth-Eigenrieden", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - BEAG/TOA", color = "#9acd32", description = "Grassland - BEAG/TOA", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Bundesforst Dörnaerplatz", color = "#9acd32", description = "Grassland - Bundesforst Dörnaerplatz", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Gut Sambach", color = "#9acd32", description = "Grassland - Gut Sambach", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Thüringen Wagyu Becker&Becker", color = "#9acd32", description = "Grassland - Thüringen Wagyu Becker&Becker", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Heller", color = "#9acd32", description = "Grassland - Heller", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Schaeferei Effenberger", color = "#9acd32", description = "Grassland - Schaeferei Effenberger", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Nationalpark", color = "#9acd32", description = "Grassland - Nationalpark", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Nordagrar (Naturrind Unstruttal)", color = "#9acd32", description = "Grassland - Nordagrar (Naturrind Unstruttal)", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Schaeferei Goepfert", color = "#9acd32", description = "Grassland - Schaeferei Goepfert", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Börner", color = "#9acd32", description = "Grassland - Börner", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - Strewe-Winterberg", color = "#9acd32", description = "Grassland - Strewe-Winterberg", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - TUPAG (Hainich Weiderind)", color = "#9acd32", description = "Grassland - TUPAG (Hainich Weiderind)", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "no plot visit", color = "#a9fb00", description = "No plot visit in Hainich-Dün", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Hainich-Dün"
                });


                rs_new.Add(new newResourceStructure()
                {
                    name = "Sleeping place (HAI)", color = "#78ab0f", description = "Sleeping place in Hainich-Dün", duration = 1, quantity = 8, withActivity = false, resourceStructure = rs, type = "Sleeping place", explo = "Hainich-Dün"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Drying cabinet (HAI)", color = "#6a8a27", description = "Drying cabinete in Hainich-Dün", duration = 1, quantity = 4, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Fridge (HAI)", color = "#6a8a27", description = "Fridge in Hainich-Dün", duration = 1, quantity = 2, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Freezer (HAI)", color = "#6a8a27", description = "Freezer in Hainich-Dün", duration = 1, quantity = 3, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Metal detector (Magna Trak 100) (HAI)", color = "#6a8a27", description = "Metal detector (Magna Trak 100) in Hainich-Dün", duration = 1, quantity = 1, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Hainich-Dün"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Metal detector (Garrett ACE  150) (HAI)", color = "#6a8a27", description = "Metal detector (Garrett ACE  150) in Hainich-Dün", duration = 1, quantity = 1, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Hainich-Dün"
                });


                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - all EPs (ALB)", color = "#3a75e0", description = "Visit of all forest EPs in Schwäbische Alb", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - VIP AEW1-8 (ALB)", color = "#3a75e0", description = "Visit of all VIP AEW1-8 in Schwäbische Alb", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - VIP AEW9 (Alb)", color = "#3a75e0", description = "Visit of all VIP AEW9 in Schwäbische Alb", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Forest - FOX (ALB)", color = "#3a75e0", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });


                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all EPs excluding former military training area", color = "#6495ed", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all EPs including former military training area", color = "#6495ed", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - all VIPs (ALB)", color = "#6495ed", description = "Visit of all grassland VIPs in Schwäbische Alb", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Grassland - RP/UP (ALB)", color = "#6495ed", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });


                rs_new.Add(new newResourceStructure()
                {
                    name = "no plot visit (ALB)", color = "#0057f5", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "total Exploratory outside EP", color = "#0057f6", description = "", duration = 1, quantity = 0, withActivity = true, resourceStructure = rs, type = "Area", explo = "Schwäbische Alb"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Sleeping place (ALB)", color = "#27509a", description = "Sleeping places in Schwäbische Alb", duration = 1, quantity = 8, withActivity = false, resourceStructure = rs, type = "Sleeping place", explo = "Schwäbische Alb"
                });

                rs_new.Add(new newResourceStructure()
                {
                    name = "Drying cabinet (ALB)", color = "#7e95bf", description = "Drying cabinet in Schwäbische Alb", duration = 1, quantity = 5, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Binocular (ALB)", color = "#7e95bf", description = "", duration = 1, quantity = 1, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schwäbische Alb"
                });
                rs_new.Add(new newResourceStructure()
                {
                    name = "Metal detector (Magna Trak 100) (ALB)", color = "#7e95bf", description = "Metal detector (Magna Trak 100) in Schwäbische Alb", duration = 1, quantity = 1, withActivity = false, resourceStructure = rs, type = "Equipment", explo = "Schwäbische Alb"
                });

                //get/create admin group for entity rights
                using (var groupManager = new GroupManager())
                    using (var permissionManager = new EntityPermissionManager())
                        using (var entityManager = new EntityManager())
                            using (var valueManager = new ResourceStructureAttributeManager())
                            {
                                var adminGroup = groupManager.Groups.Where(r => r.Name == "administrator").FirstOrDefault();
                                if (adminGroup == null)
                                {
                                    // create new group
                                    adminGroup = new Group
                                    {
                                        Name          = "administrator",
                                        Description   = "administrator",
                                        DisplayName   = "administrator",
                                        IsSystemGroup = false,
                                        IsValid       = true
                                    };

                                    groupManager.CreateAsync(adminGroup).Wait();
                                }

                                //create right type
                                int rights = (int)RightType.Read + (int)RightType.Write + (int)RightType.Delete + (int)RightType.Grant;

                                foreach (newResourceStructure rs_item in rs_new)
                                {
                                    var duration = new TimeDuration();
                                    duration.Value = rs_item.duration;
                                    var resource = rManager.CreateResource(rs_item.name, rs_item.description, rs_item.quantity, rs_item.color, rs_item.withActivity, rs_item.resourceStructure, duration);

                                    //add entity rights
                                    permissionManager.Create(adminGroup,
                                                             entityManager.FindByName("SingleResource"),
                                                             resource.Id,
                                                             rights
                                                             );

                                    ResourceAttributeUsage usage = valueManager.GetResourceAttributeUsageById(1);
                                    valueManager.CreateResourceAttributeValue(rs_item.explo, rManager.GetResourceById(resource.Id), usage);
                                    ResourceAttributeUsage usage2 = valueManager.GetResourceAttributeUsageById(2);
                                    valueManager.CreateResourceAttributeValue(rs_item.type, rManager.GetResourceById(resource.Id), usage2);
                                }
                            }
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }
            #endregion

            #region SECURITY

            OperationManager operationManager = new OperationManager();
            FeatureManager   featureManager   = new FeatureManager();

            try
            {
                List <Feature> features = featureManager.FeatureRepository.Get().ToList();

                Feature ResourceBooking = features.FirstOrDefault(f => f.Name.Equals("Resource Booking"));
                if (ResourceBooking == null)
                {
                    ResourceBooking = featureManager.Create("Resource Booking", "Resource Booking");
                }

                Feature NotificationBlackboard = features.FirstOrDefault(f => f.Name.Equals("Notification Blackboard"));
                if (NotificationBlackboard == null)
                {
                    NotificationBlackboard = featureManager.Create("Notification Blackboard", "Notification Blackboard", ResourceBooking);
                }


                Feature ResourceAdmin = features.FirstOrDefault(f => f.Name.Equals("Resource Administration"));
                if (ResourceAdmin == null)
                {
                    ResourceAdmin = featureManager.Create("Resource Administration", "Resource Administration");
                }

                Feature ResourceManagement = features.FirstOrDefault(f => f.Name.Equals("Resource Management"));
                if (ResourceManagement == null)
                {
                    ResourceManagement = featureManager.Create("Resource Management", "Resource Management", ResourceAdmin);
                }

                Feature ResourceStructureManagement = features.FirstOrDefault(f => f.Name.Equals("Resource Structure Management"));
                if (ResourceStructureManagement == null)
                {
                    ResourceStructureManagement = featureManager.Create("Resource Structure Management", "Resource Structure Management", ResourceAdmin);
                }

                Feature ResourceStructureAttributeManagement = features.FirstOrDefault(f => f.Name.Equals("Resource Structure Attribute Management"));
                if (ResourceStructureAttributeManagement == null)
                {
                    ResourceStructureAttributeManagement = featureManager.Create("Resource Structure Attribute Management", "Resource Structure Attribute Management", ResourceAdmin);
                }

                Feature NotificationManagement = features.FirstOrDefault(f => f.Name.Equals("Notification Management"));
                if (NotificationManagement == null)
                {
                    NotificationManagement = featureManager.Create("Notification Management", "Notification Management", ResourceAdmin);
                }

                Feature ActivityManagement = features.FirstOrDefault(f => f.Name.Equals("Activity Management"));
                if (ActivityManagement == null)
                {
                    ActivityManagement = featureManager.Create("Activity Management", "Activity Management", ResourceAdmin);
                }


                operationManager.Create("RBM", "Schedule", "*", ResourceBooking);
                operationManager.Create("RBM", "Calendar", "*", ResourceBooking);
                operationManager.Create("RBM", " NotificationBlackboard", "*", NotificationBlackboard);



                operationManager.Create("RBM", "Resource", "*", ResourceManagement);
                operationManager.Create("RBM", "ResourceStructure", "*", ResourceStructureManagement);
                operationManager.Create("RBM", "ResourceStructure", "*", ResourceStructureAttributeManagement);
                operationManager.Create("RBM", "Notification", "*", NotificationManagement);
                operationManager.Create("RBM", "Activity", "*", ActivityManagement);

                #region Help Workflow

                if (!operationManager.Exists("RBM", "help", "*"))
                {
                    operationManager.Create("RBM", "Help", "*");
                }

                #endregion Help Workflow
            }
            catch (Exception ex)
            {
                throw ex;
            }

            finally
            {
                operationManager.Dispose();
                featureManager.Dispose();
            }

            #endregion
        }
Пример #10
0
        public void GenerateSeedData()
        {
            ResearchPlanManager      researchPlanManager      = new ResearchPlanManager();
            DataStructureManager     dataStructureManager     = new DataStructureManager();
            UnitManager              unitManager              = new UnitManager();
            EntityManager            entityManager            = new EntityManager();
            FeatureManager           featureManager           = new FeatureManager();
            OperationManager         operationManager         = new OperationManager();
            MetadataStructureManager metadataStructureManager = new MetadataStructureManager();

            try
            {
                #region create none researchPlan

                if (!researchPlanManager.Repo.Get().Any(r => r.Title.Equals("none")))
                {
                    researchPlanManager.Create("none", "If no research plan is used.");
                }

                #endregion create none researchPlan

                #region create none structure

                if (!dataStructureManager.AllTypesDataStructureRepo.Get().Any(d => d.Name.Equals("none")))
                {
                    dataStructureManager.CreateUnStructuredDataStructure("none", "If no data strutcure is used.");
                }

                #endregion create none structure

                #region create none unit

                Dimension dimension = null;

                if (!unitManager.DimensionRepo.Get().Any(d => d.Name.ToLower().Equals("none")))
                {
                    dimension = unitManager.Create("none", "none", "If no unit is used."); // the null dimension should be replaced bz a proper valid one. Javad 11.06
                }
                else
                {
                    dimension = unitManager.DimensionRepo.Get().Where(d => d.Name.ToLower().Equals("none")).FirstOrDefault();
                }

                if (!unitManager.Repo.Get().Any(u => u.Name.ToLower().Equals("none")))
                {
                    unitManager.Create("none", "none", "If no unit is used.", dimension, MeasurementSystem.Unknown);
                }

                #endregion create none unit

                #region create entities

                // Entities
                Entity entity = entityManager.Entities.Where(e => e.Name.ToUpperInvariant() == "Dataset".ToUpperInvariant()).FirstOrDefault();

                if (entity == null)
                {
                    entity                 = new Entity();
                    entity.Name            = "Dataset";
                    entity.EntityType      = typeof(Dataset);
                    entity.EntityStoreType = typeof(Xml.Helpers.DatasetStore);
                    entity.UseMetadata     = true;
                    entity.Securable       = true;

                    //add to Extra

                    XmlDocument      xmlDoc           = new XmlDocument();
                    XmlDatasetHelper xmlDatasetHelper = new XmlDatasetHelper();
                    xmlDatasetHelper.AddReferenceToXml(xmlDoc, AttributeNames.name.ToString(), "ddm", AttributeType.parameter.ToString(), "extra/modules/module");

                    entity.Extra = xmlDoc;

                    entityManager.Create(entity);
                }
                else
                {
                    XmlDocument xmlDoc = new XmlDocument();

                    if (entity.Extra != null)
                    {
                        xmlDoc.AppendChild(entity.Extra);
                    }

                    //update to Extra
                    XmlDatasetHelper xmlDatasetHelper = new XmlDatasetHelper();
                    xmlDatasetHelper.AddReferenceToXml(xmlDoc, AttributeNames.name.ToString(), "ddm", AttributeType.parameter.ToString(), "extra/modules/module");

                    entity.Extra = xmlDoc;

                    entityManager.Update(entity);
                }

                #endregion create entities

                #region SECURITY

                //workflows = größere sachen, vielen operation
                //operations = einzelne actions

                //1.controller-> 1.Operation

                Feature DataCollectionFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Data Collection"));
                if (DataCollectionFeature == null)
                {
                    DataCollectionFeature = featureManager.Create("Data Collection", "Data Collection");
                }

                Feature DatasetCreationFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Data Creation"));
                if (DatasetCreationFeature == null)
                {
                    DatasetCreationFeature = featureManager.Create("Data Creation", "Data Creation", DataCollectionFeature);
                }

                Feature DatasetUploadFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Dataset Upload"));
                if (DatasetUploadFeature == null)
                {
                    DatasetUploadFeature = featureManager.Create("Dataset Upload", "Dataset Upload", DataCollectionFeature);
                }

                Feature ImportDataFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Import Data"));
                if (ImportDataFeature == null)
                {
                    ImportDataFeature = featureManager.Create("Import Data", "Easy way to load data into bexis", DataCollectionFeature);
                }

                Feature MetadataManagementFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Metadata Management"));
                if (MetadataManagementFeature == null)
                {
                    MetadataManagementFeature = featureManager.Create("Metadata Management", "Metadata Management", DataCollectionFeature);
                }

                #region Help Workflow

                operationManager.Create("DCM", "Help", "*");

                #endregion Help Workflow

                #region Create Dataset Workflow

                operationManager.Create("DCM", "CreateDataset", "*", DatasetCreationFeature);
                operationManager.Create("DCM", "Form", "*");
                operationManager.Create("Api", "DatasetIn", "*", DatasetCreationFeature);
                operationManager.Create("Api", "Dataset", "*", DatasetCreationFeature);
                operationManager.Create("Api", "MetadataIn", "*", DatasetCreationFeature);
                operationManager.Create("Api", "Metadata", "*", DatasetCreationFeature);

                #endregion Create Dataset Workflow

                #region Update Dataset Workflow

                operationManager.Create("DCM", "Submit", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "SubmitChooseUpdateMethod", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "SubmitGetFileInformation", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "SubmitSelectAFile", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "SubmitSpecifyDataset", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "SubmitSummary", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "SubmitValidation", "*", DatasetUploadFeature);

                //Load files to server
                operationManager.Create("DCM", "Push", "*", DatasetUploadFeature);

                operationManager.Create("Api", "DataIn", "*", DatasetUploadFeature);
                operationManager.Create("Api", "Data", "*", DatasetUploadFeature);
                operationManager.Create("Api", "AttachmentIn", "*", DatasetUploadFeature);
                operationManager.Create("Api", "Attachment", "*", DatasetUploadFeature);

                #endregion Update Dataset Workflow

                #region Easy Upload

                operationManager.Create("DCM", "EasyUpload", "*", ImportDataFeature);
                operationManager.Create("DCM", "EasyUploadSelectAFile", "*", ImportDataFeature);
                operationManager.Create("DCM", "EasyUploadSelectAreas", "*", ImportDataFeature);
                operationManager.Create("DCM", "EasyUploadSheetDataStructure", "*", ImportDataFeature);
                operationManager.Create("DCM", "EasyUploadSheetSelectMetaData", "*", ImportDataFeature);
                operationManager.Create("DCM", "EasyUploadSummary", "*", ImportDataFeature);
                operationManager.Create("DCM", "EasyUploadVerification", "*", ImportDataFeature);

                #endregion Easy Upload

                #region Metadata Managment Workflow

                operationManager.Create("DCM", "ImportMetadataStructure", "*", MetadataManagementFeature);
                operationManager.Create("DCM", "ImportMetadataStructureReadSource", "*", MetadataManagementFeature);
                operationManager.Create("DCM", "ImportMetadataStructureSelectAFile", "*", MetadataManagementFeature);
                operationManager.Create("DCM", "ImportMetadataStructureSetParameters", "*", MetadataManagementFeature);
                operationManager.Create("DCM", "ImportMetadataStructureSummary", "*", MetadataManagementFeature);
                operationManager.Create("DCM", "ManageMetadataStructure", "*", MetadataManagementFeature);
                operationManager.Create("DCM", "SubmitSpecifyDataset", "*", MetadataManagementFeature);

                #endregion Metadata Managment Workflow

                #region public available

                //because of reuse in ddm this controller must be public
                // but the funktions should be secured
                operationManager.Create("DCM", "Form", "*");
                operationManager.Create("DCM", "EntityReference", "*");
                //Attachments
                operationManager.Create("DCM", "Attachments", "*");

                #endregion public available

                #endregion SECURITY

                #region Add Metadata


                if (!metadataStructureManager.Repo.Get().Any(m => m.Name.Equals("Basic ABCD")))
                {
                    string titleXPath =
                        "Metadata/Metadata/MetadataType/Description/DescriptionType/Representation/MetadataDescriptionRepr/Title/TitleType";
                    string descriptionXpath =
                        "Metadata/Metadata/MetadataType/Description/DescriptionType/Representation/MetadataDescriptionRepr/Details/DetailsType";

                    ImportSchema("Basic ABCD", "ABCD_2.06.XSD", "DataSet", entity.Name, entity.EntityType.FullName,
                                 titleXPath, descriptionXpath);
                }

                //if (!metadataStructureManager.Repo.Get().Any(m => m.Name.Equals("Full ABCD")))
                //{
                //    string titleXPath =
                //        "Metadata/Metadata/MetadataType/Description/DescriptionType/Representation/MetadataDescriptionRepr/Title/TitleType";
                //    string descriptionXpath =
                //        "Metadata/Metadata/MetadataType/Description/DescriptionType/Representation/MetadataDescriptionRepr/Details/DetailsType";

                //    ImportSchema("Full ABCD", "ABCD_2.06.XSD", "DataSet", entity.Name, entity.EntityType.FullName,
                //        titleXPath, descriptionXpath);

                //}

                if (!metadataStructureManager.Repo.Get().Any(m => m.Name.Equals("GBIF")))
                {
                    string titleXPath       = "Metadata/Basic/BasicType/title/titleType";
                    string descriptionXpath = "Metadata/abstract/abstractType/para/paraType";

                    ImportSchema("GBIF", "eml.xsd", "Dataset", entity.Name, entity.EntityType.FullName, titleXPath,
                                 descriptionXpath);
                }
                //if (!metadataStructureManager.Repo.Get().Any(m => m.Name.Equals("Basic Eml")))
                //    ImportSchema("Basic Eml", "eml-dataset.xsd", entity.Name, entity.Name, entity.EntityType.FullName);

                #endregion Add Metadata
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                researchPlanManager.Dispose();
                dataStructureManager.Dispose();
                unitManager.Dispose();
                entityManager.Dispose();
                featureManager.Dispose();
                operationManager.Dispose();
                metadataStructureManager.Dispose();
            }
        }
Пример #11
0
        public void GenerateSeedData()
        {
            SubmissionManager submissionManager = new SubmissionManager();
            FeatureManager    featureManager    = new FeatureManager();
            OperationManager  operationManager  = new OperationManager();

            try
            {
                #region SECURITY

                //workflows = größere sachen, vielen operation
                //operations = einzelne actions

                //1.controller -> 1.Operation



                Feature DataDissemination =
                    featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Data Dissemination"));
                if (DataDissemination == null)
                {
                    DataDissemination = featureManager.Create("Data Dissemination", "Data Dissemination");
                }

                Feature Mapping = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Mapping"));
                if (Mapping == null)
                {
                    Mapping = featureManager.Create("Mapping", "Mapping", DataDissemination);
                }

                Feature Submission = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Submission"));
                if (Submission == null)
                {
                    Submission = featureManager.Create("Submission", "Submission", DataDissemination);
                }



                #region Help Workflow

                operationManager.Create("DIM", "Help", "*");

                #endregion

                #region Admin Workflow

                operationManager.Create("Dim", "Admin", "*", DataDissemination);

                operationManager.Create("Dim", "Submission", "*", Submission);
                operationManager.Create("Dim", "Mapping", "*", Mapping);


                #endregion

                #region Mapping Workflow

                //ToDo add security after Refactoring DIM mapping workflow


                //workflow = new Workflow();
                //workflow.Name = "Mapping";
                //workflowManager.Create(workflow);

                //operation = operationManager.Create("Dim", "Admin", "*", null, workflow);
                //workflow.Operations.Add(operation);

                //Mapping.Workflows.Add(workflow);

                #endregion

                #region Submission Workflow

                //ToDo add security after Refactoring DIM Submission workflow

                //workflow = new Workflow();
                //workflow.Name = "Submission";
                //workflowManager.Create(workflow);

                //operation = operationManager.Create("Dim", "Admin", "*", null, workflow);
                //workflow.Operations.Add(operation);

                //Submission.Workflows.Add(workflow);

                #endregion

                #endregion

                #region EXPORT

                submissionManager.Load();

                createMetadataStructureRepoMaps();


                #endregion

                #region MAPPING

                createMappings();

                #endregion
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                featureManager.Dispose();
                operationManager.Dispose();
            }

            //ImportPartyTypes();
        }
Пример #12
0
        public void GenerateSeedData()
        {
            EntityManager entityManager = new EntityManager();

            try
            {


                #region create Entities

                // Entities
                Entity entity = entityManager.Entities.Where(e => e.Name.ToUpperInvariant() == "Event".ToUpperInvariant()).FirstOrDefault();

                if (entity == null)
                {
                    entity = new Entity();
                    entity.Name = "Event";
                    entity.EntityType = typeof(Event);
                    entity.EntityStoreType = typeof(EventStore);
                    entity.UseMetadata = true;
                    entity.Securable = true;

                    entityManager.Create(entity);
                }
                #endregion

                #region SECURITY

                OperationManager operationManager = new OperationManager();
                FeatureManager featureManager = new FeatureManager();

                try
                {
                    Feature rootEventManagementFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Event Management"));
                    if (rootEventManagementFeature == null) rootEventManagementFeature = featureManager.Create("Event Management", "Event Management");

                    Feature eventRegistrationFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Event Registration"));
                    if (eventRegistrationFeature == null) eventRegistrationFeature = featureManager.Create("Event Registration", "Event Registration", rootEventManagementFeature);

                    Feature eventAdministrationFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Event Administration"));
                    if (eventAdministrationFeature == null) eventAdministrationFeature = featureManager.Create("Event Administration", "Event Administration", rootEventManagementFeature);

                    Feature eventRegistrationResultFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Event Registration Result"));
                    if (eventRegistrationResultFeature == null) eventRegistrationResultFeature = featureManager.Create("Event Registration Result", "Event Registration Result", rootEventManagementFeature);

                    operationManager.Create("EMM", "EventRegistration", "*", eventRegistrationFeature);
                    operationManager.Create("EMM", "Event", "*", eventAdministrationFeature);
                    operationManager.Create("EMM", "EventRegistrationResult", "*", eventRegistrationResultFeature);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    featureManager.Dispose();
                    operationManager.Dispose();
                }

                #endregion

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                entityManager.Dispose();
            }
        }
Пример #13
0
        public static void GenerateSeedData()
        {
            FeatureManager   featureManager   = new FeatureManager();
            OperationManager operationManager = new OperationManager();

            try
            {
                #region SECURITY
                //workflows = größere sachen, vielen operation
                //operations = einzelne actions

                //1.controller -> 1.Operation
                List <Feature> features = featureManager.FeatureRepository.Get().ToList();

                Feature DataDiscovery = features.FirstOrDefault(f => f.Name.Equals("Data Discovery"));
                if (DataDiscovery == null)
                {
                    DataDiscovery = featureManager.Create("Data Discovery", "Data Discovery");
                }

                Feature SearchFeature = features.FirstOrDefault(f =>
                                                                f.Name.Equals("Search") &&
                                                                f.Parent != null &&
                                                                f.Parent.Id.Equals(DataDiscovery.Id));

                if (SearchFeature == null)
                {
                    SearchFeature = featureManager.Create("Search", "Search", DataDiscovery);
                }

                Feature SearchManagementFeature = features.FirstOrDefault(f =>
                                                                          f.Name.Equals("Search Managment") &&
                                                                          f.Parent != null &&
                                                                          f.Parent.Id.Equals(DataDiscovery.Id));

                if (SearchManagementFeature == null)
                {
                    SearchManagementFeature = featureManager.Create("Search Management", "Search Management", DataDiscovery);
                }

                Feature Dashboard = features.FirstOrDefault(f =>
                                                            f.Name.Equals("Dashboard") &&
                                                            f.Parent != null &&
                                                            f.Parent.Id.Equals(DataDiscovery.Id));

                if (Dashboard == null)
                {
                    Dashboard = featureManager.Create("Dashboard", "Dashboard", DataDiscovery);
                }



                //worklfows -> create dataset ->
                //WorkflowManager workflowManager = new WorkflowManager();

                //var operation = new Operation();
                //Workflow workflow = new Workflow();

                //List<Workflow> workflows = workflowManager.WorkflowRepository.Get().ToList();

                #region Help Workflow

                //workflow =
                //    workflows.FirstOrDefault(w =>
                //    w.Name.Equals("Search Help") &&
                //    w.Feature != null &&
                //    w.Feature.Id.Equals(DataDiscovery.Id));

                //if (workflow == null) workflow = workflowManager.Create("Search Help", "", DataDiscovery);

                //operationManager.Create("DDM", "Help", "*", null, workflow);
                operationManager.Create("DDM", "Help", "*");

                #endregion

                #region Search Workflow

                // ToDo -> David, Sven
                // [Sven / 2017-08-21]
                // I had to remove the feature to get dashboard running without DDM feature permissions.
                // We have to think about how we can fix it in a long run. Maybe "DDM/Home" is not the proper
                // place for dashboard!?
                operationManager.Create("DDM", "Home", "*"); //, SearchFeature);
                operationManager.Create("DDM", "Data", "*", SearchFeature);

                #endregion

                #region Search Admin Workflow

                operationManager.Create("DDM", "Admin", "*", SearchManagementFeature);

                #endregion



                #region  Dashboard
                operationManager.Create("DDM", "Dashboard", "*", Dashboard);

                #endregion

                #endregion
            }
            finally
            {
                featureManager.Dispose();
                operationManager.Dispose();
            }
        }
Пример #14
0
        public void GenerateSeedData()
        {
            // Javad:
            // 1) all the create operations should check for existence of the record
            // 2) failure on creating any record should rollback the whole seed data generation. It is one transaction.
            // 3) failues should throw an exception with enough information to pin point the root cause
            // 4) only seed data related to the functions of this modules should be genereated here.
            // BUG: seed data creation is not working because of the changes that were done in the entities and services.
            // TODO: reimplement the seed data creation method.

            //#region Security

            //// Tasks
            OperationManager operationManager = null;
            FeatureManager   featureManager   = null;

            try
            {
                operationManager = new OperationManager();
                featureManager   = new FeatureManager();

                // find root
                var root = featureManager.FindRoots().FirstOrDefault();

                // administration node
                var administrationFeature = featureManager.FindByName("Administration") ?? featureManager.Create("Administration", "node for all administrative features", root);

                // users node
                var userFeature   = featureManager.FindByName("Users") ?? featureManager.Create("Users", "", administrationFeature);
                var userOperation = operationManager.Find("SAM", "Users", "*") ?? operationManager.Create("SAM", "Users", "*", userFeature);

                // groups node
                var groupFeature   = featureManager.FindByName("Groups") ?? featureManager.Create("Groups", "", administrationFeature);
                var groupOperation = operationManager.Find("SAM", "Groups", "*") ?? operationManager.Create("SAM", "Groups", "*", groupFeature);

                // feature permissions
                var featurePermissionFeature   = featureManager.FindByName("Feature Permissions") ?? featureManager.Create("Feature Permissions", "", administrationFeature);
                var featurePermissionOperation = operationManager.Find("SAM", "FeaturePermissions", "*") ?? operationManager.Create("SAM", "FeaturePermissions", "*", featurePermissionFeature);

                // Entity Permissions
                var entityPermissionFeature   = featureManager.FindByName("Entity Permissions") ?? featureManager.Create("Entity Permissions", "", administrationFeature);
                var entityPermissionOperation = operationManager.Find("SAM", "EntityPermissions", "*") ?? operationManager.Create("SAM", "EntityPermissions", "*", entityPermissionFeature);

                // User Permissions
                var userPermissionFeature   = featureManager.FindByName("User Permissions") ?? featureManager.Create("User Permissions", "", administrationFeature);
                var userPermissionOperation = operationManager.Find("SAM", "UserPermissions", "*") ?? operationManager.Create("SAM", "UserPermissions", "*", userPermissionFeature);


                // Dataset Management
                var datasetManagementFeature   = featureManager.FindByName("Dataset Management") ?? featureManager.Create("Dataset Management", "", administrationFeature);
                var datasetManagementOperation = operationManager.Find("SAM", "Datasets", "*") ?? operationManager.Create("SAM", "Datasets", "*", datasetManagementFeature);

                // Help
                var helpOperation = operationManager.Find("SAM", "Help", "*") ?? operationManager.Create("SAM", "Help", "*");

                var featurePermissionManager = new FeaturePermissionManager();

                if (!featurePermissionManager.Exists(null, featurePermissionFeature.Id, PermissionType.Grant))
                {
                    featurePermissionManager.Create(null, featurePermissionFeature.Id, PermissionType.Grant);
                }
            }
            finally
            {
                featureManager?.Dispose();
                operationManager?.Dispose();
            }
        }
Пример #15
0
        public void GenerateSeedData()
        {
            ResearchPlanManager  researchPlanManager  = new ResearchPlanManager();
            DataStructureManager dataStructureManager = new DataStructureManager();
            UnitManager          unitManager          = new UnitManager();
            EntityManager        entityManager        = new EntityManager();
            FeatureManager       featureManager       = new FeatureManager();
            OperationManager     operationManager     = new OperationManager();

            try
            {
                #region create none researchPlan

                if (!researchPlanManager.Repo.Get().Any(r => r.Title.Equals("none")))
                {
                    researchPlanManager.Create("none", "If no research plan is used.");
                }



                #endregion

                #region create none structure


                if (!dataStructureManager.AllTypesDataStructureRepo.Get().Any(d => d.Name.Equals("none")))
                {
                    dataStructureManager.CreateUnStructuredDataStructure("none", "If no data strutcure is used.");
                }



                #endregion

                #region create none unit

                Dimension dimension = null;

                if (!unitManager.DimensionRepo.Get().Any(d => d.Name.ToLower().Equals("none")))
                {
                    dimension = unitManager.Create("none", "none", "If no unit is used."); // the null dimension should be replaced bz a proper valid one. Javad 11.06
                }
                else
                {
                    dimension = unitManager.DimensionRepo.Get().Where(d => d.Name.ToLower().Equals("none")).FirstOrDefault();
                }

                if (!unitManager.Repo.Get().Any(u => u.Name.ToLower().Equals("none")))
                {
                    unitManager.Create("none", "none", "If no unit is used.", dimension, MeasurementSystem.Unknown);
                }

                #endregion

                #region create entities

                // Entities
                Entity entity = entityManager.Entities.Where(e => e.Name.ToUpperInvariant() == "Dataset".ToUpperInvariant()).FirstOrDefault();

                if (entity == null)
                {
                    entity                 = new Entity();
                    entity.Name            = "Dataset";
                    entity.EntityType      = typeof(Dataset);
                    entity.EntityStoreType = typeof(Xml.Helpers.DatasetStore);
                    entity.UseMetadata     = true;
                    entity.Securable       = true;

                    entityManager.Create(entity);
                }



                #endregion

                #region SECURITY
                //workflows = größere sachen, vielen operation
                //operations = einzelne actions

                //1.controller-> 1.Operation



                Feature DataCollectionFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Data Collection"));
                if (DataCollectionFeature == null)
                {
                    DataCollectionFeature = featureManager.Create("Data Collection", "Data Collection");
                }

                Feature DatasetCreationFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Data Creation"));
                if (DatasetCreationFeature == null)
                {
                    DatasetCreationFeature = featureManager.Create("Data Creation", "Data Creation", DataCollectionFeature);
                }

                Feature DatasetUploadFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Dataset Upload"));
                if (DatasetUploadFeature == null)
                {
                    DatasetUploadFeature = featureManager.Create("Dataset Upload", "Dataset Upload", DataCollectionFeature);
                }

                Feature MetadataManagementFeature = featureManager.FeatureRepository.Get().FirstOrDefault(f => f.Name.Equals("Metadata Management"));
                if (MetadataManagementFeature == null)
                {
                    MetadataManagementFeature = featureManager.Create("Metadata Management", "Metadata Management", DataCollectionFeature);
                }


                #region Help Workflow

                operationManager.Create("DCM", "Help", "*");

                #endregion

                #region Create Dataset Workflow

                operationManager.Create("DCM", "CreateDataset", "*", DatasetCreationFeature);
                operationManager.Create("DCM", "Form", "*");

                #endregion

                #region Update Dataset Workflow

                operationManager.Create("DCM", "Push", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "Submit", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "SubmitDefinePrimaryKey", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "SubmitGetFileInformation", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "SubmitSelectAFile", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "SubmitSpecifyDataset", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "SubmitSummary", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "SubmitValidation", "*", DatasetUploadFeature);

                #endregion

                #region Easy Upload

                operationManager.Create("DCM", "EasyUpload", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "EasyUploadSelectAFile", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "EasyUploadSelectAreas", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "EasyUploadSheetDataStructure", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "EasyUploadSheetSelectMetaData", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "EasyUploadSummary", "*", DatasetUploadFeature);
                operationManager.Create("DCM", "EasyUploadVerification", "*", DatasetUploadFeature);

                #endregion

                #region Metadata Managment Workflow

                operationManager.Create("DCM", "ImportMetadataStructure", "*", MetadataManagementFeature);
                operationManager.Create("DCM", "ImportMetadataStructureReadSource", "*", MetadataManagementFeature);
                operationManager.Create("DCM", "ImportMetadataStructureSelectAFile", "*", MetadataManagementFeature);
                operationManager.Create("DCM", "ImportMetadataStructureSetParameters", "*", MetadataManagementFeature);
                operationManager.Create("DCM", "ImportMetadataStructureSummary", "*", MetadataManagementFeature);
                operationManager.Create("DCM", "ManageMetadataStructure", "*", MetadataManagementFeature);
                operationManager.Create("DCM", "SubmitSpecifyDataset", "*", MetadataManagementFeature);

                #endregion

                #region public available

                operationManager.Create("DCM", "Form", "*");

                #endregion

                #endregion

                #region Add Metadata
                MetadataStructureManager metadataStructureManager = new MetadataStructureManager();

                if (!metadataStructureManager.Repo.Get().Any(m => m.Name.Equals("Basic ABCD")))
                {
                    string titleXPath =
                        "Metadata/Metadata/MetadataType/Description/DescriptionType/Representation/MetadataDescriptionRepr/Title/TitleType";
                    string descriptionXpath =
                        "Metadata/Metadata/MetadataType/Description/DescriptionType/Representation/MetadataDescriptionRepr/Details/DetailsType";


                    ImportSchema("Basic ABCD", "ABCD_2.06.XSD", "DataSet", entity.Name, entity.EntityType.FullName,
                                 titleXPath, descriptionXpath);
                }

                //if (!metadataStructureManager.Repo.Get().Any(m => m.Name.Equals("Full ABCD")))
                //{
                //    string titleXPath =
                //        "Metadata/Metadata/MetadataType/Description/DescriptionType/Representation/MetadataDescriptionRepr/Title/TitleType";
                //    string descriptionXpath =
                //        "Metadata/Metadata/MetadataType/Description/DescriptionType/Representation/MetadataDescriptionRepr/Details/DetailsType";


                //    ImportSchema("Full ABCD", "ABCD_2.06.XSD", "DataSet", entity.Name, entity.EntityType.FullName,
                //        titleXPath, descriptionXpath);

                //}

                if (!metadataStructureManager.Repo.Get().Any(m => m.Name.Equals("GBIF")))
                {
                    string titleXPath       = "Metadata/Basic/BasicType/title/titleType";
                    string descriptionXpath = "Metadata/abstract/abstractType/para/paraType";

                    ImportSchema("GBIF", "eml.xsd", "Dataset", entity.Name, entity.EntityType.FullName, titleXPath,
                                 descriptionXpath);
                }
                //if (!metadataStructureManager.Repo.Get().Any(m => m.Name.Equals("Basic Eml")))
                //    ImportSchema("Basic Eml", "eml-dataset.xsd", entity.Name, entity.Name, entity.EntityType.FullName);
                #endregion
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                researchPlanManager.Dispose();
                dataStructureManager.Dispose();
                unitManager.Dispose();
                entityManager.Dispose();
                featureManager.Dispose();
                operationManager.Dispose();
            }
        }