/// <summary> Gets the work history for a single digital resource item </summary>
        /// <param name="BibID"> Bibliographic identifier (BibID) for the digital resource </param>
        /// <param name="VID"> Volume identifier (VID) for the digital resource </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <returns> Fully built month-by-month usage for the item </returns>
        public Item_Tracking_Details Get_Item_Tracking_Work_History(string BibID, string VID, Custom_Tracer Tracer)
        {
            // Add a beginning trace
            Tracer.Add_Trace("SobekEngineClient_ItemEndpoints.Get_Item_Tracking_Work_History", "Get work history for an item by bibid/vid");

            // Look in the cache
            if (Config.UseCache)
            {
                Item_Tracking_Details fromCache = CachedDataManager.Items.Retrieve_Item_Tracking(BibID, VID, Tracer);
                if (fromCache != null)
                {
                    Tracer.Add_Trace("SobekEngineClient_ItemEndpoints.Get_Item_Tracking_Work_History", "Found work history on the local cache");
                    return(fromCache);
                }
            }
            // Get the endpoint
            MicroservicesClient_Endpoint endpoint = GetEndpointConfig("Items.GetItemTrackingWorkHistory", Tracer);

            // Format the URL
            string url = String.Format(endpoint.URL, BibID, VID);

            // Call out to the endpoint and deserialize the object
            Item_Tracking_Details returnValue = Deserialize <Item_Tracking_Details>(url, endpoint.Protocol, Tracer);

            // Add to the local cache
            if ((Config.UseCache) && (returnValue != null))
            {
                Tracer.Add_Trace("SobekEngineClient_ItemEndpoints.Get_Item_Tracking_Work_History", "Store work history on the local cache");
                CachedDataManager.Items.Store_Item_Tracking(BibID, VID, returnValue, Tracer);
            }

            // Return the object
            return(returnValue);
        }
Esempio n. 2
0
        /// <summary> Store the tracking/workflow information related to a digital resource   </summary>
        /// <param name="BibID"> Bibliographic Identifier for the digital resource to store </param>
        /// <param name="VID"> Volume Identifier for the digital resource to store </param>
        /// <param name="StoreObject"> Tracking/workflow information for a digital Resource object to store for later retrieval </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        public void Store_Item_Tracking(string BibID, string VID, Item_Tracking_Details StoreObject, Custom_Tracer Tracer)
        {
            // If the cache is disabled, just return before even tracing
            if (settings.Disabled)
            {
                return;
            }

            // Determine the key
            string    key            = "ITEM_" + BibID + "_" + VID + "_Tracking";
            const int LENGTH_OF_TIME = 1;

            if (Tracer != null)
            {
                Tracer.Add_Trace("CachedDataManager_ItemServices.Store_Item_Tracking", "Adding object '" + key + "' to the local cache with expiration of " + LENGTH_OF_TIME + " minute");
            }

            HttpContext.Current.Cache.Insert(key, StoreObject, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(LENGTH_OF_TIME));
        }
Esempio n. 3
0
        /// <summary> Constructor for a new instance of the Tracking_ItemViewer class, used display
        /// the full workflow history information for a digital resource </summary>
        /// <param name="BriefItem"> Digital resource object </param>
        /// <param name="CurrentUser"> Current user, who may or may not be logged on </param>
        /// <param name="CurrentRequest"> Information about the current request </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public Tracking_ItemViewer(BriefItemInfo BriefItem, User_Object CurrentUser, Navigation_Object CurrentRequest, Custom_Tracer Tracer)
        {
            // Save the arguments for use later
            this.BriefItem      = BriefItem;
            this.CurrentUser    = CurrentUser;
            this.CurrentRequest = CurrentRequest;

            // Set the behavior properties to the empy behaviors ( in the base class )
            Behaviors = EmptyBehaviors;

            // Get the tracking information
            Tracer.Add_Trace("Tracking_ItemViewer.Constructor", "Try to pull the tracking details for this item");
            trackingDetails = SobekEngineClient.Items.Get_Item_Tracking_Work_History(BriefItem.BibID, BriefItem.VID, Tracer);
            if (trackingDetails == null)
            {
                Tracer.Add_Trace("Tracking_ItemViewer.Constructor", "Unable to pull tracking details");
                CurrentRequest.Mode          = Display_Mode_Enum.Error;
                CurrentRequest.Error_Message = "Internal Error : Unable to pull tracking information for " + BriefItem.BibID + ":" + BriefItem.VID;
            }
        }