Ejemplo n.º 1
0
        public virtual Object Get(object id, object versionId)
        {
            if ((this.Capabilities & ResourceCapabilityType.Get) == 0 &&
                (this.Capabilities & ResourceCapabilityType.GetVersion) == 0)
            {
                throw new NotSupportedException(this.m_localizationService.GetString("error.type.NotSupportedException"));
            }

            try
            {
                var retVal = this.GetRepository().Get((Guid)id, (Guid)versionId);
                if (retVal is Entity || retVal is Act)
                {
                    AuditUtil.AuditRead(Core.Auditing.OutcomeIndicator.Success, id.ToString(), retVal);
                }
                return(retVal);
            }
            catch (Exception e)
            {
                AuditUtil.AuditRead <TResource>(Core.Auditing.OutcomeIndicator.MinorFail, id.ToString());
                this.m_tracer.TraceError($"Error getting resource {id}");
                throw new Exception(this.m_localizationService.FormatString("error.rest.common.gettingResource", new { param = nameof(id) }), e);
            }
        }