Sfoglia il codice sorgente

Removed some obsolete properties

Kenric Nugteren 2 settimane fa
parent
commit
6c053c323c

+ 0 - 6
InABox.Core/Client/Request.cs

@@ -267,10 +267,6 @@ namespace InABox.Clients
         public TEntity[] Items { get; set; }
         public string AuditNote { get; set; }
 
-        [Obsolete("We don't like this; it should always be true.")]
-        // Added 11/04/23 to address incompatibility, remove as soon as possible; the relevant code to update is in RestService; update assuming that ReturnOnlyChanged is always true.
-        public bool ReturnOnlyChanged { get; set; } = false;
-
         [JsonConstructor]
         public MultiSaveRequest()
         {
@@ -292,7 +288,6 @@ namespace InABox.Clients
 
             writer.WriteObjects(Items);
             writer.Write(AuditNote);
-            writer.Write(ReturnOnlyChanged);
         }
 
         public override void DeserializeBinary(CoreBinaryReader reader)
@@ -301,7 +296,6 @@ namespace InABox.Clients
 
             Items = reader.ReadObjects<TEntity>().ToArray();
             AuditNote = reader.ReadString();
-            ReturnOnlyChanged = reader.ReadBoolean();
         }
     }
 

+ 2 - 2
InABox.Core/CoreUtils.cs

@@ -1655,7 +1655,7 @@ namespace InABox.Core
         public static bool IsEntityLinkValid<T, U>(this CoreRow arg, Expression<Func<T, U>> expression) where U : IEntityLink
         {
             var col = CoreUtils.GetFullPropertyName(expression, ".");
-            return arg.Get<Guid>(col + ".ID") != Guid.Empty && arg.Get<Guid>(col + ".Deleted") == Guid.Empty;
+            return arg.Get<Guid>(col + ".ID") != Guid.Empty;
         }
 
         /// <summary>
@@ -1670,7 +1670,7 @@ namespace InABox.Core
         {
             var col = CoreUtils.GetFullPropertyName(expression, ".");
             var id = arg.Get<Guid>(col + ".ID");
-            if (id != Guid.Empty && arg.Get<Guid>(col + ".Deleted") == Guid.Empty)
+            if (id != Guid.Empty)
                 return id;
             return null;
         }

+ 0 - 3
InABox.Core/DataModel/DataModel.cs

@@ -699,9 +699,6 @@ namespace InABox.Core
             return table.Sort;
         }
 
-        [Obsolete("Use SetColumns instead")]
-        public void SetTableColumns<TType>(Columns<TType> columns, string? alias = null) => SetColumns(columns, alias);
-
         public void SetFilter<TType>(Filter<TType>? filter, string? alias = null)
         {
             var table = GetDataModelTable<TType>(alias);

+ 0 - 22
InABox.Core/DigitalForms/Forms/BaseEntityForm.cs

@@ -34,30 +34,17 @@ namespace InABox.Core
 
         public abstract TParentLink Parent { get; }
 
-        [NullEditor]
-        [Obsolete("Being Replaced by Form")]
-        public QAFormLink QAForm => InitializeField(ref _qAForm, nameof(QAForm));
-        private QAFormLink _qAForm;
-
         [EditorSequence(1)]
         [EntityRelationship(DeleteAction.Cascade)]
         public DigitalFormLink Form => InitializeField(ref _form, nameof(Form));
         private DigitalFormLink _form;
 
-        [NullEditor]
-        [Obsolete("Being Replaced by FormData", true)]
-        public string QAData { get; set; }
-
         [NullEditor]
         public string FormData { get; set; }
 
         [NullEditor]
         public string? BlobData { get; set; }
 
-        [NullEditor]
-        [Obsolete("Being Replaced by FormCompleted", true)]
-        public DateTime QACompleted { get; set; }
-
         [EditorSequence(2)]
         [Caption("Started")]
         [DateTimeEditor]
@@ -78,19 +65,10 @@ namespace InABox.Core
         [DateTimeEditor]
         public DateTime FormCancelled { get; set; }
 
-        [NullEditor]
-        [Obsolete("Being Replaced by FormCompletedBy")]
-        public UserLink QACompletedBy => InitializeField(ref _qACompletedBy, nameof(QACompletedBy));
-        private UserLink _qACompletedBy;
-
         [EditorSequence(3)]
         [Caption("User")]
         public UserLink FormCompletedBy => InitializeField(ref _formCompletedBy, nameof(FormCompletedBy));
         private UserLink _formCompletedBy;
-
-        [NullEditor]
-        [Obsolete("Replaced with Status", true)]
-        public bool Processed { get; set; } = false;
         
         [NullEditor]
         public Location Location => InitializeField(ref _location, nameof(Location));

+ 0 - 9
InABox.Core/DigitalForms/Forms/DigitalFormLayout.cs

@@ -10,11 +10,6 @@ namespace InABox.Core
         CanView = typeof(CanView<DigitalForm>))]
     public class DigitalFormLayout : Entity, IRemotable, IPersistent, ILicense<DigitalFormsLicense>
     {
-        [NullEditor]
-        [Obsolete("Replaced by Form")]
-        public QAFormLink QAForm => InitializeField(ref _qAForm, nameof(QAForm));
-        private QAFormLink _qAForm;
-
         [NullEditor]
         [EntityRelationship(DeleteAction.Cascade)]
         public DigitalFormLink Form => InitializeField(ref _form, nameof(Form));
@@ -35,10 +30,6 @@ namespace InABox.Core
         [NullEditor]
         public bool Active { get; set; }
 
-        [Obsolete]
-        [NullEditor]
-        public string Code { get; set; }
-
         public IEntityDuplicator GetDuplicator() => new EntityDuplicator<DigitalFormLayout>();
         
     }

