Exemplo n.º 1
0
        private List <JsonTreeNode> GetRoleClass(string id)
        {
            List <JsonTreeNode> nodes = new List <JsonTreeNode>();

            if (!string.IsNullOrEmpty(id))
            {
                QMXF entity = _refdataRepository.GetClasses(id, null);
                if (entity != null && entity.classDefinitions.Count > 0)
                {
                    JsonTreeNode classNode = new JsonTreeNode
                    {
                        identifier = entity.classDefinitions[0].identifier.Split('#')[1],
                        leaf       = false,
                        children   = null,
                        text       = entity.classDefinitions[0].name[0].value,
                        id         = Guid.NewGuid().ToString(),
                        record     = entity.classDefinitions[0],
                        type       = "ClassNode",
                        icon       = "Content/img/class.png"
                    };
                    nodes.Add(classNode);
                }
            }
            return(nodes);
        }
Exemplo n.º 2
0
        public Response ClearAll(QMXF qmxf)
        {
            OutgoingWebResponseContext context = WebOperationContext.Current.OutgoingResponse;

            context.ContentType = "application/xml";

            return(_referenceDataProvider.ClearAll(qmxf));
        }
Exemplo n.º 3
0
        private List <JsonTreeNode> GetTemplateRoleClasses(string classId)
        {
            List <JsonTreeNode> nodes = new List <JsonTreeNode>();
            string prefix             = string.Empty;
            string ident = string.Empty;
            string ns    = string.Empty;

            if (classId != string.Empty)
            {
                QMXF dataEntities = _refdataRepository.GetClasses(classId, null);

                foreach (var entity in dataEntities.classDefinitions)
                {
                    if (entity.identifier.Contains("#"))
                    {
                        prefix = _namespaces.Find(n => n.Uri == entity.identifier.Substring(0, entity.identifier.IndexOf("#") + 1)).Prefix;
                        ident  = entity.identifier.Split('#')[1];
                        ns     = _namespaces.Find(n => n.Uri == entity.identifier.Substring(0, entity.identifier.LastIndexOf("#") + 1)).Uri;
                    }
                    else
                    {
                        prefix = _namespaces.Find(n => n.Uri == entity.identifier.Substring(0, entity.identifier.LastIndexOf("/") + 1)).Prefix;
                        ident  = entity.identifier.Substring(entity.identifier.LastIndexOf("/") + 1);
                        ns     = _namespaces.Find(n => n.Uri == entity.identifier.Substring(0, entity.identifier.LastIndexOf("/") + 1)).Uri;
                    }
                    string label = entity.name[0].value.ToString() + '[' + entity.repositoryName + ']';

                    JsonTreeNode node = new JsonTreeNode
                    {
                        type       = (prefix.Contains("rdl")) ? "ClassNode" : "TemplateNode",
                        icon       = (prefix.Contains("rdl")) ? "Content/img/class.png" : "Content/img/template.png",
                        identifier = ident,
                        id         = Guid.NewGuid().ToString(),
                        text       = label,
                        leaf       = false,
                        record     = entity,
                        Namespace  = ns
                    };

                    nodes.Add(node);
                }
            }
            return(nodes);
        }
