Esempio n. 1
0
 public Sequence(Net.Vpc.Upa.SequenceStrategy strategy, int seed, int allocationSize, string name, string group, string format)
 {
     this.strategy       = strategy;
     this.initialValue   = seed;
     this.allocationSize = allocationSize;
     this.format         = format;
     this.group          = group;
     this.name           = name;
 }
Esempio n. 2
0
 public virtual void MergeSequence(Net.Vpc.Upa.Config.Decoration gid)
 {
     specified = true;
     if (gid.GetConfig().GetOrder() >= configOrder)
     {
         specified = true;
         if (gid.GetInt("allocationSize") != System.Int32.MinValue)
         {
             allocationSize = gid.GetInt("allocationSize");
         }
         if (gid.GetInt("initialValue") != System.Int32.MinValue)
         {
             initialValue = gid.GetInt("initialValue");
         }
         if ((gid.GetString("format")).Length > 0)
         {
             format = gid.GetString("format");
         }
         if ((gid.GetString("group")).Length > 0)
         {
             group = gid.GetString("group");
         }
         if (!System.Collections.Generic.EqualityComparer <Net.Vpc.Upa.SequenceType> .Default.Equals(gid.GetEnum <Net.Vpc.Upa.SequenceType>("type", typeof(Net.Vpc.Upa.SequenceType)), Net.Vpc.Upa.SequenceType.DEFAULT))
         {
             sequenceType = gid.GetEnum <Net.Vpc.Upa.SequenceType>("type", typeof(Net.Vpc.Upa.SequenceType));
         }
         if ((gid.GetString("name")).Length > 0)
         {
             name = gid.GetString("name");
         }
         if (!System.Collections.Generic.EqualityComparer <Net.Vpc.Upa.SequenceStrategy> .Default.Equals(gid.GetEnum <Net.Vpc.Upa.SequenceStrategy>("strategy", typeof(Net.Vpc.Upa.SequenceStrategy)), Net.Vpc.Upa.SequenceStrategy.UNSPECIFIED))
         {
             strategy = gid.GetEnum <Net.Vpc.Upa.SequenceStrategy>("strategy", typeof(Net.Vpc.Upa.SequenceStrategy));
         }
         if (gid.GetInt("formulaOrder") != System.Int32.MinValue)
         {
             formulaOrder = gid.GetInt("formulaOrder");
         }
         if (gid.GetConfig().GetOrder() > configOrder)
         {
             configOrder = gid.GetConfig().GetOrder();
         }
     }
 }
        public override void OnPreModelChanged(Net.Vpc.Upa.Callbacks.PersistenceUnitEvent @event)
        {
            foreach (Net.Vpc.Upa.Entity entity in outer.GetEntities())
            {
                if (entity.GetShield().IsLockingSupported())
                {
                    if (!outer.ContainsEntity(Net.Vpc.Upa.Impl.LockInfoDesc.LOCK_INFO_ENTITY_NAME))
                    {
                        outer.AddEntity(typeof(Net.Vpc.Upa.Impl.LockInfoDesc));
                    }
                    outer.AddLockingSupport(entity);
                }
                System.Collections.Generic.IList <Net.Vpc.Upa.Field> fields = entity.GetFields();
                bool privateSeq = false;
                foreach (Net.Vpc.Upa.Field field in fields)
                {
                    System.Collections.Generic.List <Net.Vpc.Upa.Sequence> seqs = new System.Collections.Generic.List <Net.Vpc.Upa.Sequence>();
                    if ((field.GetPersistFormula() is Net.Vpc.Upa.Sequence))
                    {
                        seqs.Add((Net.Vpc.Upa.Sequence)field.GetPersistFormula());
                    }
                    if ((field.GetUpdateFormula() is Net.Vpc.Upa.Sequence))
                    {
                        seqs.Add((Net.Vpc.Upa.Sequence)field.GetUpdateFormula());
                    }
                    foreach (Net.Vpc.Upa.Sequence sequence in seqs)
                    {
                        Net.Vpc.Upa.SequenceStrategy strategy = sequence.GetStrategy();
                        string g = sequence.GetGroup();
                        string f = sequence.GetFormat();
                        switch (strategy)
                        {
                        case Net.Vpc.Upa.SequenceStrategy.UNSPECIFIED:
                        case Net.Vpc.Upa.SequenceStrategy.AUTO:
                        case Net.Vpc.Upa.SequenceStrategy.IDENTITY:
                        {
                            Net.Vpc.Upa.Types.DataType d = (field.GetDataType());
                            System.Type platformType     = d.GetPlatformType();
                            bool        ofIntegerType    = Net.Vpc.Upa.Impl.Util.PlatformUtils.IsAnyInteger(platformType);
                            if (ofIntegerType)
                            {
                                if (field.IsId() && g == null)
                                {
                                    privateSeq = false;
                                }
                                else
                                {
                                    privateSeq = true;
                                }
                            }
                            else if (typeof(string).Equals(platformType))
                            {
                                privateSeq = true;
                            }
                            else
                            {
                                throw new Net.Vpc.Upa.Exceptions.UPAException("UnsupportedGeneratedValueTypeException", field, platformType);
                            }
                            break;
                        }

                        case Net.Vpc.Upa.SequenceStrategy.SEQUENCE:
                        {
                            privateSeq = true;
                            break;
                        }

                        case Net.Vpc.Upa.SequenceStrategy.TABLE:
                        {
                            privateSeq = true;
                            break;
                        }

                        default:
                        {
                            throw new Net.Vpc.Upa.Exceptions.UPAException("UnsupportedGeneratedValueStrategyException", field);
                        }
                        }
                        if (privateSeq)
                        {
                            break;
                        }
                    }
                    if (privateSeq)
                    {
                        break;
                    }
                }
                if (privateSeq && !outer.ContainsEntity(Net.Vpc.Upa.Impl.PrivateSequence.ENTITY_NAME))
                {
                    outer.AddEntity(typeof(Net.Vpc.Upa.Impl.PrivateSequence));
                }
            }
        }
Esempio n. 4
0
 public Sequence(Net.Vpc.Upa.SequenceStrategy strategy, int initialValue, int allocationSize)  : this(strategy, initialValue, allocationSize, null, null, null)
 {
 }
Esempio n. 5
0
 public Sequence(Net.Vpc.Upa.SequenceStrategy strategy)  : this(strategy, 1, 50, null, null, null)
 {
 }