/// <summary> /// returns true if the id exists in the Repository /// </summary> /// <param name="id"></param> /// <returns></returns> public bool HasDataObjectDefinition(string id) { Initialize(); foreach (iDataObjectRepository aRepository in _dataobjectRepositories) { if (aRepository.HasObjectDefinition(CanonicalName.ClassName(id))) { return(true); } } return(false); }
/// <summary> /// returns the selectionrule by handle /// </summary> /// <param name="handle"></param> /// <returns></returns> public iObjectDefinition GetDataObjectDefinition(String id) { Initialize(); foreach (iDataObjectRepository aRepository in _dataobjectRepositories) { iObjectDefinition aDefinition = aRepository.GetIObjectDefinition(CanonicalName.ClassName(id)); if (aDefinition != null) { return(aDefinition); } } throw new RulezException(RulezException.Types.IdNotFound, arguments: new object[] { id, "DataObjectEntrySymbol Repositories" }); }
/// <summary> /// returns true if the name is in canonical Form /// </summary> /// <returns></returns> public bool IsCanonical() { return(CanonicalName.IsCanonical(this.Name)); }
/// <summary> /// gets the ModuleName /// </summary> public string ModuleName() { return(CanonicalName.ModuleName(this.Name)); }
/// <summary> /// gets the ClassName /// </summary> public string ClassName() { return(CanonicalName.ClassName(this.Name)); }
/// <summary> /// gets the EntryName /// </summary> public string EntryName() { return(CanonicalName.EntryName(this.Name)); }
/// <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); }
/// <summary> /// returns true if this a Data Object class /// </summary> /// <returns></returns> bool IsDataObjectClass(string name, RuleContext context) { // check the name might be a full name return(Engine.Repository.HasDataObjectDefinition(CanonicalName.ClassName(name))); }