/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.security.RevocationCheckPolicy
 *  com.l7tech.objectmodel.Entity
 *  com.l7tech.objectmodel.FindException
 *  org.springframework.transaction.TransactionStatus
 *  org.springframework.transaction.support.TransactionCallback
 */
package com.l7tech.server.bundling;

import com.l7tech.gateway.common.security.RevocationCheckPolicy;
import com.l7tech.objectmodel.Entity;
import com.l7tech.objectmodel.FindException;
import com.l7tech.server.bundling.EntityBundleImporterImpl;
import com.l7tech.server.bundling.EntityMappingResult;
import java.util.Map;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;

class s
implements TransactionCallback<Throwable> {
    final EntityMappingResult val$results;
    final Map val$resourceMapping;
    final EntityBundleImporterImpl this$0;
    private static final String a = s.a(53, s.a("1S}^`rt\u0014[}T/s$\u0016SgUk&;\u0000\u0012pBjg \u0017V3bjp;\u0011SgY`ht1ZvSd&\u0004\u001d^zSv&1\u001cFzDv&#\u001bF{\u0010gc5\u0016Wa\n/"));

    /*
     * Ignored method signature, as it can't be verified against descriptor
     */
    s(EntityBundleImporterImpl entityBundleImporterImpl, EntityMappingResult entityMappingResult, Map map) {
        this.this$0 = entityBundleImporterImpl;
        this.val$results = entityMappingResult;
        this.val$resourceMapping = map;
    }

    public Throwable doInTransaction(TransactionStatus transactionStatus) {
        try {
            Entity entity = this.this$0.entityCrud.find(this.val$results.getTargetEntityHeader());
            if (entity == null) {
                transactionStatus.setRollbackOnly();
                return new FindException(a + this.val$results.getTargetEntityHeader().toStringVerbose());
            }
            RevocationCheckPolicy revocationCheckPolicy = (RevocationCheckPolicy)entity;
            RevocationCheckPolicy revocationCheckPolicy2 = revocationCheckPolicy.clone();
            this.this$0.dependencyAnalyzer.replaceDependencies(revocationCheckPolicy2, this.val$resourceMapping, false);
            revocationCheckPolicy.setRevocationCheckItems(revocationCheckPolicy2.getRevocationCheckItems());
            this.this$0.entityCrud.update((Entity)revocationCheckPolicy);
            transactionStatus.flush();
            return null;
        }
        catch (Throwable throwable) {
            transactionStatus.setRollbackOnly();
            return throwable;
        }
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x61);
        }
        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 -> 71;
                    case 1 -> 7;
                    case 2 -> 38;
                    case 3 -> 5;
                    case 4 -> 58;
                    case 5 -> 51;
                    default -> 97;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

