Esempio n. 1
0
 public bool ProcessDomain(RFGraphProcessorDomain domain)
 {
     try
     {
         ProcessorStatus = new RFGraphProcessorStatus();
         Log.SetValueDate(domain.ValueDate);
         Process(domain as D);
     }
     catch (RFLogicException ex)
     {
         // partial results will NOT be saved
         ProcessorStatus.SetError(ex.Message);
     }
     catch
     {
         throw;
     }
     return(_externalWorkDone);
 }
Esempio n. 2
0
        protected List <RFCatalogKey> SaveDomain(RFGraphProcessorDomain domain, IRFProcessingContext context)
        {
            var updates    = new List <RFCatalogKey>();
            var domainType = domain.GetType();
            int numUpdates = 0;

            foreach (var propertyInfo in domainType.GetProperties())
            {
                var ioBehaviour = propertyInfo.GetCustomAttributes(typeof(RFIOBehaviourAttribute), true).FirstOrDefault() as RFIOBehaviourAttribute;
                if (ioBehaviour != null && (ioBehaviour.IOBehaviour == RFIOBehaviour.Output || ioBehaviour.IOBehaviour == RFIOBehaviour.State))
                {
                    var value = propertyInfo.GetValue(domain);
                    if (value != null)
                    {
                        foreach (var outputMapping in Config.IOMappings.Where(m => m.Property.Name == propertyInfo.Name))
                        {
                            var outputKey = outputMapping.Key.CreateForInstance(this.GraphInstance);
                            var options   = RFGraphInstance.ImplyOptions(outputMapping);
                            // by default date will be set from the graph instance
                            if (options.DateBehaviour == RFDateBehaviour.Dateless)
                            {
                                outputKey.GraphInstance.ValueDate = null;
                            }
                            bool isState    = (ioBehaviour.IOBehaviour == RFIOBehaviour.State);
                            var  hasUpdated = context.SaveEntry(new RFDocument
                            {
                                Content = value,
                                Key     = outputKey,
                                Type    = value.GetType().FullName
                            }, !isState);
                            if (hasUpdated)
                            {
                                updates.Add(outputKey);
                                numUpdates++;
                            }
                        }
                    }
                }
            }
            return(updates);
        }