/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  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.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 r
implements TransactionCallback<Throwable> {
    final EntityMappingResult val$results;
    final Map val$resourceMapping;
    final EntityBundleImporterImpl this$0;
    private static final String a = r.a(47, r.a("U2qt\u0017\u0005mp:q~X\u0004=r2k\u007f\u001cQ\"ds|h\u001d\u00109s7?]\u001d\u001f(d:|:\u001d\u001f9\u007f'f:\u000f\u00189~sw\u007f\u0019\u0015(di?"));

    /*
     * Ignored method signature, as it can't be verified against descriptor
     */
    r(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());
            }
            this.this$0.dependencyAnalyzer.replaceDependencies(entity, this.val$resourceMapping, false);
            this.this$0.entityCrud.update(entity);
            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] ^ 0x62);
        }
        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 -> 57;
                    case 1 -> 124;
                    case 2 -> 48;
                    case 3 -> 53;
                    case 4 -> 87;
                    case 5 -> 94;
                    default -> 98;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