+ 0 - 9
InABox.Core/DigitalForms/Forms/DigitalFormVariable.cs

@@ -35,11 +35,6 @@ namespace InABox.Core
 
         private Type _variableType = typeof(DFLayoutStringField);
 
-        [NullEditor]
-        [Obsolete("Replaced with Form")]
-        public QAFormLink QAForm => InitializeField(ref _qAForm, nameof(QAForm));
-        private QAFormLink _qAForm;
-
         [NullEditor]
         [EntityRelationship(DeleteAction.Cascade)]
         public DigitalFormLink Form => InitializeField(ref _form, nameof(Form));
@@ -53,10 +48,6 @@ namespace InABox.Core
         [TextBoxEditor(Visible = Visible.Default, Editable = Editable.Disabled)]
         public string Description { get; set; }
 
-        [NullEditor]
-        [Obsolete("Use VariableType Instead!")]
-        public string Type { get; set; }
-
         [EditorSequence(3)]
         [ComboLookupEditor(typeof(VariableTypeLookupGenerator), Visible = Visible.Default, Editable = Editable.Disabled)]
         public string VariableType

+ 0 - 3
InABox.Core/DigitalForms/Forms/IDigitalForm.cs

@@ -8,9 +8,6 @@ namespace InABox.Core
 
     public interface IDigitalForm<T> : IDigitalForm
     {
-        [Obsolete("Being Replaced with Form", true)]
-        QAFormLink QAForm { get; }
-
         DigitalFormLink Form { get; }
     }
 }

+ 0 - 12
InABox.Core/DigitalForms/Forms/IDigitalFormInstance.cs

@@ -15,12 +15,6 @@ namespace InABox.Core
     
     public interface ICoreDigitalFormInstance : IBaseDigitalFormInstance
     {
-        [Obsolete("Replaced with Form", true)]
-        QAFormLink QAForm { get; }
-        
-        [Obsolete("Replaced with FormData", true)]
-        string QAData { get; set; }
-        
         String Number { get; set; }
         
         String Description { get; set; }
@@ -29,12 +23,6 @@ namespace InABox.Core
 
         string? BlobData { get; set; }
 
-        [Obsolete("Replaced with FormCompleted", true)]
-        DateTime QACompleted { get; set; }
-        
-        [Obsolete("Replaced with FormCompletedBy", true)]
-        UserLink QACompletedBy { get; }
-
         UserLink FormCompletedBy { get; }
 
         Location Location { get; }

+ 0 - 9
InABox.Core/DigitalForms/Obsolete/QAForm.cs

@@ -1,9 +0,0 @@
-using System;
-
-namespace InABox.Core
-{
-    [Obsolete("Being Replaced with DigitalForm", true)]
-    public class QAForm : DigitalForm
-    {
-    }
-}

+ 0 - 9
InABox.Core/DigitalForms/Obsolete/QAFormLayout.cs

@@ -1,9 +0,0 @@
-using System;
-
-namespace InABox.Core
-{
-    [Obsolete("Being Replaced with DigitalFormLayout", true)]
-    public class QAFormLayout : DigitalFormLayout
-    {
-    }
-}

+ 0 - 9
InABox.Core/DigitalForms/Obsolete/QAFormLink.cs

@@ -1,9 +0,0 @@
-using System;
-
-namespace InABox.Core
-{
-    [Obsolete("Being Replaced By DigitalFormLink")]
-    public class QAFormLink : DigitalFormLink
-    {
-    }
-}

+ 0 - 25
InABox.Core/DigitalForms/Obsolete/QAFormLookups.cs

@@ -1,25 +0,0 @@
-using System;
-
-namespace InABox.Core
-{
-    [Obsolete("Being Replaced with DigitalFormLookups", true)]
-    public class QAFormLookups : EntityLookup<QAForm>
-    {
-        public override Columns<QAForm> DefineColumns()
-        {
-            return base.DefineColumns()
-                .Add(x => x.Description)
-                .Add(x => x.AppliesTo);
-        }
-
-        public override Filter<QAForm> DefineFilter()
-        {
-            return null;
-        }
-
-        public override SortOrder<QAForm> DefineSortOrder()
-        {
-            return new SortOrder<QAForm>(x => x.Description);
-        }
-    }
-}

+ 0 - 5
InABox.Core/DigitalForms/Obsolete/QAQuestion.cs

@@ -13,11 +13,6 @@ namespace InABox.Core
             Answer = QAAnswer.Comment;
         }
 
