/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.service.PublishedService
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.PersistentEntity
 *  com.l7tech.objectmodel.SaveException
 *  com.l7tech.util.Functions
 *  com.l7tech.util.Functions$Unary
 *  com.l7tech.wsdl.ResourceTrackingWSDLLocator
 *  com.l7tech.wsdl.ResourceTrackingWSDLLocator$WSDLResource
 *  com.l7tech.wsdl.Wsdl
 *  javax.wsdl.WSDLException
 *  javax.wsdl.xml.WSDLLocator
 *  org.springframework.transaction.TransactionStatus
 *  org.springframework.transaction.support.TransactionCallbackWithoutResult
 */
package com.l7tech.server.service;

import com.l7tech.gateway.common.service.PublishedService;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.PersistentEntity;
import com.l7tech.objectmodel.SaveException;
import com.l7tech.server.service.ServiceWsdlImportChecker;
import com.l7tech.server.service.ag;
import com.l7tech.server.service.ah;
import com.l7tech.util.Functions;
import com.l7tech.wsdl.ResourceTrackingWSDLLocator;
import com.l7tech.wsdl.Wsdl;
import java.io.StringReader;
import java.util.Map;
import java.util.logging.Level;
import javax.wsdl.WSDLException;
import javax.wsdl.xml.WSDLLocator;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import org.xml.sax.InputSource;

class ax
extends TransactionCallbackWithoutResult {
    final PublishedService val$service;
    final ServiceWsdlImportChecker this$0;
    private static final String[] a;

    ax(ServiceWsdlImportChecker serviceWsdlImportChecker, PublishedService publishedService) {
        this.this$0 = serviceWsdlImportChecker;
        this.val$service = publishedService;
    }

    /*
     * Loose catch block
     */
    protected void doInTransactionWithoutResult(TransactionStatus transactionStatus) {
        try {
            InputSource inputSource;
            block13: {
                inputSource = new InputSource();
                String string = this.val$service.getWsdlUrl();
                if (string == null) break block13;
                try {
                    block15: {
                        if (string.trim().length() <= 0) break block13;
                        break block15;
                        catch (SaveException saveException) {
                            throw ax.a(saveException);
                        }
                    }
                    inputSource.setSystemId(string);
                }
                catch (SaveException saveException) {
                    throw ax.a(saveException);
                }
            }
            inputSource.setCharacterStream(new StringReader(this.val$service.getWsdlXml()));
            String[] stringArray = a;
            Map map = Functions.toMap(this.this$0.e.findByServiceIdAndType(this.val$service.getGoid(), stringArray[2]), (Functions.Unary)new ag(this));
            ResourceTrackingWSDLLocator resourceTrackingWSDLLocator = new ResourceTrackingWSDLLocator((WSDLLocator)new ah(this.this$0, inputSource, map), false, true, true);
            Wsdl.newInstance((WSDLLocator)resourceTrackingWSDLLocator);
            for (ResourceTrackingWSDLLocator.WSDLResource wSDLResource : resourceTrackingWSDLLocator.getWSDLResources()) {
                try {
                    if (map.containsKey(wSDLResource.getUri())) {
                        continue;
                    }
                }
                catch (SaveException saveException) {
                    throw ax.a(saveException);
                }
                try {
                    stringArray = a;
                    ServiceWsdlImportChecker.a.info(stringArray[6] + wSDLResource.getUri() + stringArray[0] + String.valueOf(this.val$service.getGoid()) + stringArray[7]);
                    this.this$0.e.save((PersistentEntity)this.this$0.a(this.val$service.getGoid(), wSDLResource));
                }
                catch (SaveException saveException) {
                    stringArray = a;
                    ServiceWsdlImportChecker.a.log(Level.WARNING, stringArray[8] + wSDLResource.getUri() + stringArray[1] + String.valueOf(this.val$service.getGoid()) + stringArray[3], saveException);
                    transactionStatus.setRollbackOnly();
                    break;
                }
            }
        }
        catch (WSDLException wSDLException) {
            String[] stringArray = a;
            ServiceWsdlImportChecker.a.log(Level.WARNING, stringArray[4] + String.valueOf(this.val$service.getGoid()) + stringArray[9] + wSDLException.getMessage());
        }
        catch (FindException findException) {
            String[] stringArray = a;
            ServiceWsdlImportChecker.a.log(Level.WARNING, stringArray[5] + String.valueOf(this.val$service.getGoid()) + stringArray[3], findException);
        }
    }

    private static SaveException a(SaveException saveException) {
        return saveException;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[10];
                var3_1 = 0;
                var2_2 = "Q\u001fK\u001f+>)\u0013M[\u0019:{zQ\u000fQ\u001fK\u001f+>)\u0013M[\u0019:{zQ\u000b!li<tW\u0017&p\u007f$\u0002Q\u0011,5PX\u001c=>4\u0019K\r\u0000+q9\u0013L^P\u000eM\u001e:\u001fD\u001d)q(\u0002L\r\u00166lz\u0005Z_\u00060}?V\u001895PX\u001c=>4\u0019K\r\u0002<j(\u001fZ[\u0015y};\u0015WH\u0014ym?\u0004ID\u0013<>>\u0019\\X\u001d<p.\u0005\u001fK\u001f+>)\u0013M[\u0019:{zQ\u0016%^[\u00197yz\u001fR]\u001f+j?\u0012\u001fz#\u001dRzQ\u0002Q\u0011";
                var4_3 = "Q\u001fK\u001f+>)\u0013M[\u0019:{zQ\u000fQ\u001fK\u001f+>)\u0013M[\u0019:{zQ\u000b!li<tW\u0017&p\u007f$\u0002Q\u0011,5PX\u001c=>4\u0019K\r\u0000+q9\u0013L^P\u000eM\u001e:\u001fD\u001d)q(\u0002L\r\u00166lz\u0005Z_\u00060}?V\u001895PX\u001c=>4\u0019K\r\u0002<j(\u001fZ[\u0015y};\u0015WH\u0014ym?\u0004ID\u0013<>>\u0019\\X\u001d<p.\u0005\u001fK\u001f+>)\u0013M[\u0019:{zQ\u0016%^[\u00197yz\u001fR]\u001f+j?\u0012\u001fz#\u001dRzQ\u0002Q\u0011".length();
                var1_4 = 15;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = ax.a(v0, ax.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "&XJ\n>+<\u0002\\Q\u000b++<\u0006XN\f/no\u0007E[\u0010!n!\u0017\n\u001f\fD\u0004\u0018()x<\u0002M]_l";
                    var4_3 = "&XJ\n>+<\u0002\\Q\u000b++<\u0006XN\f/no\u0007E[\u0010!n!\u0017\n\u001f\fD\u0004\u0018()x<\u0002M]_l".length();
                    var1_4 = 31;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 8;
                        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++] = ax.a(v0, ax.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;
            }
        }
        ax.a = var5;
    }

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