Exemplo n.º 4
0
        private List <JsonTreeNode> GetRoles(string Id)
        {
            List <JsonTreeNode> nodes = new List <JsonTreeNode>();

            if (!string.IsNullOrEmpty(Id))
            {
                QMXF dataEntities = _refdataRepository.GetTemplate(Id);

                if (dataEntities.templateDefinitions.Count > 0)
                {
                    var id = string.Empty; // solving bug when id exists in more than one repository
                    foreach (var entity in dataEntities.templateDefinitions)
                    {
                        if (id != entity.identifier)
                        {
                            id = entity.identifier;
                        }
                        else
                        {
                            continue; // multiple id's
                        }
                        foreach (var role in entity.roleDefinition)
                        {
                            JsonTreeNode entityNode = new JsonTreeNode
                            {
                                id         = Guid.NewGuid().ToString(),
                                type       = "RoleNode",
                                icon       = "Content/img/role.png",
                                children   = null,
                                leaf       = false,
                                text       = role.name[0].value,
                                identifier = role.identifier,
                                record     = role
                            };
                            nodes.Add(entityNode);
                        }
                    }
                }
                else if (dataEntities.templateQualifications.Count > 0)
                {
                    var id = string.Empty; // solving bug when id exists in more than one repository
                    foreach (var entity in dataEntities.templateQualifications)
                    {
                        if (id != entity.identifier)
                        {
                            id = entity.identifier;
                        }
                        else
                        {
                            continue; // multiple id's
                        }
                        foreach (var role in entity.roleQualification)
                        {
                            string roleId = string.Empty;
                            if (role.range != null)
                            {
                                roleId = role.range.Split('#')[1];
                            }
                            JsonTreeNode entityNode = new JsonTreeNode
                            {
                                id         = Guid.NewGuid().ToString(),
                                type       = "RoleNode",
                                text       = role.name[0].value,
                                icon       = "Content/img/role.png",
                                children   = GetTemplateRoleClasses(roleId),
                                leaf       = false,
                                identifier = role.identifier,
                                record     = role
                            };
                            if (entityNode.children.Count() == 0)
                            {
                                entityNode.leaf = true;
                            }
                            nodes.Add(entityNode);
                        }
                    }
                }
            }

            return(nodes);
        }
