package com.l7tech.server.policy;

import com.l7tech.objectmodel.DeleteException;
import com.l7tech.objectmodel.Entity;
import com.l7tech.objectmodel.EntityHeader;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.ObjectModelException;
import com.l7tech.objectmodel.UpdateException;
import com.l7tech.objectmodel.EntityManager.UniqueType;
import com.l7tech.policy.Policy;
import com.l7tech.policy.PolicyVersion;
import com.l7tech.server.HibernateEntityManager;
import com.l7tech.server.event.AdminInfo;
import com.l7tech.util.Config;
import jakarta.persistence.NoResultException;
import jakarta.persistence.NonUniqueResultException;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.logging.Logger;
import org.springframework.dao.DataAccessException;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
public class PolicyVersionManagerImpl extends HibernateEntityManager<PolicyVersion, EntityHeader> implements PolicyVersionManager {
   protected static final Logger logger;
   private final Config m;
   private static final String[] n;

   public PolicyVersionManagerImpl(Config var1) {
      this.m = var1;
   }

   @Transactional(propagation = Propagation.SUPPORTS)
   public Class<? extends Entity> getImpClass() {
      return PolicyVersion.class;
   }

   @Transactional(propagation = Propagation.SUPPORTS)
   @Override
   public String getTableName() {
      return n[11];
   }

   @Transactional(readOnly = true)
   @Override
   public PolicyVersion findByPrimaryKey(Goid param1, Goid param2) throws FindException {
      // $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: new java/util/HashMap
      // 03: dup
      // 04: invokespecial java/util/HashMap.<init> ()V
      // 07: astore 3
      // 08: aload 3
      // 09: getstatic com/l7tech/server/policy/PolicyVersionManagerImpl.n [Ljava/lang/String;
      // 0c: astore 5
      // 0e: aload 5
      // 10: bipush 1
      // 11: aaload
      // 12: aload 2
      // 13: invokeinterface java/util/Map.put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; 3
      // 18: pop
      // 19: aload 3
      // 1a: aload 5
      // 1c: bipush 7
      // 1e: aaload
      // 1f: aload 1
      // 20: invokeinterface java/util/Map.put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; 3
      // 25: pop
      // 26: aload 0
      // 27: aload 3
      // 28: invokestatic java/util/Collections.singletonList (Ljava/lang/Object;)Ljava/util/List;
      // 2b: invokevirtual com/l7tech/server/policy/PolicyVersionManagerImpl.findMatching (Ljava/util/Collection;)Ljava/util/List;
      // 2e: astore 4
      // 30: aload 4
      // 32: ifnull 46
      // 35: aload 4
      // 37: invokeinterface java/util/List.isEmpty ()Z 1
      // 3c: ifeq 4c
      // 3f: goto 46
      // 42: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 45: athrow
      // 46: aconst_null
      // 47: areturn
      // 48: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 4b: athrow
      // 4c: aload 4
      // 4e: invokeinterface java/util/List.size ()I 1
      // 53: bipush 1
      // 54: if_icmple 7f
      // 57: new com/l7tech/objectmodel/FindException
      // 5a: dup
      // 5b: aload 2
      // 5c: invokestatic java/lang/String.valueOf (Ljava/lang/Object;)Ljava/lang/String;
      // 5f: aload 1
      // 60: invokestatic java/lang/String.valueOf (Ljava/lang/Object;)Ljava/lang/String;
      // 63: getstatic com/l7tech/server/policy/PolicyVersionManagerImpl.n [Ljava/lang/String;
      // 66: bipush 8
      // 68: aaload
      // 69: dup_x2
      // 6a: pop
      // 6b: getstatic com/l7tech/server/policy/PolicyVersionManagerImpl.n [Ljava/lang/String;
      // 6e: bipush 9
      // 70: aaload
      // 71: swap
      // 72: invokedynamic makeConcatWithConstants (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; bsm=java/lang/invoke/StringConcatFactory.makeConcatWithConstants (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite; args=[ "\u0001\u0001\u0001\u0001" ]
      // 77: invokespecial com/l7tech/objectmodel/FindException.<init> (Ljava/lang/String;)V
      // 7a: athrow
      // 7b: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 7e: athrow
      // 7f: aload 4
      // 81: invokeinterface java/util/List.iterator ()Ljava/util/Iterator; 1
      // 86: invokeinterface java/util/Iterator.next ()Ljava/lang/Object; 1
      // 8b: checkcast com/l7tech/policy/PolicyVersion
      // 8e: areturn
      // try (25 -> 30): 31 com/l7tech/objectmodel/FindException
      // try (27 -> 35): 35 com/l7tech/objectmodel/FindException
      // try (37 -> 59): 59 com/l7tech/objectmodel/FindException
   }

