Пример #1
0
        public override void Validate(ValidationContext validationContext)
        {
            try
            {
                // validate the processBlock constraints
                base.Validate(validationContext);

                // the startState is required
                validationContext.Check((_startState != null), "the process definition does not have a start-state");
                validationContext.Check((_endState != null), "the process definition does not have an end-state");

                // the endState is not allowed to have leaving transitions
                validationContext.Check((_endState.LeavingTransitions.Count == 0), "the end-state of the process definition has leaving transitions");
                validationContext.Check((_startState.ArrivingTransitions.Count == 0), "the start-state of the process definition has arriving transitions");

                // check if all image attributes are supplied or none at all
                validationContext.Check(((_image == null) && ((Object)_imageMimeType == null) && (_imageHeight == 0) && (_imageWidth == 0)) || ((_image != null) && ((Object)_imageMimeType != null) && (_imageHeight != 0) && (_imageWidth != 0)), "all image attributes (name,mime-type,width&height) must be supplied or none at all (@see web/webinterface.xml)");

                // this catch allows the validation to throw runtime exceptions if the cause
                // is already added as an error.  (mainly to avoid if-then-else in the
                // validation code to avoid NullPointerExceptions)
            }
            catch (SystemException e)
            {
                validationContext.AddError("couldn't continue validation : " + e.GetType().FullName + " : " + e.Message);
            }
        }
Пример #2
0
		public override void Validate(ValidationContext validationContext)
		{
			try
			{
				// validate the processBlock constraints
				base.Validate(validationContext);

				// the startState is required
				validationContext.Check((_startState != null), "the process definition does not have a start-state");
				validationContext.Check((_endState != null), "the process definition does not have an end-state");

				// the endState is not allowed to have leaving transitions
				validationContext.Check((_endState.LeavingTransitions.Count == 0), "the end-state of the process definition has leaving transitions");
				validationContext.Check((_startState.ArrivingTransitions.Count == 0), "the start-state of the process definition has arriving transitions");

				// check if all image attributes are supplied or none at all
				validationContext.Check(((_image == null) && ((Object) _imageMimeType == null) && (_imageHeight == 0) && (_imageWidth == 0)) || ((_image != null) && ((Object) _imageMimeType != null) && (_imageHeight != 0) && (_imageWidth != 0)), "all image attributes (name,mime-type,width&height) must be supplied or none at all (@see web/webinterface.xml)");

				// this catch allows the validation to throw runtime exceptions if the cause
				// is already added as an error.  (mainly to avoid if-then-else in the
				// validation code to avoid NullPointerExceptions)
			}
			catch (SystemException e)
			{
				validationContext.AddError("couldn't continue validation : " + e.GetType().FullName + " : " + e.Message);
			}
		}