Ejemplo n.º 1
0
        /// <summary>
        /// Implements IModelErrorOwner.GetErrorCollection
        /// </summary>
        protected new IEnumerable <ModelErrorUsage> GetErrorCollection(ModelErrorUses filter)
        {
            if (filter == 0)
            {
                filter = (ModelErrorUses)(-1);
            }
            if (0 != (filter & (ModelErrorUses.Verbalize | ModelErrorUses.DisplayPrimary)))
            {
                CardinalityRangeOverlapError overlapError = CardinalityRangeOverlapError;
                if (overlapError != null)
                {
                    yield return(overlapError);
                }
                ConstraintDuplicateNameError duplicateName = DuplicateNameError;
                if (duplicateName != null)
                {
                    yield return(duplicateName);
                }
            }

            // Get errors off the base
            foreach (ModelErrorUsage baseError in base.GetErrorCollection(filter))
            {
                yield return(baseError);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a ModelErrorUsage structure
 /// </summary>
 /// <param name="error">The error. Cannot be null.</param>
 /// <param name="uses">Specifies how the error is used</param>
 public ModelErrorUsage(ModelError error, ModelErrorUses uses)
 {
     if (error == null)
     {
         throw new ArgumentNullException("error");
     }
     myError = error;
     myUses  = uses;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Implements IModelErrorOwner.GetErrorCollection
 /// </summary>
 protected IEnumerable <ModelErrorUsage> GetErrorCollection(ModelErrorUses filter)
 {
     if (filter == 0 || (0 != (filter & (ModelErrorUses.Verbalize | ModelErrorUses.DisplayPrimary))))
     {
         foreach (ModelError modelError in ORMModelElementHasExtensionModelError.GetExtensionModelErrorCollection(this))
         {
             yield return(new ModelErrorUsage(modelError));
         }
     }
 }
Ejemplo n.º 4
0
		/// <summary>
		/// Implements IModelErrorOwner.GetErrorCollection
		/// </summary>
		protected IEnumerable<ModelErrorUsage> GetErrorCollection(ModelErrorUses filter)
		{
			if (filter == 0 || (0 != (filter & (ModelErrorUses.Verbalize | ModelErrorUses.DisplayPrimary))))
			{
				foreach (ModelError modelError in ORMModelElementHasExtensionModelError.GetExtensionModelErrorCollection(this))
				{
					yield return new ModelErrorUsage(modelError);
				}
			}
		}
Ejemplo n.º 5
0
        /// <summary>
        /// Checks to see if the Model Element contains errors
        /// </summary>
        /// <param name="modelElement">Any <see cref="ModelElement"/>. Errors may be reported if the element implements <see cref="IModelErrorOwner"/></param>
        /// <param name="useFilter">The filter for the error being displayed. See <see cref="ModelErrorUses"/> for more information.</param>
        /// <param name="displayFilter">The <see cref="ModelErrorDisplayFilter"/> filter to determine if errors should be displayed or not.</param>
        /// <returns>Returns <see langword="true"/> if the errors are present for the provided filters</returns>
        public static bool HasErrors(ModelElement modelElement, ModelErrorUses useFilter, ModelErrorDisplayFilter displayFilter)
        {
            bool             hasError   = false;
            IModelErrorOwner errorOwner = modelElement as IModelErrorOwner;

            if (errorOwner != null)
            {
                foreach (ModelErrorUsage usage in errorOwner.GetErrorCollection(useFilter))
                {
                    if (ModelError.IsDisplayed(usage.Error, displayFilter))
                    {
                        hasError = true;
                        break;
                    }
                }
            }
            return(hasError);
        }
Ejemplo n.º 6
0
 IEnumerable <ModelErrorUsage> IModelErrorOwner.GetErrorCollection(ModelErrorUses filter)
 {
     return(GetErrorCollection(filter));
 }
Ejemplo n.º 7
0
		IEnumerable<ModelErrorUsage> IModelErrorOwner.GetErrorCollection(ModelErrorUses filter)
		{
			return GetErrorCollection(filter);
		}
Ejemplo n.º 8
0
 /// <summary>
 /// Checks to see if the Model Element contains errors
 /// </summary>
 /// <param name="modelElement">Any <see cref="ModelElement"/>. Errors may be reported if the element implements <see cref="IModelErrorOwner"/></param>
 /// <param name="useFilter">The filter for the error being displayed. See <see cref="ModelErrorUses"/> for more information.</param>
 /// <returns>Returns <see langword="true"/> if the errors are present for the provided filters</returns>
 public static bool HasErrors(ModelElement modelElement, ModelErrorUses useFilter)
 {
     return(HasErrors(modelElement, useFilter, null));
 }
Ejemplo n.º 9
0
		/// <summary>
		/// Implements IModelErrorOwner.GetErrorCollection
		/// </summary>
		protected new IEnumerable<ModelErrorUsage> GetErrorCollection(ModelErrorUses filter)
		{
			if (filter == 0)
			{
				filter = (ModelErrorUses)(-1);
			}
			if (0 != (filter & (ModelErrorUses.Verbalize | ModelErrorUses.DisplayPrimary)))
			{
				RolePlayerRequiredError requiredError;
				if (null != (requiredError = RolePlayerRequiredError))
				{
					yield return requiredError;
				}
				foreach (ConstraintRoleSequence sequence in ConstraintRoleSequenceCollection)
				{
					MandatoryConstraint mandatoryConstraint = sequence as MandatoryConstraint;
					if (mandatoryConstraint != null)
					{
						foreach (PopulationMandatoryError populationMandatoryError in mandatoryConstraint.PopulationMandatoryErrorCollection)
						{
							yield return populationMandatoryError;
						}
					}
				}
			}
			if (filter == (ModelErrorUses)(-1))
			{
				ReadOnlyCollection<RoleInstance> roleInstances = RoleInstance.GetLinksToObjectTypeInstanceCollection(this);
				int roleInstanceCount = roleInstances.Count;
				for (int i = 0; i < roleInstanceCount; ++i)
				{
					PopulationUniquenessError error = roleInstances[i].PopulationUniquenessError;
					if (error != null)
					{
						yield return error;
					}
				}
			}
			// Get errors off the base
			foreach (ModelErrorUsage baseError in base.GetErrorCollection(filter))
			{
				yield return baseError;
			}
		}
Ejemplo n.º 10
0
		/// <summary>
		/// Returns the errors associated with the Reading.
		/// </summary>
		protected new IEnumerable<ModelErrorUsage> GetErrorCollection(ModelErrorUses filter)
		{
			if (filter == 0)
			{
				filter = (ModelErrorUses)(-1);
			}
			if (0 != (filter & (ModelErrorUses.BlockVerbalization | ModelErrorUses.DisplayPrimary)))
			{
				TooFewReadingRolesError tooFew;
				if (null != (tooFew = TooFewRolesError))
				{
					yield return new ModelErrorUsage(tooFew, ModelErrorUses.BlockVerbalization | ModelErrorUses.DisplayPrimary);
				}
			}
			if (0 != (filter & (ModelErrorUses.Verbalize | ModelErrorUses.DisplayPrimary)))
			{
				TooManyReadingRolesError tooMany;
				if (null != (tooMany = TooManyRolesError))
				{
					yield return new ModelErrorUsage(tooMany, ModelErrorUses.Verbalize | ModelErrorUses.DisplayPrimary);
				}
				ReadingRequiresUserModificationError userModificationRequired;
				if (null != (userModificationRequired = RequiresUserModificationError))
				{
					yield return new ModelErrorUsage(userModificationRequired, ModelErrorUses.Verbalize | ModelErrorUses.DisplayPrimary);
				}
			}
			// Get errors off the base
			foreach (ModelErrorUsage baseError in base.GetErrorCollection(filter))
			{
				yield return baseError;
			}
		}