   @Transactional(readOnly = true)
   @Override
   public List<PolicyVersion> findAllForPolicy(Goid var1) throws FindException {
      HashMap var2 = new HashMap();
      var2.put(n[7], var1);
      return this.findMatching(Collections.singletonList(var2));
   }

   @Override
   public PolicyVersion checkpointPolicy(Policy var1, boolean var2, boolean var3) throws ObjectModelException {
      return this.checkpointPolicy(var1, var2, null, var3);
   }

   @Override
   public PolicyVersion checkpointPolicy(Policy param1, boolean param2, String param3, boolean param4) throws ObjectModelException {
      // $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:
      // 000: aload 1
      // 001: invokevirtual com/l7tech/policy/Policy.getGoid ()Lcom/l7tech/objectmodel/Goid;
      // 004: astore 5
      // 006: aload 5
      // 008: invokestatic com/l7tech/objectmodel/Goid.isDefault (Lcom/l7tech/objectmodel/Goid;)Z
      // 00b: ifeq 01f
      // 00e: new java/lang/IllegalArgumentException
      // 011: dup
      // 012: getstatic com/l7tech/server/policy/PolicyVersionManagerImpl.n [Ljava/lang/String;
      // 015: bipush 2
      // 016: aaload
      // 017: invokespecial java/lang/IllegalArgumentException.<init> (Ljava/lang/String;)V
      // 01a: athrow
      // 01b: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 01e: athrow
      // 01f: bipush 0
      // 020: invokestatic com/l7tech/server/event/AdminInfo.find (Z)Lcom/l7tech/server/event/AdminInfo;
      // 023: astore 6
      // 025: aload 1
      // 026: aload 6
      // 028: iload 2
      // 029: iload 4
      // 02b: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Lcom/l7tech/policy/Policy;Lcom/l7tech/server/event/AdminInfo;ZZ)Lcom/l7tech/policy/PolicyVersion;
      // 02e: astore 7
      // 030: aload 7
      // 032: aload 3
      // 033: invokevirtual com/l7tech/policy/PolicyVersion.setName (Ljava/lang/String;)V
      // 036: aload 0
      // 037: aload 5
      // 039: invokevirtual com/l7tech/server/policy/PolicyVersionManagerImpl.findActiveVersionForPolicy (Lcom/l7tech/objectmodel/Goid;)Lcom/l7tech/policy/PolicyVersion;
      // 03c: astore 8
      // 03e: aload 0
      // 03f: aload 5
      // 041: invokevirtual com/l7tech/server/policy/PolicyVersionManagerImpl.findLatestRevisionForPolicy (Lcom/l7tech/objectmodel/Goid;)Lcom/l7tech/policy/PolicyVersion;
      // 044: astore 9
      // 046: iload 4
      // 048: ifne 074
      // 04b: aload 8
      // 04d: ifnonnull 074
      // 050: goto 057
      // 053: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 056: athrow
      // 057: getstatic com/l7tech/server/policy/PolicyVersionManagerImpl.logger Ljava/util/logging/Logger;
      // 05a: getstatic java/util/logging/Level.WARNING Ljava/util/logging/Level;
      // 05d: aload 5
      // 05f: invokestatic java/lang/String.valueOf (Ljava/lang/Object;)Ljava/lang/String;
      // 062: getstatic com/l7tech/server/policy/PolicyVersionManagerImpl.n [Ljava/lang/String;
      // 065: bipush 0
      // 066: aaload
      // 067: swap
      // 068: invokedynamic makeConcatWithConstants (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; bsm=java/lang/invoke/StringConcatFactory.makeConcatWithConstants (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite; args=[ "\u0001\u0001" ]
      // 06d: invokevirtual java/util/logging/Logger.log (Ljava/util/logging/Level;Ljava/lang/String;)V
      // 070: aload 9
      // 072: astore 8
      // 074: aload 8
      // 076: ifnull 0fa
      // 079: aload 8
      // 07b: invokevirtual com/l7tech/policy/PolicyVersion.getXml ()Ljava/lang/String;
      // 07e: ifnull 0d9
      // 081: goto 088
      // 084: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 087: athrow
      // 088: aload 8
      // 08a: invokevirtual com/l7tech/policy/PolicyVersion.getXml ()Ljava/lang/String;
      // 08d: aload 1
      // 08e: invokevirtual com/l7tech/policy/Policy.getXml ()Ljava/lang/String;
      // 091: invokevirtual java/lang/String.equals (Ljava/lang/Object;)Z
      // 094: ifeq 0d9
      // 097: goto 09e
      // 09a: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 09d: athrow
      // 09e: iload 2
      // 09f: ifeq 0d6
      // 0a2: goto 0a9
      // 0a5: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 0a8: athrow
      // 0a9: aload 8
      // 0ab: invokevirtual com/l7tech/policy/PolicyVersion.isActive ()Z
      // 0ae: ifne 0d6
      // 0b1: goto 0b8
      // 0b4: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 0b7: athrow
      // 0b8: aload 8
      // 0ba: bipush 1
      // 0bb: invokevirtual com/l7tech/policy/PolicyVersion.setActive (Z)V
      // 0be: aload 0
      // 0bf: aload 8
      // 0c1: invokevirtual com/l7tech/server/policy/PolicyVersionManagerImpl.update (Lcom/l7tech/objectmodel/PersistentEntity;)V
      // 0c4: aload 0
      // 0c5: aload 5
      // 0c7: aload 8
      // 0c9: invokevirtual com/l7tech/policy/PolicyVersion.getGoid ()Lcom/l7tech/objectmodel/Goid;
      // 0cc: invokevirtual com/l7tech/server/policy/PolicyVersionManagerImpl.deactivateVersions (Lcom/l7tech/objectmodel/Goid;Lcom/l7tech/objectmodel/Goid;)V
      // 0cf: goto 0d6
      // 0d2: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 0d5: athrow
      // 0d6: aload 8
      // 0d8: areturn
      // 0d9: aload 7
      // 0db: invokevirtual com/l7tech/policy/PolicyVersion.getOrdinal ()J
      // 0de: aload 9
      // 0e0: invokevirtual com/l7tech/policy/PolicyVersion.getOrdinal ()J
      // 0e3: lcmp
      // 0e4: ifgt 0fa
      // 0e7: aload 7
      // 0e9: aload 9
      // 0eb: invokevirtual com/l7tech/policy/PolicyVersion.getOrdinal ()J
      // 0ee: lconst_1
      // 0ef: ladd
      // 0f0: invokevirtual com/l7tech/policy/PolicyVersion.setOrdinal (J)V
      // 0f3: goto 0fa
      // 0f6: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 0f9: athrow
      // 0fa: aload 0
      // 0fb: aload 7
      // 0fd: invokevirtual com/l7tech/server/policy/PolicyVersionManagerImpl.save (Lcom/l7tech/objectmodel/PersistentEntity;)Lcom/l7tech/objectmodel/Goid;
      // 100: astore 10
      // 102: aload 7
      // 104: aload 10
      // 106: invokevirtual com/l7tech/policy/PolicyVersion.setGoid (Lcom/l7tech/objectmodel/Goid;)V
      // 109: iload 2
      // 10a: ifeq 11c
      // 10d: aload 0
      // 10e: aload 5
      // 110: aload 10
      // 112: invokevirtual com/l7tech/server/policy/PolicyVersionManagerImpl.deactivateVersions (Lcom/l7tech/objectmodel/Goid;Lcom/l7tech/objectmodel/Goid;)V
      // 115: goto 11c
      // 118: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 11b: athrow
      // 11c: aload 0
      // 11d: aload 5
      // 11f: aload 7
      // 121: invokevirtual com/l7tech/server/policy/PolicyVersionManagerImpl.a (Lcom/l7tech/objectmodel/Goid;Lcom/l7tech/policy/PolicyVersion;)V
      // 124: aload 7
      // 126: areturn
      // try (3 -> 13): 13 com/l7tech/objectmodel/ObjectModelException
      // try (35 -> 39): 40 com/l7tech/objectmodel/ObjectModelException
      // try (54 -> 59): 60 com/l7tech/objectmodel/ObjectModelException
      // try (56 -> 68): 69 com/l7tech/objectmodel/ObjectModelException
      // try (62 -> 73): 74 com/l7tech/objectmodel/ObjectModelException
      // try (71 -> 79): 80 com/l7tech/objectmodel/ObjectModelException
      // try (76 -> 93): 94 com/l7tech/objectmodel/ObjectModelException
      // try (98 -> 110): 111 com/l7tech/objectmodel/ObjectModelException
      // try (117 -> 126): 127 com/l7tech/objectmodel/ObjectModelException
   }

