Name and descroption, and etc. of methods of obtaining data like: Measurement, Observation, Processing, Simulation, Interpretation and Description
Inheritance: BaseEntity
Beispiel #1
0
        public bool Delete(ObtainingMethod entity)
        {
            Contract.Requires(entity != null);
            Contract.Requires(entity.Id >= 0);

            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository<ObtainingMethod> repo = uow.GetRepository<ObtainingMethod>();

                entity = repo.Reload(entity);
                //relation to DataContainer is managed by the other end
                repo.Delete(entity);
                uow.Commit();
            }
            // if any problem was detected during the commit, an exception will be thrown!
            return (true);
        }
Beispiel #2
0
        public ObtainingMethod Create(string name, string description)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(name));
            Contract.Ensures(Contract.Result<ObtainingMethod>() != null && Contract.Result<ObtainingMethod>().Id >= 0);

            ObtainingMethod u = new ObtainingMethod()
            {
                Name = name,
                Description = description,
            };

            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository<ObtainingMethod> repo = uow.GetRepository<ObtainingMethod>();
                repo.Put(u);
                uow.Commit();
            }
            return (u);
        }
Beispiel #3
0
        public ObtainingMethod Update(ObtainingMethod entity)
        {
            Contract.Requires(entity != null, "provided entity can not be null");
            Contract.Requires(entity.Id >= 0, "provided entity must have a permant ID");

            Contract.Ensures(Contract.Result<ObtainingMethod>() != null && Contract.Result<ObtainingMethod>().Id >= 0, "No entity is persisted!");

            using (IUnitOfWork uow = entity.GetUnitOfWork())
            {
                IRepository<ObtainingMethod> repo = uow.GetRepository<ObtainingMethod>();
                repo.Put(entity); // Merge is required here!!!!
                uow.Commit();
            }
            return (entity);
        }
Beispiel #4
0
        /// <summary>
        /// This method creates a variable value and returns it without persisting the object in the database. Usually the returned variable value should be added to a data tuple which in turn is belonging to a data set version.
        /// A value is a compound object holding information about a single event (sampling). The event can be a(n) measurement, observation, estimation, simulation, or computation of a feature of an entity.
        /// The value can be a assigned to a variable or a parameter based on the design of the data structure.
        /// </summary>
        /// <param name="value">The result of the event which can be a(n) measurement, observation, estimation, simulation, or computation</param>
        /// <param name="note">A free format, but short, description about the value</param>
        /// <param name="samplingTime">The exact time of the start of the event. It shows when the sampling is started.</param>
        /// <param name="resultTime">The sampling, or the processing may take time (like in the computation or simulation cases), also some devices/ sensors have a response time. The parameter captures the time when the result (value) is ready.
        /// The result time and its difference to sampling time are important for some analyses.
        /// </param>
        /// <param name="obtainingMethod">Determines how the values is obtained, which is one of the measurement, observation, estimation, simulation, or computation cases.</param>
        /// <param name="variableId">The identifier of the variable that the value is belonging to.</param>
        /// <param name="parameterValues">If the variable has parameters attached, the parameter values are passed alongside, so that the method links them to their corresponding variable value using <paramref name="variableId"/>.</param>
        /// <returns>A transient object of type <seealso cref="VariableValue"/>.</returns>
        public VariableValue CreateVariableValue(string value, string note, DateTime samplingTime, DateTime resultTime, ObtainingMethod obtainingMethod, Int64 variableId, ICollection<ParameterValue> parameterValues)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(value));
            Contract.Requires(variableId > 0);
            Contract.Ensures(Contract.Result<VariableValue>() != null);

            VariableValue e = new VariableValue()
            {
                Value = value,
                Note = note,
                SamplingTime = samplingTime,
                ResultTime = resultTime,
                ObtainingMethod = obtainingMethod,
                VariableId = variableId,
                ParameterValues = new List<ParameterValue>(parameterValues),
            };

            //using (IUnitOfWork uow = this.GetUnitOfWork())
            //{
            //    IRepository<VariableValue> repo = uow.GetRepository<VariableValue>();
            //    repo.Put(e);
            //    uow.Commit();
            //}
            return (e);
        }
