Exemple #1
0
        public PHINVADSDeviceSession(PHINVADSDevice device, ServerProcess serverProcess, Schema.DeviceSessionInfo deviceSessionInfo) : base(device, serverProcess, deviceSessionInfo)
        {
            // Initialize the PHINVADS Client
            _factory = new CHessianProxyFactory();
            _client  = (VocabService)_factory.Create(typeof(VocabService), device.Endpoint);

            // TODO: Establish authentication/authorization tokens?
        }
Exemple #2
0
        private void InitializeSearchParams()
        {
            _searchParams = PHINVADSDevice.GetSearchParamInstanceForResource(_program.Plan, _fhirTableNode.ResourceType);
            _directParams = new Dictionary <String, Object>();

            // Ignoring the search params on the plan for now, create search params for this execution here
            var restrictNode = _fhirTableNode.Node as RestrictNode;

            if (restrictNode != null)
            {
                _apiType = APIType.Find;
                // TODO: Generalize the stack offset here, this is safe because we know the only scenario we support is restriction of a base table var
                _program.Stack.Push(null);
                try
                {
                    if (restrictNode.IsSeekable)
                    {
                        // Verify that there is only one condition and that it corresponds to a known search parameter for this resource
                        foreach (ColumnConditions columnConditions in restrictNode.Conditions)
                        {
                            // A seekable condition will only have one column condition
                            var searchParamName = GetSearchParamName(columnConditions.Column);
                            var searchValue     = GetSearchParamValue(columnConditions[0]);
                            if (IsDirectSearch(columnConditions.Column.Name))
                            {
                                _apiType = APIType.Direct;
                            }
                            SetSearchParam(searchParamName, searchValue);
                        }
                    }
                    else if (restrictNode.IsScanable)
                    {
                        foreach (ColumnConditions columnConditions in restrictNode.Conditions)
                        {
                            // A scanable condition will always have equality as its instruction
                            foreach (ColumnCondition condition in columnConditions)
                            {
                                var searchParamName = GetSearchParamName(columnConditions.Column);
                                var searchValue     = GetSearchParamValue(condition);
                                if (IsDirectSearch(columnConditions.Column.Name))
                                {
                                    _apiType = APIType.Direct;
                                }
                                SetSearchParam(searchParamName, searchValue);
                            }
                        }
                    }
                    else
                    {
                        var searchParamNode = restrictNode.Nodes[1] as SatisfiesSearchParamNode;
                        if (searchParamNode != null)
                        {
                            var columnName      = (string)searchParamNode.Nodes[1].Execute(_program);
                            var searchParamName = GetSearchParamName(columnName);
                            var searchValue     = (string)searchParamNode.Nodes[2].Execute(_program);
                            if (IsDirectSearch(columnName))
                            {
                                _apiType = APIType.Direct;
                            }
                            SetSearchParam(searchParamName, searchValue);
                        }
                    }
                }
                finally
                {
                    _program.Stack.Pop();
                }
            }
        }
Exemple #3
0
 private string GetSearchParamName(string columnName)
 {
     return(PHINVADSDevice.GetSearchParamIndicatorName(_fhirTableNode.ResourceType, columnName));
 }
Exemple #4
0
 private bool IsSearchParamColumn(Schema.TableVarColumn column)
 {
     return(_searchParams != null && _searchParams.GetType().GetMember(PHINVADSDevice.GetSearchParamIndicatorName(_resourceType, column.Name)) != null);
 }
Exemple #5
0
 public void SetSearchParamContainer(Schema.DevicePlan plan)
 {
     _searchParams = PHINVADSDevice.GetSearchParamInstanceForResource(plan.Plan, _resourceType);
     _directParams = new Dictionary <string, object>();
 }