   @Override
   public PolicyVersion findLatestRevisionForPolicy(Goid var1) {
      return (PolicyVersion)this.getHibernateTemplate().execute(new at(this, var1));
   }

   private void a(Goid param1, PolicyVersion param2) throws FindException, DeleteException {
      // $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: invokevirtual com/l7tech/policy/PolicyVersion.getGoid ()Lcom/l7tech/objectmodel/Goid;
      // 04: astore 3
      // 05: aload 0
      // 06: getfield com/l7tech/server/policy/PolicyVersionManagerImpl.m Lcom/l7tech/util/Config;
      // 09: getstatic com/l7tech/server/policy/PolicyVersionManagerImpl.n [Ljava/lang/String;
      // 0c: bipush 6
      // 0e: aaload
      // 0f: bipush 20
      // 11: invokeinterface com/l7tech/util/Config.getIntProperty (Ljava/lang/String;I)I 3
      // 16: istore 4
      // 18: new java/util/ArrayList
      // 1b: dup
      // 1c: aload 0
      // 1d: aload 1
      // 1e: invokevirtual com/l7tech/server/policy/PolicyVersionManagerImpl.findAllForPolicy (Lcom/l7tech/objectmodel/Goid;)Ljava/util/List;
      // 21: invokespecial java/util/ArrayList.<init> (Ljava/util/Collection;)V
      // 24: astore 5
      // 26: aload 5
      // 28: new com/l7tech/server/policy/ae
      // 2b: dup
      // 2c: aload 0
      // 2d: aload 3
      // 2e: aload 1
      // 2f: invokespecial com/l7tech/server/policy/ae.<init> (Lcom/l7tech/server/policy/PolicyVersionManagerImpl;Lcom/l7tech/objectmodel/Goid;Lcom/l7tech/objectmodel/Goid;)V
      // 32: invokestatic com/l7tech/util/Functions.grep (Ljava/lang/Iterable;Lcom/l7tech/util/Functions$Unary;)Ljava/util/List;
      // 35: astore 5
      // 37: aload 5
      // 39: new com/l7tech/server/policy/af
      // 3c: dup
      // 3d: aload 0
      // 3e: invokespecial com/l7tech/server/policy/af.<init> (Lcom/l7tech/server/policy/PolicyVersionManagerImpl;)V
      // 41: invokestatic java/util/Collections.sort (Ljava/util/List;Ljava/util/Comparator;)V
      // 44: aload 5
      // 46: invokeinterface java/util/List.size ()I 1
      // 4b: istore 6
      // 4d: aload 2
      // 4e: invokevirtual com/l7tech/policy/PolicyVersion.isActive ()Z
      // 51: ifne 6c
      // 54: aload 2
      // 55: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Lcom/l7tech/policy/PolicyVersion;)Z
      // 58: ifeq 6c
      // 5b: goto 62
      // 5e: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 61: athrow
      // 62: iinc 6 1
      // 65: goto 6c
      // 68: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 6b: athrow
      // 6c: iload 6
      // 6e: iload 4
      // 70: if_icmplt d2
      // 73: aload 5
      // 75: invokeinterface java/util/List.iterator ()Ljava/util/Iterator; 1
      // 7a: astore 7
      // 7c: aload 7
      // 7e: invokeinterface java/util/Iterator.hasNext ()Z 1
      // 83: ifeq d2
      // 86: aload 7
      // 88: invokeinterface java/util/Iterator.next ()Ljava/lang/Object; 1
      // 8d: checkcast com/l7tech/policy/PolicyVersion
      // 90: astore 8
      // 92: aload 8
      // 94: invokevirtual com/l7tech/policy/PolicyVersion.getPolicyGoid ()Lcom/l7tech/objectmodel/Goid;
      // 97: aload 1
      // 98: invokestatic com/l7tech/objectmodel/Goid.equals (Lcom/l7tech/objectmodel/Goid;Lcom/l7tech/objectmodel/Goid;)Z
      // 9b: ifeq cf
      // 9e: aload 8
      // a0: invokevirtual com/l7tech/policy/PolicyVersion.getGoid ()Lcom/l7tech/objectmodel/Goid;
      // a3: aload 3
      // a4: invokestatic com/l7tech/objectmodel/Goid.equals (Lcom/l7tech/objectmodel/Goid;Lcom/l7tech/objectmodel/Goid;)Z
      // a7: ifne cf
      // aa: goto b1
      // ad: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // b0: athrow
      // b1: aload 0
      // b2: aload 8
      // b4: invokevirtual com/l7tech/server/policy/PolicyVersionManagerImpl.delete (Lcom/l7tech/objectmodel/PersistentEntity;)V
      // b7: iinc 6 -1
      // ba: iload 6
      // bc: iload 4
      // be: if_icmpgt cf
      // c1: goto c8
      // c4: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // c7: athrow
      // c8: goto d2
      // cb: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // ce: athrow
      // cf: goto 7c
      // d2: return
      // try (36 -> 42): 43 com/l7tech/objectmodel/FindException
      // try (39 -> 46): 47 com/l7tech/objectmodel/FindException
      // try (62 -> 72): 73 com/l7tech/objectmodel/FindException
      // try (67 -> 82): 83 com/l7tech/objectmodel/FindException
      // try (75 -> 86): 86 com/l7tech/objectmodel/FindException
   }

