/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.admin.PolicyBundleInstallerAdmin$PolicyBundleInstallerException
 *  com.l7tech.policy.bundle.PolicyBundleDryRunResult
 *  com.l7tech.policy.bundle.PolicyBundleDryRunResult$DryRunItem
 *  com.l7tech.policy.bundle.PolicyBundleDryRunResult$UnknownBundleIdException
 *  com.l7tech.util.Functions$UnaryVoidThrows
 *  org.apache.commons.lang3.StringUtils
 */
package com.l7tech.server.policy.bundle;

import com.l7tech.gateway.common.admin.PolicyBundleInstallerAdmin;
import com.l7tech.policy.bundle.PolicyBundleDryRunResult;
import com.l7tech.server.policy.bundle.PolicyBundleInstallerAbstractServerAssertion;
import com.l7tech.server.policy.bundle.PolicyBundleInstallerServerAssertionException;
import com.l7tech.util.Functions;
import java.util.List;
import org.apache.commons.lang3.StringUtils;

class c
implements Functions.UnaryVoidThrows<Object, Exception> {
    final List val$componentIds;
    final PolicyBundleInstallerAbstractServerAssertion this$0;
    private static final String[] a;

    /*
     * Ignored method signature, as it can't be verified against descriptor
     */
    c(PolicyBundleInstallerAbstractServerAssertion policyBundleInstallerAbstractServerAssertion, List list) {
        this.this$0 = policyBundleInstallerAbstractServerAssertion;
        this.val$componentIds = list;
    }

    public void call(Object object) throws Exception {
        PolicyBundleDryRunResult policyBundleDryRunResult = (PolicyBundleDryRunResult)object;
        try {
            StringBuilder stringBuilder = new StringBuilder();
            for (String string : this.val$componentIds) {
                try {
                    if (!policyBundleDryRunResult.anyConflictsForBundle(string)) continue;
                    stringBuilder.append(a[2]).append(string).append(System.lineSeparator());
                    stringBuilder.append(a[6]).append(StringUtils.join((Iterable)policyBundleDryRunResult.getConflictsForItem(string, PolicyBundleDryRunResult.DryRunItem.SERVICES), (char)';')).append(System.lineSeparator());
                    stringBuilder.append(a[5]).append(StringUtils.join((Iterable)policyBundleDryRunResult.getConflictsForItem(string, PolicyBundleDryRunResult.DryRunItem.POLICIES), (char)';')).append(System.lineSeparator());
                    stringBuilder.append(a[4]).append(StringUtils.join((Iterable)policyBundleDryRunResult.getConflictsForItem(string, PolicyBundleDryRunResult.DryRunItem.CERTIFICATES), (char)';')).append(System.lineSeparator());
                    stringBuilder.append(a[0]).append(StringUtils.join((Iterable)policyBundleDryRunResult.getConflictsForItem(string, PolicyBundleDryRunResult.DryRunItem.JDBC_CONNECTIONS), (char)';')).append(System.lineSeparator());
                    stringBuilder.append(a[1]).append(StringUtils.join((Iterable)policyBundleDryRunResult.getConflictsForItem(string, PolicyBundleDryRunResult.DryRunItem.ASSERTIONS), (char)';')).append(System.lineSeparator());
                    stringBuilder.append(a[3]).append(StringUtils.join((Iterable)policyBundleDryRunResult.getConflictsForItem(string, PolicyBundleDryRunResult.DryRunItem.ENCAPSULATED_ASSERTION), (char)';')).append(System.lineSeparator());
                }
                catch (PolicyBundleDryRunResult.UnknownBundleIdException unknownBundleIdException) {
                    throw c.a(unknownBundleIdException);
                }
            }
            try {
                if (stringBuilder.length() > 0) {
                    throw new PolicyBundleInstallerServerAssertionException(PolicyBundleInstallerAbstractServerAssertion.access$000(this.this$0), stringBuilder.toString(), 409);
                }
            }
            catch (PolicyBundleDryRunResult.UnknownBundleIdException unknownBundleIdException) {
                throw c.a(unknownBundleIdException);
            }
            this.this$0.writeResponse(StringUtils.join((Iterable)this.val$componentIds, (char)';'));
        }
        catch (PolicyBundleDryRunResult.UnknownBundleIdException unknownBundleIdException) {
            throw new PolicyBundleInstallerAdmin.PolicyBundleInstallerException((Throwable)unknownBundleIdException);
        }
    }

    private static PolicyBundleDryRunResult.UnknownBundleIdException a(PolicyBundleDryRunResult.UnknownBundleIdException unknownBundleIdException) {
        return unknownBundleIdException;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[7];
                var3_1 = 0;
                var2_2 = "\u0017\u001e\u001f2WmJ3\u001f\u001e%}mJ..\u00150`FK3\u000e8)}qPgZ\u0013\u0010\u0013\u000e\"}lC\u001c\t\u000e4fvM2\u0014\u000ek4\r\u001e\u0015\u0010!{lA3\u000e45.\"\u001f\u0018\u0014\u001e0dqQ1\u001b\t4pCW.\u001f\u000f%}mJ\u001e\u0015\u00137xkG)@]\u0015\u001e\u001f\u000f%}dM>\u001b\t4WmJ;\u0016\u00142`8\u0004";
                var4_3 = "\u0017\u001e\u001f2WmJ3\u001f\u001e%}mJ..\u00150`FK3\u000e8)}qPgZ\u0013\u0010\u0013\u000e\"}lC\u001c\t\u000e4fvM2\u0014\u000ek4\r\u001e\u0015\u0010!{lA3\u000e45.\"\u001f\u0018\u0014\u001e0dqQ1\u001b\t4pCW.\u001f\u000f%}mJ\u001e\u0015\u00137xkG)@]\u0015\u001e\u001f\u000f%}dM>\u001b\t4WmJ;\u0016\u00142`8\u0004".length();
                var1_4 = 30;
                var0_5 = -1;
lbl7:
                // 2 sources

                while (true) {
                    v0 = 103;
                    v1 = ++var0_5;
                    v2 = var2_2.substring(v1, v1 + var1_4);
                    v3 = -1;
                    break block9;
                    break;
                }
lbl13:
                // 1 sources

                while (true) {
                    var5[var3_1++] = c.a(v0, c.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = ".62\u001bTXD\u001178\u001e^BsDy\u0011-<,\u0004^Bb=60\u0014[Hd\nc~";
                    var4_3 = ".62\u001bTXD\u001178\u001e^BsDy\u0011-<,\u0004^Bb=60\u0014[Hd\nc~".length();
                    var1_4 = 16;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 68;
                        v4 = ++var0_5;
                        v2 = var2_2.substring(v4, v4 + var1_4);
                        v3 = 0;
                        break block9;
                        break;
                    }
                    break;
                }
lbl28:
                // 1 sources

                while (true) {
                    var5[var3_1++] = c.a(v0, c.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    break block10;
                    break;
                }
            }
            switch (v3) {
                default: {
                    ** continue;
                }
                ** case 0:
lbl39:
                // 1 sources

                ** continue;
            }
        }
        c.a = var5;
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x43);
        }
        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 -> 58;
                    case 1 -> 29;
                    case 2 -> 26;
                    case 3 -> 54;
                    case 4 -> 115;
                    case 5 -> 101;
                    default -> 67;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