Beispiel #5
0
        /// <summary>
        /// Creates a parameter value similar to <see cref="CreateVariableValue"/>.
        /// </summary>
        /// <param name="value"></param>
        /// <param name="note"></param>
        /// <param name="samplingTime"></param>
        /// <param name="resultTime"></param>
        /// <param name="obtainingMethod"></param>
        /// <param name="parameterId"></param>
        /// <returns>A transient object of type <seealso cref="ParameterValue"/>.</returns>
        public ParameterValue CreateParameterValue(string value, string note, DateTime samplingTime, DateTime resultTime, ObtainingMethod obtainingMethod, Int64 parameterId)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(value));
            Contract.Requires(parameterId > 0);
            Contract.Ensures(Contract.Result<ParameterValue>() != null);

            ParameterValue e = new ParameterValue()
            {
                Value = value,
                Note = note,
                SamplingTime = samplingTime,
                ResultTime = resultTime,
                ObtainingMethod = obtainingMethod,
                ParameterId = parameterId,
            };

            //using (IUnitOfWork uow = this.GetUnitOfWork())
            //{
            //    IRepository<ParameterValue> repo = uow.GetRepository<ParameterValue>();
            //    repo.Put(e);
            //    uow.Commit();
            //}
            return (e);
        }
Beispiel #6
0
        /// <summary>
        /// An extended property is a custom property that is assigned to a dataset version in addition to the predefined properties. Then each dataset version owner/ accessor 
        /// can provide a value for the attached properties.
        /// </summary>
        /// <param name="extendedPropertyId">The identifier of the extended property.</param>
        /// <param name="value">The value to be assigned to the extended property of the dataset version.</param>
        /// <param name="note"><see cref="DataValue"/></param>
        /// <param name="samplingTime"><see cref="DataValue"/></param>
        /// <param name="resultTime"><see cref="DataValue"/></param>
        /// <param name="obtainingMethod"><see cref="DataValue"/></param>
        /// <param name="datasetVersion">The dataset version receiving the property value</param>
        /// <returns>The extended property value linked to its <see cref="ExtendedProperty"/> and the <see cref="DatasetVersion"/></returns>
        public ExtendedPropertyValue CreateExtendedPropertyValue(Int64 extendedPropertyId, string value, string note, DateTime samplingTime, DateTime resultTime, ObtainingMethod obtainingMethod,
            DatasetVersion datasetVersion)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(value));
            Contract.Requires(extendedPropertyId > 0);
            Contract.Requires(datasetVersion != null);

            Contract.Ensures(Contract.Result<ExtendedPropertyValue>() != null);
            ExtendedPropertyValue e = new ExtendedPropertyValue()
            {
                Value = value,
                Note = note,
                SamplingTime = samplingTime,
                ResultTime = resultTime,
                ObtainingMethod = obtainingMethod,
                ExtendedPropertyId = extendedPropertyId,
                DatasetVersion = datasetVersion, // subject to delete
            };
            e.DatasetVersion.ExtendedPropertyValues.Add(e);

            //using (IUnitOfWork uow = this.GetUnitOfWork())
            //{
            //    IRepository<ExtendedPropertyValue> repo = uow.GetRepository<ExtendedPropertyValue>();
            //    repo.Put(e);
            //    uow.Commit();
            //}
            return (e);
        }
Beispiel #7
0
        /// <summary>
        /// An amendment is like a variable value that is added to a data tuple. The difference is that the amendment does not need to be defined in the dataset's structure 
        /// and also not all the data tuples need to have the same amendments.
        /// This method creates and amendment object, attaches it to the data tuple but does <b>NOT</b> persist it.
        /// </summary>
        /// <param name="value"><see cref="DataValue"/></param>
        /// <param name="note"><see cref="DataValue"/></param>
        /// <param name="samplingTime"><see cref="DataValue"/></param>
        /// <param name="resultTime"><see cref="DataValue"/></param>
        /// <param name="obtainingMethod"><see cref="DataValue"/></param>
        /// <param name="parameterId">The identifier of the parameter that the amendment will be linked to. needs more clarification</param>
        /// <param name="tuple">The data tuple receiving the amendment.ku</param>
        /// <returns></returns>
        public Amendment CreateAmendment(string value, string note, DateTime samplingTime, DateTime resultTime, ObtainingMethod obtainingMethod, Int64 parameterId, DataTuple tuple)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(value));
            Contract.Requires(parameterId > 0);
            Contract.Requires(tuple != null);
            Contract.Ensures(Contract.Result<Amendment>() != null);

            Amendment e = new Amendment()
            {
                Value = value,
                Note = note,
                SamplingTime = samplingTime,
                ResultTime = resultTime,
                ObtainingMethod = obtainingMethod,
                ParameterId = parameterId,
                Tuple = tuple,
            };

            //using (IUnitOfWork uow = this.GetUnitOfWork())
            //{
            //    IRepository<Amendment> repo = uow.GetRepository<Amendment>();
            //    repo.Put(e);
            //    uow.Commit();
            //}
            return (e);
        }