   @Override
   protected UniqueType getUniqueType() {
      return UniqueType.NONE;
   }

   private static boolean a(PolicyVersion param0) {
      // $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 0
      // 01: invokevirtual com/l7tech/policy/PolicyVersion.getName ()Ljava/lang/String;
      // 04: ifnull 19
      // 07: aload 0
      // 08: invokevirtual com/l7tech/policy/PolicyVersion.getName ()Ljava/lang/String;
      // 0b: invokevirtual java/lang/String.length ()I
      // 0e: bipush 1
      // 0f: if_icmpge 21
      // 12: goto 19
      // 15: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 18: athrow
      // 19: bipush 1
      // 1a: goto 22
      // 1d: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 20: athrow
      // 21: bipush 0
      // 22: ireturn
      // try (0 -> 8): 9 java/lang/IllegalArgumentException
      // try (3 -> 13): 13 java/lang/IllegalArgumentException
   }

   @Override
   public void deactivateVersions(Goid var1, Goid var2) throws UpdateException {
      try {
         this.getHibernateTemplate().execute(new ag(this, var1, var2));
      } catch (DataAccessException var4) {
         throw new UpdateException(var4);
      }
   }

   @Transactional(readOnly = true)
   @Override
   public PolicyVersion findActiveVersionForPolicy(Goid var1) throws FindException {
      try {
         return (PolicyVersion)this.getHibernateTemplate().execute(new au(this, var1));
      } catch (NoResultException var3) {
         return null;
      } catch (NonUniqueResultException var4) {
         throw new FindException(n[3] + var1);
      }
   }

