package com.l7tech.server.util;

import com.l7tech.util.RandomUtil;
import java.io.Serializable;
import java.util.concurrent.atomic.AtomicLong;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.IdentifierGenerator;
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;

public class ConfiguredSessionFactoryBean extends LocalSessionFactoryBean {
   public static final class ConfiguredGOIDGenerator implements IdentifierGenerator {
      private static AtomicLong a;
      private static AtomicLong b;
      private static final int c = 65536;

      public ConfiguredGOIDGenerator() {
         long var1;
         do {
            var1 = RandomUtil.nextLong();
         } while (var1 >= 0L && var1 < 65536L);

         a = new AtomicLong(var1);
         b = new AtomicLong(RandomUtil.nextLong());
      }

      public Serializable generate(SharedSessionContractImplementor param1, Object param2) throws HibernateException {
         // $VF: Couldn't be decompiled
         // Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
         // java.lang.RuntimeException: parsing failure!
         //   at org.jetbrains.java.decompiler.modules.decompiler.decompose.DomHelper.parseGraph(DomHelper.java:211)
         //   at org.jetbrains.java.decompiler.main.rels.MethodProcessor.codeToJava(MethodProcessor.java:174)
         //
         // Bytecode:
         // 00: aload 2
         // 01: instanceof com/l7tech/objectmodel/PersistentEntity
         // 04: ifeq 39
         // 07: aload 2
         // 08: checkcast com/l7tech/objectmodel/PersistentEntity
         // 0b: invokeinterface com/l7tech/objectmodel/PersistentEntity.getGoid ()Lcom/l7tech/objectmodel/Goid; 1
         // 10: ifnull 39
         // 13: goto 1a
         // 16: invokestatic com/l7tech/server/util/ConfiguredSessionFactoryBean$ConfiguredGOIDGenerator.a (Lorg/hibernate/HibernateException;)Lorg/hibernate/HibernateException;
         // 19: athrow
         // 1a: aload 2
         // 1b: checkcast com/l7tech/objectmodel/PersistentEntity
         // 1e: invokestatic com/l7tech/objectmodel/imp/PersistentEntityUtil.isPreserveId (Lcom/l7tech/objectmodel/PersistentEntity;)Z
         // 21: ifeq 39
         // 24: goto 2b
         // 27: invokestatic com/l7tech/server/util/ConfiguredSessionFactoryBean$ConfiguredGOIDGenerator.a (Lorg/hibernate/HibernateException;)Lorg/hibernate/HibernateException;
         // 2a: athrow
         // 2b: aload 2
         // 2c: checkcast com/l7tech/objectmodel/PersistentEntity
         // 2f: invokeinterface com/l7tech/objectmodel/PersistentEntity.getGoid ()Lcom/l7tech/objectmodel/Goid; 1
         // 34: areturn
         // 35: invokestatic com/l7tech/server/util/ConfiguredSessionFactoryBean$ConfiguredGOIDGenerator.a (Lorg/hibernate/HibernateException;)Lorg/hibernate/HibernateException;
         // 38: athrow
         // 39: new com/l7tech/objectmodel/Goid
         // 3c: dup
         // 3d: getstatic com/l7tech/server/util/ConfiguredSessionFactoryBean$ConfiguredGOIDGenerator.a Ljava/util/concurrent/atomic/AtomicLong;
         // 40: invokevirtual java/util/concurrent/atomic/AtomicLong.get ()J
         // 43: getstatic com/l7tech/server/util/ConfiguredSessionFactoryBean$ConfiguredGOIDGenerator.b Ljava/util/concurrent/atomic/AtomicLong;
         // 46: invokevirtual java/util/concurrent/atomic/AtomicLong.getAndIncrement ()J
         // 49: invokespecial com/l7tech/objectmodel/Goid.<init> (JJ)V
         // 4c: areturn
         // try (0 -> 7): 8 org/hibernate/HibernateException
         // try (3 -> 14): 15 org/hibernate/HibernateException
         // try (10 -> 21): 21 org/hibernate/HibernateException
      }

      private static HibernateException a(HibernateException var0) {
         return var0;
      }
   }
}
