From e0b5ea0dc30d17f3eabd77a8377bdfeb07d4da23 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 12 Mar 2020 19:48:12 +0000 Subject: [PATCH] --- .../Controllers/EnumPickListController.cs | 2 +- server/AyaNova/PickList/PickListFactory.cs | 10 +++++---- server/AyaNova/biz/AttachableAttribute.cs | 15 ------------- server/AyaNova/biz/AyaType.cs | 9 ++++---- server/AyaNova/biz/AyaTypeId.cs | 2 +- server/AyaNova/biz/CoreBizObjectAttribute.cs | 22 +++++++++++++++++++ 6 files changed, 34 insertions(+), 26 deletions(-) delete mode 100644 server/AyaNova/biz/AttachableAttribute.cs create mode 100644 server/AyaNova/biz/CoreBizObjectAttribute.cs diff --git a/server/AyaNova/Controllers/EnumPickListController.cs b/server/AyaNova/Controllers/EnumPickListController.cs index 1403941a..355ddf09 100644 --- a/server/AyaNova/Controllers/EnumPickListController.cs +++ b/server/AyaNova/Controllers/EnumPickListController.cs @@ -81,7 +81,7 @@ namespace AyaNova.Api.Controllers foreach (AyaType t in values) { string name = t.ToString(); - if (t.HasAttribute(typeof(AttachableAttribute))) + if (t.HasAttribute(typeof(CoreBizObjectAttribute))) { name += " [Attachable]"; } diff --git a/server/AyaNova/PickList/PickListFactory.cs b/server/AyaNova/PickList/PickListFactory.cs index 7592bfc2..dbe08a8e 100644 --- a/server/AyaNova/PickList/PickListFactory.cs +++ b/server/AyaNova/PickList/PickListFactory.cs @@ -11,10 +11,12 @@ namespace AyaNova.PickList //Instantiate list object specified from type internal static IAyaPickList GetAyaPickList(AyaType ayaType) { - switch(ayaType){ - case AyaType.Widget: - return new WidgetPickList() as IAyaDataList; - } + switch (ayaType) + { + case AyaType.Widget: + return new WidgetPickList() as IAyaPickList; + } + return null; } //List all the datalist types available diff --git a/server/AyaNova/biz/AttachableAttribute.cs b/server/AyaNova/biz/AttachableAttribute.cs deleted file mode 100644 index e96ed33f..00000000 --- a/server/AyaNova/biz/AttachableAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace AyaNova.Biz -{ - /// - /// Marker attribute indicating that an object supports attachments - /// Used in - /// - [AttributeUsage(AttributeTargets.All)] - public class AttachableAttribute : Attribute - { - //No code required, it's just a marker - //https://docs.microsoft.com/en-us/dotnet/standard/attributes/writing-custom-attributes - } -}//eons diff --git a/server/AyaNova/biz/AyaType.cs b/server/AyaNova/biz/AyaType.cs index 2fb1d716..f2cd9e38 100644 --- a/server/AyaNova/biz/AyaType.cs +++ b/server/AyaNova/biz/AyaType.cs @@ -1,27 +1,26 @@ namespace AyaNova.Biz { - - - /// /// All AyaNova types and their attributes indicating what features that type will support (tagging, attachments etc) /// public enum AyaType : int { + //COREBIZOBJECT attribute must be set on objects that are: //Attachable objects can have attachments, //wikiable objects can have a wiki //reviewable objects can have a review which is basically the same as a Reminder but with an object attached (was follow up schedmarker in v7) + //PIckList-able (has picklist template) //Pretty much everything that represents some kind of real world object is wikiable or attachable as long as it has an ID and a type //exceptions would be utility type objects like datalistview, formcustom etc that are not NoType = 0, Global = 1, - [Attachable] + [CoreBizObject] Widget = 2,//attachable, wikiable, reviewable - [Attachable] + [CoreBizObject] User = 3,//attachable, wikiable, reviewable ServerState = 4, diff --git a/server/AyaNova/biz/AyaTypeId.cs b/server/AyaNova/biz/AyaTypeId.cs index 31149928..aba46575 100644 --- a/server/AyaNova/biz/AyaTypeId.cs +++ b/server/AyaNova/biz/AyaTypeId.cs @@ -95,7 +95,7 @@ namespace AyaNova.Biz { get { - return this.ObjectType.HasAttribute(typeof(AttachableAttribute)); + return this.ObjectType.HasAttribute(typeof(CoreBizObjectAttribute)); } } diff --git a/server/AyaNova/biz/CoreBizObjectAttribute.cs b/server/AyaNova/biz/CoreBizObjectAttribute.cs new file mode 100644 index 00000000..6eebb999 --- /dev/null +++ b/server/AyaNova/biz/CoreBizObjectAttribute.cs @@ -0,0 +1,22 @@ +using System; + +namespace AyaNova.Biz +{ + /// + /// Marker attribute indicating that an object is a core business object + /// In other words a real world business relevant object and not a utility or internal type of object + /// something that would be worked with by users in the UI for business purposes + /// This is used to indicate that an object supports these features: + /// PickList selectable (has picklist) + /// Attachable (can attach to it) + /// Reviewable (can set a review on it) + /// ETC + /// Used in + /// + [AttributeUsage(AttributeTargets.All)] + public class CoreBizObjectAttribute : Attribute + { + //No code required, it's just a marker + //https://docs.microsoft.com/en-us/dotnet/standard/attributes/writing-custom-attributes + } +}//eons