Exemplo n.º 1
0
        private string GetNewValue(Net.Vpc.Upa.Field field) /* throws Net.Vpc.Upa.Exceptions.UPAException */
        {
            Net.Vpc.Upa.Entity entity = field.GetEntity();
            string             idName = field.GetName();

            Net.Vpc.Upa.Entity seq = entity.GetPersistenceUnit().GetEntity(Net.Vpc.Upa.Impl.PrivateSequence.ENTITY_NAME);
            Net.Vpc.Upa.Impl.SequenceManager sm = new Net.Vpc.Upa.Impl.EntitySequenceManager(seq);
            string sequenceGroup = Eval(field, this.group, "{#}");

            while (true)
            {
                string nextIdString = Eval(field, this.format, sm.NextValue(name, sequenceGroup, this.initialValue, this.allocationSize));
                long   count        = entity.GetEntityCount(new Net.Vpc.Upa.Expressions.Equals(new Net.Vpc.Upa.Expressions.Var(idName), nextIdString));
                if (count == 0)
                {
                    return(nextIdString);
                }
            }
        }