Exemple #1
0
        //private const String queryFindAttributeInstanceByName = "select ai " +
        //    "from ai in class NetBpm.Workflow.Execution.Impl.AttributeInstanceImpl, " +
        //    "     f in class NetBpm.Workflow.Execution.Impl.FlowImpl " +
        //    "where ai.Scope = f.id " + "  and ai.Attribute.Name = ? " +
        //    "  and f.id = ? ";

        private AttributeInstanceImpl FindAttributeInstanceInScope(String attributeName)
        {
            AttributeInstanceImpl attributeInstance = null;
            FlowImpl scope = this._flow;

            while (attributeInstance == null)
            {
                IList       attributes = attributeRepository.FindAttributeInstanceByName(attributeName, scope.Id, _dbSession);
                IEnumerator iter       = attributes.GetEnumerator();
                if (iter.MoveNext())
                {
                    attributeInstance = (AttributeInstanceImpl)iter.Current;
                    if (iter.MoveNext())
                    {
                        throw new NetBpm.Util.DB.DbException("duplicate value");
                    }
                }
                else
                {
                    if (!scope.IsRootFlow())
                    {
                        scope = (FlowImpl)scope.Parent;
                    }
                    else
                    {
                        //throw new RuntimeException( "couldn't find attribute-instance '" + attributeName + "' in scope of flow '" + this.flow + "'" );
                        // log a warning message (indicate that attribute supplied is not defined in attribute-instance in db)
                        log.Warn("couldn't find attribute-instance '" + attributeName + "' in scope of flow '" + this._flow + "'");
                        break;
                    }
                }
            }
            return(attributeInstance);
        }