   @Override
   public PolicyVersion findPolicyVersionForPolicy(Goid param1, long param2) throws FindException {
      // $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: new java/util/HashMap
      // 03: dup
      // 04: invokespecial java/util/HashMap.<init> ()V
      // 07: astore 4
      // 09: aload 4
      // 0b: getstatic com/l7tech/server/policy/PolicyVersionManagerImpl.n [Ljava/lang/String;
      // 0e: astore 9
      // 10: aload 9
      // 12: bipush 12
      // 14: aaload
      // 15: aload 1
      // 16: invokeinterface java/util/Map.put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; 3
      // 1b: pop
      // 1c: aload 4
      // 1e: aload 9
      // 20: bipush 5
      // 21: aaload
      // 22: lload 2
      // 23: invokestatic java/lang/Long.valueOf (J)Ljava/lang/Long;
      // 26: invokeinterface java/util/Map.put (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; 3
      // 2b: pop
      // 2c: aload 0
      // 2d: aload 4
      // 2f: invokestatic java/util/Collections.singletonList (Ljava/lang/Object;)Ljava/util/List;
      // 32: invokevirtual com/l7tech/server/policy/PolicyVersionManagerImpl.findMatching (Ljava/util/Collection;)Ljava/util/List;
      // 35: astore 5
      // 37: aload 5
      // 39: ifnull 4d
      // 3c: aload 5
      // 3e: invokeinterface java/util/List.isEmpty ()Z 1
      // 43: ifeq 59
      // 46: goto 4d
      // 49: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 4c: athrow
      // 4d: new com/l7tech/objectmodel/FindException
      // 50: dup
      // 51: invokespecial com/l7tech/objectmodel/FindException.<init> ()V
      // 54: athrow
      // 55: invokestatic com/l7tech/server/policy/PolicyVersionManagerImpl.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 58: athrow
      // 59: aload 5
      // 5b: invokeinterface java/util/List.size ()I 1
      // 60: bipush 1
      // 61: if_icmple 8c
      // 64: new com/l7tech/objectmodel/FindException
      // 67: dup
      // 68: aload 1
      // 69: invokestatic java/lang/String.valueOf (Ljava/lang/Object;)Ljava/lang/String;
      // 6c: lload 2
      // 6d: lstore 6
      // 6f: astore 8
      // 71: getstatic com/l7tech/server/policy/PolicyVersionManagerImpl.n [Ljava/lang/String;
      // 74: astore 9
      // 76: aload 9
      // 78: bipush 4
      // 79: aaload
      // 7a: aload 8
      // 7c: aload 9
      // 7e: bipush 10
      // 80: aaload
      // 81: lload 6
      // 83: invokedynamic makeConcatWithConstants (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;J)Ljava/lang/String; bsm=java/lang/invoke/StringConcatFactory.makeConcatWithConstants (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite; args=[ "\u0001\u0001\u0001\u0001" ]
      // 88: invokespecial com/l7tech/objectmodel/FindException.<init> (Ljava/lang/String;)V
      // 8b: athrow
      // 8c: aload 5
      // 8e: invokeinterface java/util/List.iterator ()Ljava/util/Iterator; 1
      // 93: invokeinterface java/util/Iterator.next ()Ljava/lang/Object; 1
      // 98: checkcast com/l7tech/policy/PolicyVersion
      // 9b: areturn
      // try (26 -> 31): 32 com/l7tech/objectmodel/FindException
      // try (28 -> 38): 38 com/l7tech/objectmodel/FindException
   }