Exemplo n.º 5
0
        private List <JsonTreeNode> GetClasses(string classId, string repositoryName)
        {
            List <JsonTreeNode> nodes = new List <JsonTreeNode>();
            QMXF       dataEntities   = null;
            Repository repository     = null;

            if (!string.IsNullOrEmpty(classId))
            {
                if (!string.IsNullOrEmpty(repositoryName))
                {
                    repository = _federation.Repositories.Find(r => r.Name == repositoryName);
                }

                dataEntities = _refdataRepository.GetClasses(classId, repository);
                foreach (var entity in dataEntities.classDefinitions)
                {
                    #region Default Nodes------------------
                    var label = entity.name[0].value;

                    JsonTreeNode memberNode = new JsonTreeNode
                    {
                        id         = Guid.NewGuid().ToString(),
                        children   = new List <JsonTreeNode>(),
                        iconCls    = "folder",
                        leaf       = false,
                        text       = "Members",
                        type       = "MembersNode",
                        identifier = null,
                        //    expanded = false
                    };

                    JsonTreeNode clasifNode = new JsonTreeNode
                    {
                        id         = Guid.NewGuid().ToString(),
                        children   = new List <JsonTreeNode>(),
                        iconCls    = "folder",
                        leaf       = false,
                        text       = "Member Of",
                        type       = "ClassificationsNode",
                        identifier = null,
                        //  expanded = false
                    };

                    JsonTreeNode supersNode = new JsonTreeNode
                    {
                        id       = Guid.NewGuid().ToString(),
                        children = new List <JsonTreeNode>(),
                        iconCls  = "folder",
                        leaf     = false,
                        text     = "Superclasses",
                        type     = "SuperclassesNode",
                        //    expanded = false
                    };

                    JsonTreeNode subsNode = new JsonTreeNode
                    {
                        id       = Guid.NewGuid().ToString(),
                        children = null,
                        iconCls  = "folder",
                        leaf     = false,
                        text     = "Subclasses",
                        type     = "SubclassesNode",
                        //    expanded = false
                    };

                    JsonTreeNode tempsNode = new JsonTreeNode
                    {
                        id       = Guid.NewGuid().ToString(),
                        children = null,
                        iconCls  = "folder",
                        leaf     = false,
                        text     = "Templates",
                        type     = "ClassTemplatesNode",
                        //   expanded = false
                    };
                    #endregion

                    #region Add Hidden node for Properties------------
                    string reference = string.Empty;
                    if (entity.entityType != null)
                    {
                        reference = Convert.ToString(entity.entityType.reference);
                    }
                    Dictionary <string, string> properties = new Dictionary <string, string>()
                    {
                        { "Description", Convert.ToString(entity.description[0].value) },
                        { "Entity Type", reference },
                        { "Identifiers", Convert.ToString(entity.identifier) },
                        { "Name", Convert.ToString(entity.name[0].value) },
                        { "Repository", Convert.ToString(entity.repositoryName) },
                        { "Status Authority", Convert.ToString(entity.status[0].authority) },
                        { "Status Class", Convert.ToString(entity.status[0].Class) },
                        { "Status From", Convert.ToString(entity.status[0].from) },
                    };
                    #endregion
                    // nodes.Add(memberNode);


                    #region Fill Data in Classification node--------
                    foreach (var classification in entity.classification)
                    {
                        JsonTreeNode leafNode = new JsonTreeNode
                        {
                            type       = "ClassNode",
                            icon       = "Content/img/class.png",
                            leaf       = false,
                            identifier = classification.reference.Split('#')[1],
                            id         = Guid.NewGuid().ToString(),
                            text       = string.Format("{0}[{1}]", classification.label, classification.repository),
                            //       expanded = false,
                            children = null,
                            record   = classification
                        };

                        clasifNode.children.Add(leafNode);
                    }
                    clasifNode.text = clasifNode.text + " (" + clasifNode.children.Count() + ")";
                    if (clasifNode.children.Count() == 0)
                    {
                        clasifNode.leaf = true;
                        clasifNode.icon = "Content/img/folder.png";
                    }
                    #endregion

                    JsonTreeNode membersNodes = GetClassMembers(classId, memberNode, repositoryName);
                    memberNode.record = properties;
                    nodes.Add(membersNodes);
                    nodes.Add(clasifNode); // Add Classification node.
                    nodes.Add(supersNode); // Add SuperClassNode.
                    #region Fill Data in SuperClass node--------
                    foreach (var specialization in entity.specialization)
                    {
                        JsonTreeNode leafNode = new JsonTreeNode
                        {
                            type       = "ClassNode",
                            icon       = "Content/img/class.png",
                            leaf       = false,
                            identifier = specialization.reference.Split('#')[1],
                            id         = Guid.NewGuid().ToString(),
                            text       = string.Format("{0}[{1}]", specialization.label, specialization.repository),
                            //      expanded = false,
                            children = null,
                            record   = specialization
                        };

                        supersNode.children.Add(leafNode);
                    }
                    supersNode.text = supersNode.text + " (" + supersNode.children.Count() + ")";
                    if (supersNode.children.Count() == 0)
                    {
                        supersNode.leaf = true;
                        supersNode.icon = "Content/img/folder.png";
                    }
                    #endregion

                    //Get Sub Classes
                    //JsonTreeNode subClassNodes = GetSubClasses(classId, subsNode);
                    string subNodeCount = GetSubClassesCount(classId);
                    subsNode.text = subsNode.text + "(" + subNodeCount + ")";

                    if (subNodeCount == "0")
                    {
                        subsNode.children = null;
                        subsNode.leaf     = true;
                        subsNode.icon     = "Content/img/folder.png";
                    }
                    nodes.Add(subsNode);

                    //Get Templates
                    // JsonTreeNode templateNodes = GetTemplates(classId, tempsNode);
                    string templateNodesCount = GetTemplatesCount(classId);
                    tempsNode.text = tempsNode.text + "(" + templateNodesCount + ")";
                    if (templateNodesCount == "0")
                    {
                        tempsNode.children = null;
                        tempsNode.leaf     = true;
                        tempsNode.icon     = "Content/img/folder.png";
                    }

                    nodes.Add(tempsNode);
                }
            }

            return(nodes);
        }
Exemplo n.º 6
0
        public void GetTemplate()
        {
            QMXF qmxf = _refdataProvider.GetTemplate("R93761651329");

            Assert.IsNotNull(qmxf);
        }
Exemplo n.º 7
0
        public void GetClass()
        {
            QMXF qmxf = _refdataProvider.GetClass("R99781532089");

            Assert.IsNotNull(qmxf);
        }