-        [NullEditor]
-        [Obsolete("Replaced with Form")]
-        public QAFormLink QAForm => InitializeField(ref _qAForm, nameof(QAForm));
-        private QAFormLink? _qAForm;
-
         public DigitalFormLink Form => InitializeField(ref _form, nameof(Form));
         private DigitalFormLink? _form;
 

+ 0 - 9
InABox.Core/DigitalForms/Obsolete/QAVariable.cs

@@ -1,9 +0,0 @@
-using System;
-
-namespace InABox.Core
-{
-    [Obsolete("Being Replaced with DigitalFormVariable", true)]
-    public class QAVariable : DigitalFormVariable
-    {
-    }
-}

+ 0 - 3
InABox.Core/Objects/Attributes/Aggregate.cs

@@ -879,9 +879,6 @@ namespace InABox.Core
         /// </summary>
         Maximum,
         
-        [Obsolete]
-        Constant,
-        
         /// <summary>
         /// Formats all the operands using the first string
         /// </summary>

+ 1 - 11
InABox.Core/Objects/Entity.cs

@@ -21,8 +21,6 @@ namespace InABox.Core
     {
         Guid ID { get; set; }
 
-        Guid Deleted { get; set; }
-
         bool IsChanged();
 
         void CommitChanges();
@@ -233,14 +231,6 @@ namespace InABox.Core
         [RequiredColumn]
         public Guid ID { get; set; } = Guid.Empty;
 
-        /// <summary>
-        /// If the entity is deleted, holds the ID of the Deletion. Otherwise, it holds Guid.Empty
-        /// </summary>
-        [NullEditor]
-        [DoNotSerialize]
-        [Obsolete]
-        public Guid Deleted { get; set; } = Guid.Empty;
-
         public static Type ClassVersion(Type t)
         {
             //Type t = MethodBase.GetCurrentMethod().DeclaringType;
@@ -298,7 +288,7 @@ namespace InABox.Core
         {
             var col = CoreUtils.GetFullPropertyName(expression, ".");
             var id = arg.Get<Guid>(col + ".ID");
-            if (id != Guid.Empty && arg.Get<Guid>(col + ".Deleted") == Guid.Empty)
+            if (id != Guid.Empty)
                 return id;
             return null;
         }

+ 0 - 6
InABox.Core/Objects/EntityLink.cs

@@ -8,8 +8,6 @@ namespace InABox.Core
     public interface IEntityLink : ISubObject
     {
         Guid ID { get; set; }
-        
-        Guid Deleted { get; set; }
 
         bool Clear();
         bool IsValid();
@@ -68,10 +66,6 @@ namespace InABox.Core
 
         [NullEditor]
         public abstract Guid ID { get; set; }
-        
-        [NullEditor]
-        [Obsolete]
-        public Guid Deleted { get; set; }
 
         /// <summary>
         /// Basically do the same as <see cref="Synchronise(object)"/>, but also copy the <see cref="ID"/>.

+ 0 - 5
InABox.Database/IProvider.cs

@@ -53,11 +53,6 @@ public interface IProvider
     
     CoreTable Query(Type type, IFilter? filter = null, IColumns? columns = null, ISortOrder? sort = null, 
         CoreRange? range = null, bool log = false, bool distinct = false);
-    
-    /// <summary>
-    /// Same as <see cref="Query{T}(Filter{T}, Columns{T}, SortOrder{T}, CoreRange, bool, bool)"/>, but only for deleted items
-    /// </summary>
-    CoreTable QueryDeleted<T>(Deletion deletion, Filter<T>? filter = null, Columns<T>? columns = null, SortOrder<T>? sort = null, CoreRange? range = null, bool deleted = false) where T : Entity, new();
 
     T[] Load<T>(Filter<T>? filter = null, SortOrder<T>? sort = null, CoreRange? range = null) where T : Entity, new();
 

+ 17 - 24
InABox.Server/RestService.cs

@@ -121,8 +121,8 @@ namespace InABox.API
                 }
                 else
                 {
-                    var userID = request.UserID ?? request.Credentials.UserID;
-                    var password = request.Password ?? request.Credentials.Password;
+                    var userID = request.UserID;
+                    var password = request.Password;
                     if (userID == null || password == null)
                         return response.Status(StatusCode.Error);
                     user = CredentialsCache.ValidateUser(userID, password);
@@ -391,38 +391,31 @@ namespace InABox.API
 
                 store.Save(es, request.AuditNote);
 
-                if (request.ReturnOnlyChanged)
-                {                  
-                    for (int i = 0; i < es.Length; ++i)
-                    {
-                        var result = new Dictionary<string, object>();
+                for (int i = 0; i < es.Length; ++i)
+                {
+                    var result = new Dictionary<string, object>();
 
-                        var e = es[i];
+                    var e = es[i];
 
-                        var currentChanges = BaseObjectExtensions.GetOriginaValues(e);
+                    var currentChanges = BaseObjectExtensions.GetOriginaValues(e);
 
-                        var preSaveChanges = originals[e];
+                    var preSaveChanges = originals[e];
 
-                        foreach (var (key, value) in currentChanges)
+                    foreach (var (key, value) in currentChanges)
+                    {
+                        if (preSaveChanges.TryGetValue(key, out var oldValue))
                         {
-                            if (preSaveChanges.TryGetValue(key, out var oldValue))
-                            {
-                                if (!Equals(value, oldValue))
-                                {
-                                    result[key] = CoreUtils.GetPropertyValue(e, key);
-                                }
-                            }
-                            else
+                            if (!Equals(value, oldValue))
                             {
                                 result[key] = CoreUtils.GetPropertyValue(e, key);
                             }
                         }
-                        response.ChangedValues.Add(result);
+                        else
+                        {
+                            result[key] = CoreUtils.GetPropertyValue(e, key);
+                        }
                     }
-                }
-                else
-                {
-                    response.Items = es;
+                    response.ChangedValues.Add(result);
                 }
 
                 response.Status = StatusCode.OK;

+ 1 - 4
inabox.client.ipc/IPCClient.cs

@@ -247,10 +247,7 @@ namespace InABox.IPC
         protected override void DoSave(IEnumerable<TEntity> entities, string auditnote)
         {
             var items = entities.ToArray();
-            var request = new MultiSaveRequest<TEntity>(items, auditnote)
-            {
-                ReturnOnlyChanged = true
-            };
+            var request = new MultiSaveRequest<TEntity>(items, auditnote);
             PrepareRequest(request);
 
             var response = Send(IPCMessage.MultiSave(request)).GetResponse<MultiSaveResponse<TEntity>>();

+ 0 - 1
inabox.client.rest/InABox.Client.Rest/RestClient.cs

@@ -423,7 +423,6 @@ namespace InABox.Clients
         {
             var items = entities.ToArray();
             var request = new MultiSaveRequest<TEntity>(items, auditnote);
-            request.ReturnOnlyChanged = true;
 
             PrepareRequest(request);
 

+ 0 - 16
inabox.database.sqlite/SQLiteProvider.cs

@@ -2272,9 +2272,6 @@ public class SQLiteProvider : IProvider
     {
         if (attribute.Operator == FormulaOperator.None)
             throw new Exception(string.Format("{0}.{1} is not a valid formula", columnname, attribute.Calculator.GetType().Name));
-        
-        if (attribute.Operator == FormulaOperator.Constant)
-            return EscapeValue(attribute.Value);
 
 // Crashes when value is a constant, and therefore not a field in the table        
 //        if (!fieldmap.ContainsKey(attribute.Value))
@@ -2560,7 +2557,6 @@ public class SQLiteProvider : IProvider
                     case FormulaOperator.Minumum:
                         return $"MIN({string.Join(',', operands)})";
                     case FormulaOperator.None:
-                    case FormulaOperator.Constant:
                     default:
                         throw new Exception($"Invalid formula of type {op}.");
                 }
@@ -3398,18 +3394,6 @@ public class SQLiteProvider : IProvider
         return DoQuery(filter, columns, sort, range, log, distinct);
     }
 
-    [Obsolete]
-    public CoreTable QueryDeleted<T>(Deletion deletion, Filter<T>? filter = null, Columns<T>? columns = null, SortOrder<T>? sort = null, CoreRange? range = null, bool log = false)
-        where T : Entity, new()
-    {
-        if (filter != null)
-            filter.And(x => x.Deleted).IsEqualTo(deletion.ID);
-        else
-            filter = Filter<T>.Where(x => x.Deleted).IsEqualTo(deletion.ID);
-
-        return DoQuery(filter, columns, sort, range, false, false);
-    }
-
     private void ReadAndDecodeValue(CoreTable result, SQLiteDataReader reader, CoreRow row, int i)
     {
         var value = reader.GetValue(i);