/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.jdbc.JdbcConnection
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.SecurityZone
 *  org.hibernate.Cache
 *  org.springframework.context.ApplicationEvent
 *  org.springframework.context.ApplicationListener
 */
package com.l7tech.server.jdbc;

import com.l7tech.gateway.common.jdbc.JdbcConnection;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.SecurityZone;
import com.l7tech.server.event.RoleAwareEntityDeletionEvent;
import com.l7tech.server.jdbc.JdbcConnectionManagerImpl;
import java.io.Serializable;
import java.util.logging.Level;
import org.hibernate.Cache;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;

class i
implements ApplicationListener {
    final JdbcConnectionManagerImpl this$0;
    private static final String[] a;

    i(JdbcConnectionManagerImpl jdbcConnectionManagerImpl) {
        this.this$0 = jdbcConnectionManagerImpl;
    }

    public void onApplicationEvent(ApplicationEvent applicationEvent) {
        RoleAwareEntityDeletionEvent roleAwareEntityDeletionEvent;
        Cache cache = this.this$0.getSessionFactory().getCache();
        try {
            if (cache == null) {
                return;
            }
        }
        catch (FindException findException) {
            throw i.a(findException);
        }
        if (applicationEvent instanceof RoleAwareEntityDeletionEvent && (roleAwareEntityDeletionEvent = (RoleAwareEntityDeletionEvent)applicationEvent).getEntity() instanceof SecurityZone) {
            SecurityZone securityZone = (SecurityZone)roleAwareEntityDeletionEvent.getEntity();
            try {
                String[] stringArray = a;
                for (JdbcConnection jdbcConnection : JdbcConnectionManagerImpl.access$200(this.this$0, stringArray[0], securityZone.getGoid())) {
                    cache.evictEntity(JdbcConnection.class, (Serializable)jdbcConnection.getGoid());
                }
            }
            catch (FindException findException) {
                JdbcConnectionManagerImpl.m.log(Level.WARNING, a[1] + String.valueOf(securityZone.getGoid()));
            }
        }
    }

    private static FindException a(FindException findException) {
        return findException;
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[2];
        int n2 = 0;
        String string = "8A6<9\u001e32~:'.Y $M11\bK %/W)$Pu%$\u0016#kn1+(4(%J0*?\u001e(%Wu>\"\u0003/kw0*>\u0005.?]\u000f&%\u0012g";
        int n3 = "8A6<9\u001e32~:'.Y $M11\bK %/W)$Pu%$\u0016#kn1+(4(%J0*?\u001e(%Wu>\"\u0003/kw0*>\u0005.?]\u000f&%\u0012g".length();
        int n4 = 17;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = i.a(39, i.a(string.substring(n6, n6 + n4)));
            if ((n5 += n4) >= n3) {
                a = stringArray;
                return;
            }
            n4 = string.charAt(n5);
        }
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x60);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String a(int n2, char[] cArray) {
        char[] cArray2;
        block11: {
            int n3;
            int n4;
            int n5;
            block10: {
                n5 = n2;
                cArray2 = cArray;
                n4 = cArray.length;
                n3 = 0;
                if (!true) break block10;
                n4 = n4;
                if (n4 <= n3) break block11;
            }
            do {
                n5 = n5;
                cArray2 = cArray2;
                int n6 = n3;
                cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                    case 0 -> 108;
                    case 1 -> 3;
                    case 2 -> 114;
                    case 3 -> 110;
                    case 4 -> 108;
                    case 5 -> 80;
                    default -> 96;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

