Beispiel #1
0
        private void InternalPrepare(Schema.DevicePlan plan, TableNode planNode)
        {
            RestrictNode restrictNode = planNode as RestrictNode;

            if (restrictNode != null)
            {
                // Prepare the source
                InternalPrepare(plan, restrictNode.SourceNode);

                if (plan.IsSupported)
                {
                    if (restrictNode.IsSeekable)
                    {
                        // TODO: If this is a seek to the Id and there is more than one search parameter, this should not be supported
                        // TODO: Many FHIR servers don't support wide open queries, so if something isn't filtered, we would need to be able to indicate (warning maybe?) that the query will likely not return any data (maybe even an error, although some systems do support it).
                        // Verify that each condition corresponds to a known search parameter for this resource
                        foreach (ColumnConditions columnConditions in restrictNode.Conditions)
                        {
                            if (!IsSearchParamColumn(columnConditions.Column))
                            {
                                plan.TranslationMessages.Add(new Schema.TranslationMessage(String.Format("Service does not support restriction by {0}.", columnConditions.Column.Name)));
                                plan.IsSupported = false;
                                break;
                            }
                        }
                    }
                    else if (restrictNode.Nodes[1] is SatisfiesSearchParamNode)
                    {
                        plan.IsSupported = true;
                    }
                    else
                    {
                        plan.TranslationMessages.Add(new Schema.TranslationMessage("Service does not support arbitrary restriction."));
                        plan.IsSupported = false;
                    }
                }

                return;
            }

            BaseTableVarNode baseTableVarNode = planNode as BaseTableVarNode;

            if (baseTableVarNode != null)
            {
                ResourceType = MetaData.GetTag(baseTableVarNode.TableVar.MetaData, "FHIR.ResourceType", Schema.Object.Unqualify(baseTableVarNode.TableVar.Name));
                return;
            }

            plan.TranslationMessages.Add(new Schema.TranslationMessage("Service does not support arbitrary queries."));
            plan.IsSupported = false;
            return;
        }
Beispiel #2
0
        protected void TranslateRestrictNode(CatalogDevicePlan devicePlan, CatalogDevicePlanNode devicePlanNode, RestrictNode restrictNode)
        {
            if ((restrictNode.SourceNode is BaseTableVarNode) && (restrictNode.Nodes[1] is InstructionNodeBase))
            {
                TranslateBaseTableVarNode(devicePlan, devicePlanNode, (BaseTableVarNode)restrictNode.SourceNode);
                if (devicePlan.IsSupported)
                {
                    if (devicePlanNode.WhereCondition.Length > 0)
                    {
                        devicePlanNode.WhereCondition.Insert(0, "(");
                        devicePlanNode.WhereCondition.AppendFormat(") and ");
                    }
                    TranslateExpression(devicePlan, devicePlanNode, restrictNode.Nodes[1]);

                    if (devicePlan.IsSupported)
                    {
                        restrictNode.CursorType          = restrictNode.SourceNode.CursorType;
                        restrictNode.RequestedCursorType = restrictNode.SourceNode.RequestedCursorType;
                        restrictNode.CursorCapabilities  = restrictNode.SourceNode.CursorCapabilities;
                        restrictNode.CursorIsolation     = restrictNode.SourceNode.CursorIsolation;
                        restrictNode.Order = restrictNode.SourceNode.Order;
                    }
                }
            }
            else
            {
                devicePlan.IsSupported = false;
            }
        }
Beispiel #3
0
 public FilterTable(RestrictNode node, Program program) : base(node, program)
 {
 }
Beispiel #4
0
 public RestrictTable(RestrictNode node, Program program) : base(node, program)
 {
 }
Beispiel #5
0
        private void InternalPrepare(Schema.DevicePlan plan, TableNode planNode)
        {
            RestrictNode restrictNode = planNode as RestrictNode;

            if (restrictNode != null)
            {
                // Prepare the source
                InternalPrepare(plan, restrictNode.SourceNode);

                if (plan.IsSupported)
                {
                    SetSearchParamContainer(plan);
                    if (restrictNode.IsSeekable)
                    {
                        foreach (ColumnConditions columnConditions in restrictNode.Conditions)
                        {
                            if (!IsSearchParamColumn(columnConditions.Column))
                            {
                                plan.TranslationMessages.Add(new Schema.TranslationMessage(String.Format("Service does not support restriction by {0}.", columnConditions.Column.Name)));
                                plan.IsSupported = false;
                                break;
                            }
                        }
                    }
                    else if (restrictNode.IsScanable)
                    {
                        foreach (ColumnConditions columnConditions in restrictNode.Conditions)
                        {
                            if (!IsSearchParamColumn(columnConditions.Column))
                            {
                                plan.TranslationMessages.Add(new Schema.TranslationMessage(String.Format("Service does not support restriction by {0}.", columnConditions.Column.Name)));
                                plan.IsSupported = false;
                                break;
                            }

                            foreach (ColumnCondition condition in columnConditions)
                            {
                                if (condition.Instruction != Instructions.Equal)
                                {
                                    plan.IsSupported = false;
                                    break;
                                }
                            }

                            if (!plan.IsSupported)
                            {
                                break;
                            }
                        }
                    }
                    else if (restrictNode.Nodes[1] is SatisfiesSearchParamNode)
                    {
                        plan.IsSupported = true;
                    }
                    else
                    {
                        plan.TranslationMessages.Add(new Schema.TranslationMessage("Service does not support arbitrary restriction."));
                        plan.IsSupported = false;
                    }
                }

                return;
            }

            BaseTableVarNode baseTableVarNode = planNode as BaseTableVarNode;

            if (baseTableVarNode != null)
            {
                ResourceType = MetaData.GetTag(baseTableVarNode.TableVar.MetaData, "PHINVADS.ResourceType", Schema.Object.Unqualify(baseTableVarNode.TableVar.Name));
                return;
            }

            plan.TranslationMessages.Add(new Schema.TranslationMessage("Service does not support arbitrary queries."));
            plan.IsSupported = false;
            return;
        }