예제 #1
0
        /// <summary>
        /// build a XPTree Node for a data object entry name
        /// </summary>
        /// <param name="ctx"></param>
        /// <returns></returns>
        public bool BuildXPTNode(DataObjectEntryNameContext ctx)
        {
            string aClassName = String.Empty;

            /// build the entry name
            if (ctx.dataObjectClass() == null)
            {
                aClassName = GetDefaultClassName(ctx);
            }
            else
            {
                aClassName = ctx.dataObjectClass().ClassName;
            }
            // full entry name
            ctx.entryname = aClassName + "." + ctx.identifier().GetText();
            ctx.ClassName = aClassName;
            // get the symbol from the engine
            DataObjectEntrySymbol aSymbol = new DataObjectEntrySymbol(ctx.entryname, engine: this.Engine);

            ctx.XPTreeNode = aSymbol;
            if (aSymbol != null)
            {
                return(true);
            }
            return(false);
        }
예제 #2
0
        /// <summary>
        /// build a XPTree Node for a data object entry name 
        /// </summary>
        /// <param name="ctx"></param>
        /// <returns></returns>
        public bool BuildXPTNode(DataObjectEntryNameContext ctx)
        {
            string aClassName = String.Empty;

            /// build the entry name
            if (ctx.dataObjectClass() == null) aClassName = GetDefaultClassName (ctx);
            else aClassName = ctx.dataObjectClass().ClassName ;
            // full entry name
            ctx.entryname = aClassName + "." + ctx.identifier().GetText();
            ctx.ClassName = aClassName;
            // get the symbol from the engine
            DataObjectEntrySymbol aSymbol = new DataObjectEntrySymbol(ctx.entryname, engine: this.Engine);
            ctx.XPTreeNode = aSymbol;
            if (aSymbol != null) return true;
            return false;
        }
예제 #3
0
        /// <summary>
        /// returns true if this a Data Object class
        /// </summary>
        /// <returns></returns>
        bool IsDataObjectEntry(string name, RuleContext context)
        {
            // check the name might be a full name
            CanonicalName aName       = new CanonicalName(name);
            string        aClassname  = aName.IsCanonical() ? aName.ClassName() : String.Empty;
            string        anEntryName = aName.EntryName();

            // if we are in the right context
            if (context is DataObjectEntryNameContext)
            {
                DataObjectEntryNameContext ctx = (DataObjectEntryNameContext)context;
                if (string.IsNullOrEmpty(ctx.ClassName))
                {
                    aClassname = GetDefaultClassName(context);
                }
                else if (!String.IsNullOrWhiteSpace(ctx.ClassName))
                {
                    // if classname differs than it is not allowed
                    if (string.Compare(ctx.ClassName, aClassname, true) != 00)
                    {
                        this.NotifyErrorListeners(String.Format(Messages.RCM_12, ctx.ClassName));
                    }
                    else
                    {
                        aClassname = ctx.ClassName;
                    }
                }
            }
            else if (context is SelectExpressionContext)
            {
                SelectExpressionContext ctx = (SelectExpressionContext)context;
                string aDefaultname         = GetDefaultClassName(ctx);
                if (!(String.IsNullOrEmpty(aDefaultname)))
                {
                    aClassname = aDefaultname;
                }
            }
            else if (context is SelectConditionContext)
            {
                SelectConditionContext ctx = (SelectConditionContext)context;
                string aDefaultname        = GetDefaultClassName(ctx);
                if (!(String.IsNullOrEmpty(aDefaultname)))
                {
                    aClassname = aDefaultname;
                }
            }
            else if (context is ResultSelectionContext)
            {
                ResultSelectionContext ctx = (ResultSelectionContext)context;
                string aDefaultname        = GetDefaultClassName(ctx);
                if (string.IsNullOrEmpty(ctx.ClassName))
                {
                    aClassname = GetDefaultClassName(context);
                }
                else if (!String.IsNullOrWhiteSpace(ctx.ClassName))
                {
                    aClassname = ctx.ClassName;
                }
            }

            // check if DataObjectEntry is there
            if (!string.IsNullOrWhiteSpace(aClassname) && Engine.Repository.HasDataObjectDefinition(aClassname))
            {
                return(Engine.Repository.GetDataObjectDefinition(aClassname).HasEntry(anEntryName));
            }
            // no way to get classname and entryname
            return(false);
        }