Exemplo n.º 1
0
        /// <summary>
        /// Gets VisualExplorer graph by ResourceId
        /// </summary>
        /// <param name="resourceId">ResourceId from Zentity store</param>
        /// <returns>VisualExplorerGraph object</returns>
        public VisualExplorerGraph GetVisualExplorerGraphByResourceId(string resourceId)
        {
            try
            {
                VisualExplorerHelper helper = new VisualExplorerHelper();
                return(helper.GetVisualExplorerGraphByResourceId(resourceId));
            }
            catch (Exception exception)
            {
                Globals.TraceMessage(TraceEventType.Error, exception.ToString(), exception.Message);
            }

            return(null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get Resource relation by ResourceId
        /// </summary>
        /// <param name="subjectResourceId">Identifier of the subject resource</param>
        /// <param name="objectResourceId">Identifier of the object resource</param>
        /// <returns>Resource relation metadata</returns>
        public string GetResourceRelationByResourceId(string subjectResourceId, string objectResourceId)
        {
            try
            {
                VisualExplorerHelper helper = new VisualExplorerHelper();
                List <string>        result = helper.GetResourceRelationByResourceId(subjectResourceId, objectResourceId);

                if (result != null)
                {
                    DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(List <string>));
                    MemoryStream stream = new MemoryStream();
                    serializer.WriteObject(stream, result);

                    return(Encoding.UTF8.GetString(stream.ToArray()));
                }
            }
            catch (Exception exception)
            {
                Globals.TraceMessage(TraceEventType.Error, exception.ToString(), exception.Message);
            }

            return(string.Empty);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get metadata for the specified ResourceId
        /// </summary>
        /// <param name="resourceId">ResourceId from Zentity store</param>
        /// <returns>Resource metadata</returns>
        public string GetResourceMetadataByResourceId(string resourceId)
        {
            try
            {
                VisualExplorerHelper        helper   = new VisualExplorerHelper();
                Dictionary <string, string> metadata = helper.GetResourceMetadataByResourceId(resourceId);

                if (metadata != null)
                {
                    DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Dictionary <string, string>));
                    MemoryStream stream = new MemoryStream();
                    serializer.WriteObject(stream, metadata);

                    return(Encoding.UTF8.GetString(stream.ToArray()));
                }
            }
            catch (Exception exception)
            {
                Globals.TraceMessage(TraceEventType.Error, exception.ToString(), exception.Message);
            }

            return(string.Empty);
        }