Ejemplo n.º 1
0
        }       //	updateInfoColumns

        /// <summary>
        /// Fire Document Validation.
        /// Call docValidate method of added validators
        /// </summary>
        /// <param name="po">persistent objects</param>
        /// <param name="docTiming">see ModalValidatorVariables.DOCTIMING_ constants</param>
        /// <returns>error message or null</returns>
        public String FireDocValidate(PO po, int docTiming)
        {
            if (po == null || _docValidateListeners.Count == 0)
            {
                return(null);
            }
            //
            String propertyName        = po.Get_TableName() + po.GetAD_Client_ID();
            List <ModelValidator> list = null;

            if (_docValidateListeners.ContainsKey(propertyName))
            {
                list = new List <ModelValidator>();
                list = _docValidateListeners[propertyName];
            }
            if (list == null || list.Count == 0)
            {
                return(null);
            }

            //
            for (int i = 0; i < list.Count; i++)
            {
                ModelValidator validator = null;
                try
                {
                    validator = (ModelValidator)list[i];
                    if (validator.GetAD_Client_ID() == po.GetAD_Client_ID())
                    {
                        String error = validator.DocValidate(po, docTiming);
                        if (error != null && error.Length > 0)
                        {
                            return(error);
                        }
                    }
                }
                catch (Exception e)
                {
                    s_log.Log(Level.SEVERE, validator.ToString(), e);
                }
            }
            return(null);
        }