/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.uddi.UDDIServiceControl
 *  com.l7tech.gateway.common.uddi.UDDIServiceControlHeader
 *  com.l7tech.objectmodel.Entity
 *  com.l7tech.objectmodel.EntityHeader
 *  com.l7tech.objectmodel.EntityManager$UniqueType
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.Goid
 */
package com.l7tech.server.uddi;

import com.l7tech.gateway.common.uddi.UDDIServiceControl;
import com.l7tech.gateway.common.uddi.UDDIServiceControlHeader;
import com.l7tech.objectmodel.Entity;
import com.l7tech.objectmodel.EntityHeader;
import com.l7tech.objectmodel.EntityManager;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.server.HibernateEntityManager;
import com.l7tech.server.uddi.UDDIServiceControlManager;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class UDDIServiceControlManagerImpl
extends HibernateEntityManager<UDDIServiceControl, EntityHeader>
implements UDDIServiceControlManager {
    private static final String[] m;

    @Override
    public UDDIServiceControl findByPublishedServiceGoid(Goid goid) throws FindException {
        return (UDDIServiceControl)this.findByUniqueKey(m[3], goid);
    }

    @Override
    public Collection<UDDIServiceControl> findByUDDIRegistryGoid(Goid goid) throws FindException {
        return this.findByPropertyMaybeNull(m[0], goid);
    }

    @Override
    public Collection<UDDIServiceControl> findByUDDIServiceKey(String string) throws FindException {
        return this.findByPropertyMaybeNull(m[6], string);
    }

    @Override
    public Collection<UDDIServiceControl> findByUDDIRegistryAndServiceKey(Goid goid, String string, Boolean bl2) throws FindException {
        HashMap<String, Object> hashMap = new HashMap<String, Object>();
        try {
            hashMap.put(m[2], goid);
            hashMap.put(m[5], string);
            if (bl2 != null) {
                hashMap.put(m[7], bl2);
            }
        }
        catch (FindException findException) {
            throw UDDIServiceControlManagerImpl.a(findException);
        }
        return this.findMatching(Collections.singletonList(hashMap));
    }

    @Override
    public Collection<UDDIServiceControl> findByUDDIRegistryAndMetricsState(Goid goid, boolean bl2) throws FindException {
        HashMap<String, Object> hashMap = new HashMap<String, Object>();
        String[] stringArray = m;
        hashMap.put(stringArray[0], goid);
        hashMap.put(stringArray[4], bl2);
        return this.findMatching(Collections.singletonList(hashMap));
    }

    public Class<? extends Entity> getImpClass() {
        return UDDIServiceControl.class;
    }

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

    @Override
    protected Collection<Map<String, Object>> getUniqueConstraints(UDDIServiceControl uDDIServiceControl) {
        HashMap<String, Goid> hashMap = new HashMap<String, Goid>();
        hashMap.put(m[1], uDDIServiceControl.getPublishedServiceGoid());
        return Arrays.asList(hashMap);
    }

    @Override
    protected EntityHeader newHeader(UDDIServiceControl uDDIServiceControl) {
        Object object = super.newHeader(uDDIServiceControl);
        if (uDDIServiceControl != null) {
            object = new UDDIServiceControlHeader(uDDIServiceControl.getGoid(), null, null, Integer.valueOf(uDDIServiceControl.getVersion()), uDDIServiceControl.getSecurityZone() == null ? null : uDDIServiceControl.getSecurityZone().getGoid(), uDDIServiceControl.getPublishedServiceGoid());
        }
        return object;
    }

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

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[8];
                var3_1 = 0;
                var2_2 = "7[jZE>e+LzAn\u001cm+[\u00142Jl_~(j'[]Ve-k!ZI\\~?\u00107[jZE>e+LzAn\u001cm+[\u00142Jl_~(j'[]Ve-k!ZI\\~?\u000e/ZzA~8q\u0007QoQ{>f\u000e7[jZD>p4VmV\\>{";
                var4_3 = "7[jZE>e+LzAn\u001cm+[\u00142Jl_~(j'[]Ve-k!ZI\\~?\u00107[jZE>e+LzAn\u001cm+[\u00142Jl_~(j'[]Ve-k!ZI\\~?\u000e/ZzA~8q\u0007QoQ{>f\u000e7[jZD>p4VmV\\>{".length();
                var1_4 = 16;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = UDDIServiceControlManagerImpl.b(v0, UDDIServiceControlManagerImpl.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "\u0016zK{e\u001fQ\u0015wLw}\u001fZ\u0010\u0016pKwD/G\u0007wl}X\u000eQ\fr";
                    var4_3 = "\u0016zK{e\u001fQ\u0015wLw}\u001fZ\u0010\u0016pKwD/G\u0007wl}X\u000eQ\fr".length();
                    var1_4 = 14;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 79;
                        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++] = UDDIServiceControlManagerImpl.b(v0, UDDIServiceControlManagerImpl.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;
            }
        }
        UDDIServiceControlManagerImpl.m = var5;
    }

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

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String b(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 -> 44;
                    case 1 -> 81;
                    case 2 -> 96;
                    case 3 -> 93;
                    case 4 -> 121;
                    case 5 -> 53;
                    default -> 108;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

