package com.l7tech.external.assertions.gatewaymanagement.server;

import com.l7tech.gateway.common.cluster.ClusterProperty;
import com.l7tech.gateway.common.security.SpecialKeyType;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.ObjectModelException;
import com.l7tech.util.Either;
import com.l7tech.util.Eithers;
import com.l7tech.util.Option;
import com.l7tech.util.Triple;
import com.l7tech.util.Functions.Unary;
import com.l7tech.util.Functions.UnaryVoidThrows;
import java.util.Collection;

class b9 implements UnaryVoidThrows<Triple<SpecialKeyType, String, Either<FindException, Option<ClusterProperty>>>, ObjectModelException> {
   final Unary val$forThisKey;
   final Collection val$currentTypes;
   final Collection val$assignedTypes;
   final Collection val$forUpdate;

   b9(b6 var1, Unary var2, Collection var3, Collection var4, Collection var5) {
      this.val$forThisKey = var2;
      this.val$currentTypes = var3;
      this.val$assignedTypes = var4;
      this.val$forUpdate = var5;
   }

   public void call(Triple<SpecialKeyType, String, Either<FindException, Option<ClusterProperty>>> var1) throws ObjectModelException {
      SpecialKeyType var2 = (SpecialKeyType)var1.left;
      Option var3 = (Option)Eithers.extract((Either)var1.right);

      try {
         if (var3.exists(this.val$forThisKey)) {
            this.val$currentTypes.add(var2);
            return;
         }
      } catch (ObjectModelException var5) {
         throw a(var5);
      }

      try {
         if (this.val$assignedTypes.contains(var2)) {
            this.val$forUpdate.add((ClusterProperty)var3.orSome(new b_(this, var1)));
         }
      } catch (ObjectModelException var4) {
         throw a(var4);
      }
   }

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