   private static PolicyVersion a(Policy var0, AdminInfo var1, boolean var2, boolean var3) {
      Goid var4 = var0.getGoid();
      PolicyVersion var5 = new PolicyVersion();
      var5.setPolicyGoid(var4);
      var5.setActive(var2);
      long var6 = var0.getVersion() + 1;
      if (!var3) {
         var6++;
      }

      var5.setOrdinal(var6);
      var5.setTime(System.currentTimeMillis());
      var5.setUserLogin(var1.login);
      var5.setUserProviderGoid(var1.identityProviderOid);
      var5.setXml(var0.getXml());
      return var5;
   }

   static {
      String[] var5 = new String[13];
      int var3 = 0;
      String var2 = "oiZ\u0014\u0004\u001faNh\u001b\u0010\u0001\u0014%\u001afX\u0002\u0001\f$\u001aq^\u0004\u001b\u0013.T']\u0019\u001aZ1UkR\u0015\u0011Z6SsSV\u000f\u0015(^'\u0004]hR\u0012/oiZ\u0014\u0004\u001faNh\u001b\u0015\u0000\u001f\"QwT\u001f\u0006\u000eaJhW\u001f\u000b\u0003aMnO\u001e\u0007\u000f5\u001af\u001b\u0000\t\u0016(^'t?,:|hN\u0018\fZ,Uu^V\u001c\u0012 T'T\u0018\rZ YsR\u0000\rZ\u0011UkR\u0015\u0011,$HtR\u0019\u0006Z6SsSV\u0018\u0015-SdB)\u000f\u0015(^:3|hN\u0018\fZ,Uu^V\u001c\u0012 T'T\u0018\rZ\u0011UkR\u0015\u0011,$HtR\u0019\u0006Z6SsSV\u0018\u0015-SdB)\u000f\u0015(^:\u0007Uu_\u001f\u0006\u001b-\u001cJhW\u001f\u000b\u0003\u0017_uH\u001f\u0007\u0014(T`v\u0017\u0010($LnH\u001f\u0007\u00142\nJhW\u001f\u000b\u0003\u0006Un_,|hN\u0018\fZ,Uu^V\u001c\u0012 T'T\u0018\rZ\u0011UkR\u0015\u0011,$HtR\u0019\u0006Z6SsSV\u000f\u0015(^:\u0011\u001afU\u0012H\n.VnX\u000f7\u001d.Sc\u0006\r\u001afU\u0012H\u00153^nU\u0017\u0004G";
      int var4 = "oiZ\u0014\u0004\u001faNh\u001b\u0010\u0001\u0014%\u001afX\u0002\u0001\f$\u001aq^\u0004\u001b\u0013.T']\u0019\u001aZ1UkR\u0015\u0011Z6SsSV\u000f\u0015(^'\u0004]hR\u0012/oiZ\u0014\u0004\u001faNh\u001b\u0015\u0000\u001f\"QwT\u001f\u0006\u000eaJhW\u001f\u000b\u0003aMnO\u001e\u0007\u000f5\u001af\u001b\u0000\t\u0016(^'t?,:|hN\u0018\fZ,Uu^V\u001c\u0012 T'T\u0018\rZ YsR\u0000\rZ\u0011UkR\u0015\u0011,$HtR\u0019\u0006Z6SsSV\u0018\u0015-SdB)\u000f\u0015(^:3|hN\u0018\fZ,Uu^V\u001c\u0012 T'T\u0018\rZ\u0011UkR\u0015\u0011,$HtR\u0019\u0006Z6SsSV\u0018\u0015-SdB)\u000f\u0015(^:\u0007Uu_\u001f\u0006\u001b-\u001cJhW\u001f\u000b\u0003\u0017_uH\u001f\u0007\u0014(T`v\u0017\u0010($LnH\u001f\u0007\u00142\nJhW\u001f\u000b\u0003\u0006Un_,|hN\u0018\fZ,Uu^V\u001c\u0012 T'T\u0018\rZ\u0011UkR\u0015\u0011,$HtR\u0019\u0006Z6SsSV\u000f\u0015(^:\u0011\u001afU\u0012H\n.VnX\u000f7\u001d.Sc\u0006\r\u001afU\u0012H\u00153^nU\u0017\u0004G"
         .length();
      char var1 = '3';
      int var7 = -1;

      label24:
      while (true) {
         byte var10000 = 101;
         String var10001 = var2.substring(++var7, var7 + var1);
         byte var10002 = -1;

         while (true) {
            String var8 = b(var10000, a(var10001));
            switch (var10002) {
               case 0:
                  var5[var3++] = var8;
                  if ((var7 += var1) >= var4) {
                     n = var5;
                     logger = Logger.getLogger(PolicyVersionManagerImpl.class.getName());
                     return;
                  }

                  var1 = var2.charAt(var7);
                  break;
               default:
                  var5[var3++] = var8;
                  if ((var7 += var1) < var4) {
                     var1 = var2.charAt(var7);
                     continue label24;
                  }

                  var2 = "B`_\u0017\u0003\u000b\u0016DjA\r\t\u001d'\nB`_\u0017\u0003\u000b\u000e]fW";
                  var4 = "B`_\u0017\u0003\u000b\u0016DjA\r\t\u001d'\nB`_\u0017\u0003\u000b\u000e]fW".length();
                  var1 = 14;
                  var7 = -1;
            }

            var10000 = 109;
            var10001 = var2.substring(++var7, var7 + var1);
            var10002 = 0;
         }
      }
   }

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

   private static char[] a(String var0) {
      char[] var10000 = var0.toCharArray();
      if (var10000.length < 2) {
         var10000[0] = (char)(var10000[0] ^ 36);
      }

      return var10000;
   }

   private static String b(int var0, char[] var1) {
      int var10003 = var1.length;
      int var10002 = var0;
      char[] var10001 = var1;
      int var10000 = var10003;

      for (int var2 = 0; var10000 > var2; var2++) {
         var10001[var2] = (char)(var10001[var2] ^ var10002 ^ switch (var2 % 7) {
            case 0 -> 95;
            case 1 -> 98;
            case 2 -> 94;
            case 3 -> 19;
            case 4 -> 13;
            case 5 -> 31;
            default -> 36;
         });
      }

      return new String(var10001).intern();
   }
}
