public FileResult GetProcessDomain(string processName, string instanceName, DateTime?instanceDate)
        {
            using (var activity = new RFEngineActivity(Context, EngineConfig))
            {
                RFGraphProcessorDomain domain = null;
                var engineConfig  = activity.GetEngineConfig();
                var graphInstance = new RFGraphInstance
                {
                    Name      = string.IsNullOrWhiteSpace(instanceName) ? null : instanceName,
                    ValueDate = instanceDate.HasValue ? new RFDate(instanceDate.Value.Date) : RFDate.NullDate
                };

                foreach (var graph in engineConfig.Graphs.Values)
                {
                    var process = graph.Processes.Values.FirstOrDefault(p => RFGraphDefinition.GetFullName(graph.GraphName, p.Name) == processName);
                    if (process != null)
                    {
                        var processor = process.Processor();
                        domain = processor.CreateDomain();
                        if (domain != null)
                        {
                            foreach (var propertyInfo in domain.GetType().GetProperties())
                            {
                                var          ioBehaviourAttribute = (propertyInfo.GetCustomAttributes(typeof(RFIOBehaviourAttribute), true).FirstOrDefault() as RFIOBehaviourAttribute);
                                RFCatalogKey ioKey = null;
                                if (ioBehaviourAttribute != null)
                                {
                                    var ioBehaviour = ioBehaviourAttribute.IOBehaviour;
                                    var ioMapping   = process.IOMappings.FirstOrDefault(m => m.PropertyName == propertyInfo.Name);
                                    if (ioMapping != null)
                                    {
                                        ioKey = ioMapping.Key.CreateForInstance(graphInstance);
                                        var options = RFGraphInstance.ImplyOptions(ioMapping);
                                        var entry   = Context.LoadEntry(ioKey, options) as RFDocument;
                                        if (entry != null)
                                        {
                                            propertyInfo.SetValue(domain, entry.Content);
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    }
                }

                if (domain != null)
                {
                    var xmlString = RFXMLSerializer.PrettySerializeContract(domain);
                    return(File(
                               Encoding.UTF8.GetBytes(xmlString),
                               "text/xml",
                               String.Format("{0}_{1}_{2}.xml", processName, instanceName ?? String.Empty, instanceDate.Value.ToString("yyyy-MM-dd"))
                               ));
                }
            }
            return(null);
        }
示例#2
0
 public override RFCatalogEntry LoadItem(RFCatalogKey itemKey, int version = 0, bool ignoreContent = false)
 {
     using (var bucket = _cluster.OpenBucket(_bucket))
     {
         var keyString = itemKey.ToString();
         var doc       = bucket.GetDocument <RFCouchbaseDocument>(keyString);
         throw new NotImplementedException();
     }
 }
示例#3
0
        public override bool MatchesRoot(RFCatalogKey key)
        {
            var fileKey = key as RFFileKey;

            if (fileKey != null)
            {
                return(fileKey.FileKey == FileKey);
            }
            return(false);
        }
示例#4
0
 public RFProcessingTracker SaveDocument(RFCatalogKey key, object content, bool raiseEvent, RFUserLogEntry userLogEntry)
 {
     if (raiseEvent)
     {
         return(SaveEntry(RFDocument.Create(key, content), userLogEntry));
     }
     else
     {
         SaveEntry(RFDocument.Create(key, content), false, userLogEntry);
         return(new RFProcessingTracker("dummy"));
     }
 }
示例#5
0
 public TransactionProcessor(RFCatalogKey testKey1, RFCatalogKey testKey2)
 {
     _testKey1 = testKey1;
     _testKey2 = testKey2;
 }
        public JsonResult GetProcesses(string instanceName, DateTime?instanceDate)
        {
            using (var activity = new RFEngineActivity(Context, EngineConfig))
            {
                var engineConfig  = activity.GetEngineConfig();
                var graphInstance = new RFGraphInstance
                {
                    Name      = string.IsNullOrWhiteSpace(instanceName) ? RFGraphInstance.DEFAULT_INSTANCE : instanceName,
                    ValueDate = instanceDate.HasValue ? new RFDate(instanceDate.Value.Date) : RFDate.NullDate
                };
                var stats = activity.GetEngineStats(graphInstance);

                var allProcesses = new List <object>();
                foreach (var process in engineConfig.Processes.Values)
                {
                    var processor = process.Processor();
                    var stat      = stats.GetStat(process.Name);
                    allProcesses.Add(new
                    {
                        Graph        = "(none)",
                        Name         = process.Name,
                        FullName     = process.Name,
                        Description  = process.Description,
                        Type         = processor.GetType().FullName,
                        RequiresIdle = false,
                        IsGraph      = false,
                        LastRun      = stat != null ? (DateTimeOffset?)stat.LastRun : null,
                        LastDuration = stat != null ? (long?)stat.LastDuration : null,
                    });
                }

                foreach (var graph in engineConfig.Graphs.Values)
                {
                    foreach (var process in graph.Processes.Values)
                    {
                        var fullName  = RFGraphDefinition.GetFullName(graph.GraphName, process.Name);
                        var stat      = stats.GetStat(fullName);
                        var processor = process.Processor();
                        var domain    = processor.CreateDomain();
                        var io        = new List <object>();
                        if (domain != null)
                        {
                            foreach (var propertyInfo in domain.GetType().GetProperties())
                            {
                                var          ioBehaviourAttribute = (propertyInfo.GetCustomAttributes(typeof(RFIOBehaviourAttribute), true).FirstOrDefault() as RFIOBehaviourAttribute);
                                string       direction            = "-";
                                string       dateType             = "-";
                                RFCatalogKey ioKey = null;
                                if (ioBehaviourAttribute != null)
                                {
                                    var ioBehaviour = ioBehaviourAttribute.IOBehaviour;
                                    direction = ioBehaviour.ToString();

                                    var ioMapping = process.IOMappings.FirstOrDefault(m => m.PropertyName == propertyInfo.Name);
                                    if (ioMapping != null)
                                    {
                                        ioKey = ioMapping.Key.CreateForInstance(graphInstance);
                                        var options = RFGraphInstance.ImplyOptions(ioMapping);
                                        dateType = options.DateBehaviour.ToString();
                                    }
                                }

                                io.Add(new
                                {
                                    Field     = propertyInfo.Name,
                                    Direction = direction,
                                    DateType  = dateType,
                                    DataType  = propertyInfo.PropertyType.Name,
                                    KeyType   = ioKey != null ? ioKey.GetType().Name : null,
                                    ShortKey  = ioKey != null ? ioKey.FriendlyString() : null,
                                    FullKey   = ioKey != null ? RFXMLSerializer.SerializeContract(ioKey) : null
                                });
                            }
                        }
                        allProcesses.Add(new
                        {
                            Graph        = graph.GraphName,
                            Name         = process.Name,
                            FullName     = fullName,
                            IsGraph      = true,
                            Description  = process.Description,
                            Type         = processor.GetType().FullName,
                            IO           = io,
                            LastRun      = stat != null ? (DateTimeOffset?)stat.LastRun : null,
                            LastDuration = stat != null ? (long?)stat.LastDuration : null
                        });
                    }
                }

                return(Json(allProcesses));
            }
        }
示例#7
0
        protected DateTimeOffset?GetValidUpdateTime(RFCatalogKey key)
        {
            var stats = _context.GetKeyMetadata(key);

            return((stats != null && stats.IsValid) ? (DateTimeOffset?)stats.UpdateTime : null);
        }
示例#8
0
 public RFProcessingTrackerHandle SaveDocumentAsync(RFCatalogKey key, object content, RFUserLogEntry userLogEntry)
 {
     return(SaveEntryAsync(RFDocument.Create(key, content), userLogEntry));
 }
示例#9
0
 public RFCatalogEntry LoadEntry(RFCatalogKey key, RFCatalogOptions options = null)
 {
     return(_context.LoadEntry(key, options));
 }
示例#10
0
 public T LoadDocumentContent <T>(RFCatalogKey key, RFCatalogOptions options = null) where T : class
 {
     return(_context.LoadDocumentContent <T>(key, options));
 }
示例#11
0
 public void Invalidate(RFCatalogKey key)
 {
     _context.Invalidate(key);
 }
示例#12
0
 public RFCatalogKeyMetadata GetKeyMetadata(RFCatalogKey key)
 {
     return(_context.GetKeyMetadata(key));
 }
示例#13
0
 public Dictionary <RFGraphInstance, RFCatalogKey> GetKeyInstances(RFCatalogKey key)
 {
     throw new NotImplementedException();
 }
示例#14
0
 public override RFCatalogKeyMetadata GetKeyMetadata(RFCatalogKey key)
 {
     throw new NotImplementedException();
 }