/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.identity.PersistentGroup
 *  com.l7tech.objectmodel.Goid
 *  com.l7tech.objectmodel.IdentityHeader
 *  org.hibernate.HibernateException
 *  org.hibernate.Session
 *  org.hibernate.query.Query
 *  org.hibernate.type.BinaryType
 *  org.hibernate.type.Type
 */
package com.l7tech.server.identity;

import com.l7tech.identity.PersistentGroup;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.IdentityHeader;
import com.l7tech.server.identity.PersistentGroupManagerImpl;
import com.l7tech.server.util.ReadOnlyHibernateCallback;
import java.sql.SQLException;
import java.util.HashSet;
import java.util.Iterator;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.query.Query;
import org.hibernate.type.BinaryType;
import org.hibernate.type.Type;

class t
extends ReadOnlyHibernateCallback {
    final String val$userId;
    final PersistentGroupManagerImpl this$0;
    private static final String a = t.a(76, t.a(":\u001c2z&nA$\u001c-Q'"));

    t(PersistentGroupManagerImpl persistentGroupManagerImpl, String string) {
        this.this$0 = persistentGroupManagerImpl;
        this.val$userId = string;
    }

    public Object doInHibernateReadOnly(Session session) throws HibernateException, SQLException {
        Goid goid;
        HashSet<IdentityHeader> hashSet = new HashSet<IdentityHeader>();
        Query query = session.createQuery(this.this$0.p);
        try {
            goid = Goid.parseGoid((String)this.val$userId);
        }
        catch (IllegalArgumentException illegalArgumentException) {
            throw new SQLException(illegalArgumentException);
        }
        query.setParameter(a, (Object)goid.getBytes(), (Type)new BinaryType());
        Iterator iterator = query.iterate();
        while (iterator.hasNext()) {
            PersistentGroup persistentGroup = (PersistentGroup)iterator.next();
            hashSet.add(this.this$0.newHeader(persistentGroup));
        }
        return hashSet;
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x58);
        }
        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 -> 27;
                    case 1 -> 53;
                    case 2 -> 19;
                    case 3 -> 84;
                    case 4 -> 15;
                    case 5 -> 80;
                    default -> 88;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

