/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.service.PublishedService
 *  com.l7tech.gateway.common.service.PublishedService$WsdlStrategy
 *  com.l7tech.gateway.common.service.ServiceDocument
 *  com.l7tech.gateway.common.service.ServiceDocumentWsdlStrategy
 *  com.l7tech.gateway.common.service.ServiceHeader
 *  com.l7tech.objectmodel.Entity
 *  com.l7tech.objectmodel.EntityHeader
 *  com.l7tech.objectmodel.EntityHeaderSet
 *  com.l7tech.objectmodel.EntityType
 *  com.l7tech.objectmodel.EntityTypeRegistry
 *  com.l7tech.objectmodel.ExternalEntityHeader
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.Goid
 *  com.l7tech.objectmodel.GuidEntityHeader
 *  com.l7tech.objectmodel.ObjectModelException
 *  com.l7tech.objectmodel.PersistentEntity
 *  com.l7tech.objectmodel.SaveException
 *  com.l7tech.objectmodel.UpdateException
 *  com.l7tech.objectmodel.ValueReferenceEntityHeader
 *  com.l7tech.objectmodel.encass.EncapsulatedAssertionArgumentDescriptor
 *  com.l7tech.objectmodel.encass.EncapsulatedAssertionConfig
 *  com.l7tech.objectmodel.encass.EncapsulatedAssertionResultDescriptor
 *  com.l7tech.objectmodel.migration.MigrationDependency
 *  com.l7tech.objectmodel.migration.MigrationMappingSelection
 *  com.l7tech.objectmodel.migration.MigrationUtils
 *  com.l7tech.objectmodel.migration.PropertyResolver
 *  com.l7tech.objectmodel.migration.PropertyResolverException
 *  com.l7tech.policy.Policy
 *  com.l7tech.policy.assertion.Assertion
 *  com.l7tech.policy.wsp.WspWriter
 *  com.l7tech.server.management.api.node.MigrationApi$MigrationException
 *  com.l7tech.server.management.migration.MigrationManager
 *  com.l7tech.server.management.migration.bundle.ExportedItem
 *  com.l7tech.server.management.migration.bundle.MigratedItem
 *  com.l7tech.server.management.migration.bundle.MigratedItem$ImportOperation
 *  com.l7tech.server.management.migration.bundle.MigrationBundle
 *  com.l7tech.server.management.migration.bundle.MigrationMetadata
 *  com.l7tech.util.ExceptionUtils
 *  org.springframework.transaction.annotation.Transactional
 */
package com.l7tech.server.migration;

import com.l7tech.gateway.common.service.PublishedService;
import com.l7tech.gateway.common.service.ServiceDocument;
import com.l7tech.gateway.common.service.ServiceDocumentWsdlStrategy;
import com.l7tech.gateway.common.service.ServiceHeader;
import com.l7tech.objectmodel.Entity;
import com.l7tech.objectmodel.EntityHeader;
import com.l7tech.objectmodel.EntityHeaderSet;
import com.l7tech.objectmodel.EntityType;
import com.l7tech.objectmodel.EntityTypeRegistry;
import com.l7tech.objectmodel.ExternalEntityHeader;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.GuidEntityHeader;
import com.l7tech.objectmodel.ObjectModelException;
import com.l7tech.objectmodel.PersistentEntity;
import com.l7tech.objectmodel.SaveException;
import com.l7tech.objectmodel.UpdateException;
import com.l7tech.objectmodel.ValueReferenceEntityHeader;
import com.l7tech.objectmodel.encass.EncapsulatedAssertionArgumentDescriptor;
import com.l7tech.objectmodel.encass.EncapsulatedAssertionConfig;
import com.l7tech.objectmodel.encass.EncapsulatedAssertionResultDescriptor;
import com.l7tech.objectmodel.migration.MigrationDependency;
import com.l7tech.objectmodel.migration.MigrationMappingSelection;
import com.l7tech.objectmodel.migration.MigrationUtils;
import com.l7tech.objectmodel.migration.PropertyResolver;
import com.l7tech.objectmodel.migration.PropertyResolverException;
import com.l7tech.policy.Policy;
import com.l7tech.policy.assertion.Assertion;
import com.l7tech.policy.wsp.WspWriter;
import com.l7tech.server.EntityCrud;
import com.l7tech.server.EntityHeaderUtils;
import com.l7tech.server.cluster.ExternalEntityHeaderEnhancer;
import com.l7tech.server.management.api.node.MigrationApi;
import com.l7tech.server.management.migration.MigrationManager;
import com.l7tech.server.management.migration.bundle.ExportedItem;
import com.l7tech.server.management.migration.bundle.MigratedItem;
import com.l7tech.server.management.migration.bundle.MigrationBundle;
import com.l7tech.server.management.migration.bundle.MigrationMetadata;
import com.l7tech.server.migration.PropertyResolverFactory;
import com.l7tech.server.migration.e;
import com.l7tech.util.ExceptionUtils;
import java.io.Flushable;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.springframework.transaction.annotation.Transactional;

@Transactional(rollbackFor={Throwable.class})
public class MigrationManagerImpl
implements MigrationManager {
    private static final Logger a;
    private EntityCrud b;
    private PropertyResolverFactory c;
    private ExternalEntityHeaderEnhancer d;
    private static final String[] e;

    public MigrationManagerImpl(EntityCrud entityCrud, PropertyResolverFactory propertyResolverFactory, ExternalEntityHeaderEnhancer externalEntityHeaderEnhancer) {
        this.b = entityCrud;
        this.c = propertyResolverFactory;
        this.d = externalEntityHeaderEnhancer;
    }

    public Collection<ExternalEntityHeader> listEntities(Class<? extends Entity> clazz) throws MigrationApi.MigrationException {
        try {
            if (clazz == null) {
                throw new MigrationApi.MigrationException(e[2]);
            }
        }
        catch (FindException findException) {
            throw MigrationManagerImpl.a((Exception)((Object)findException));
        }
        String[] stringArray = e;
        a.log(Level.FINEST, stringArray[49], clazz.getName());
        try {
            return EntityHeaderUtils.toExternal(this.b.findAll(clazz));
        }
        catch (FindException findException) {
            stringArray = e;
            throw new MigrationApi.MigrationException(stringArray[10] + String.valueOf(clazz) + stringArray[47] + ExceptionUtils.getMessage((Throwable)findException), ExceptionUtils.getDebugException((Throwable)findException));
        }
    }

    public Collection<ExternalEntityHeader> checkHeaders(Collection<ExternalEntityHeader> collection) {
        HashSet<ExternalEntityHeader> hashSet = new HashSet<ExternalEntityHeader>();
        if (collection != null) {
            for (ExternalEntityHeader externalEntityHeader : collection) {
                try {
                    ExternalEntityHeader externalEntityHeader2;
                    Entity entity = this.d(externalEntityHeader);
                    try {
                        externalEntityHeader2 = entity == null ? externalEntityHeader : EntityHeaderUtils.toExternal(EntityHeaderUtils.fromEntity(entity));
                    }
                    catch (MigrationApi.MigrationException migrationException) {
                        throw MigrationManagerImpl.a((Exception)((Object)migrationException));
                    }
                    ExternalEntityHeader externalEntityHeader3 = externalEntityHeader2;
                    this.c(externalEntityHeader3);
                    hashSet.add(externalEntityHeader3);
                }
                catch (MigrationApi.MigrationException migrationException) {
                    a.log(Level.FINE, e[39], externalEntityHeader);
                }
            }
        }
        return hashSet;
    }

    public MigrationMetadata findDependencies(Collection<ExternalEntityHeader> collection) throws MigrationApi.MigrationException {
        String[] stringArray = e;
        a.log(Level.FINEST, stringArray[23], collection);
        MigrationMetadata migrationMetadata = new MigrationMetadata();
        if (collection != null) {
            Set<ExternalEntityHeader> set = this.a(collection);
            migrationMetadata.setHeaders(new LinkedHashSet<ExternalEntityHeader>(set));
            for (ExternalEntityHeader externalEntityHeader : set) {
                try {
                    HashSet<ExternalEntityHeader> hashSet = new HashSet<ExternalEntityHeader>(migrationMetadata.getHeaders());
                    this.a(migrationMetadata, externalEntityHeader, hashSet);
                }
                catch (PropertyResolverException propertyResolverException) {
                    stringArray = e;
                    throw new MigrationApi.MigrationException(this.a(stringArray[38], externalEntityHeader, (Exception)((Object)propertyResolverException)));
                }
                catch (MigrationApi.MigrationException migrationException) {
                    throw new MigrationApi.MigrationException(this.a(e[55], externalEntityHeader, (Exception)((Object)migrationException)));
                }
                if (EntityType.SERVICE != externalEntityHeader.getType()) continue;
                for (MigrationDependency migrationDependency : migrationMetadata.getDependants(externalEntityHeader)) {
                    ExternalEntityHeader externalEntityHeader2 = migrationDependency.getDependant();
                    try {
                        if (EntityType.SERVICE_DOCUMENT != externalEntityHeader2.getType()) continue;
                        migrationMetadata.addHeader(externalEntityHeader2);
                    }
                    catch (PropertyResolverException propertyResolverException) {
                        throw MigrationManagerImpl.a((Exception)((Object)propertyResolverException));
                    }
                }
            }
        }
        return migrationMetadata;
    }

    /*
     * Loose catch block
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    @Transactional(readOnly=true)
    public MigrationBundle exportBundle(Collection<ExternalEntityHeader> collection) throws MigrationApi.MigrationException {
        block15: {
            if (collection == null) throw new MigrationApi.MigrationException(e[0]);
            try {
                if (!collection.isEmpty()) break block15;
                throw new MigrationApi.MigrationException(e[0]);
                catch (IOException iOException) {
                    throw MigrationManagerImpl.a(iOException);
                }
            }
            catch (IOException iOException) {
                throw MigrationManagerImpl.a(iOException);
            }
        }
        MigrationMetadata migrationMetadata = this.findDependencies(collection);
        MigrationBundle migrationBundle = new MigrationBundle(migrationMetadata);
        for (ExternalEntityHeader externalEntityHeader : migrationMetadata.getAllHeaders()) {
            try {
                if (!migrationMetadata.includeInExport(externalEntityHeader)) {
                    a.log(Level.FINEST, e[33], externalEntityHeader);
                    continue;
                }
            }
            catch (IOException iOException) {
                throw MigrationManagerImpl.a(iOException);
            }
            Entity entity = this.d(externalEntityHeader);
            if (entity instanceof PublishedService) {
                var7_7 = new PublishedService((PublishedService)entity);
                try {
                    var7_7.getPolicy().setXml(WspWriter.getPolicyXml((Assertion)var7_7.getPolicy().getAssertion()));
                    entity = var7_7;
                }
                catch (IOException iOException) {
                    var9_11 = e;
                    a.log(Level.WARNING, var9_11[60] + var7_7.displayName(), iOException);
                }
            } else if (entity instanceof Policy) {
                var7_7 = new Policy((Policy)entity);
                try {
                    var7_7.setXml(WspWriter.getPolicyXml((Assertion)var7_7.getAssertion()));
                    entity = var7_7;
                }
                catch (IOException iOException) {
                    var9_11 = e;
                    a.log(Level.WARNING, var9_11[48] + var7_7.getName(), iOException);
                }
            }
            a.log(Level.FINE, e[36], new Object[]{externalEntityHeader.toStringVerbose(), entity});
            migrationBundle.addExportedItem(new ExportedItem(externalEntityHeader, entity));
        }
        return migrationBundle;
    }

    public Map<ExternalEntityHeader, EntityHeaderSet<ExternalEntityHeader>> retrieveMappingCandidates(Collection<ExternalEntityHeader> collection, ExternalEntityHeader externalEntityHeader, Map<String, String> map) throws MigrationApi.MigrationException {
        String[] stringArray = e;
        a.log(Level.FINEST, stringArray[62], collection);
        HashMap<ExternalEntityHeader, EntityHeaderSet<ExternalEntityHeader>> hashMap = new HashMap<ExternalEntityHeader, EntityHeaderSet<ExternalEntityHeader>>();
        if (collection != null) {
            for (ExternalEntityHeader externalEntityHeader2 : collection) {
                try {
                    Map<String, String> map2 = this.a(externalEntityHeader2, map);
                    EntityHeaderSet entityHeaderSet = new EntityHeaderSet();
                    if (externalEntityHeader2 instanceof ValueReferenceEntityHeader) {
                        Iterator iterator = this.findDependencies(EntityHeaderUtils.toExternal(this.b.findAll(EntityTypeRegistry.getEntityClass((EntityType)((ValueReferenceEntityHeader)externalEntityHeader2).getOwnerType()), map2, 0, 50)));
                        for (ExternalEntityHeader externalEntityHeader3 : iterator.getAllHeaders()) {
                            try {
                                if (!(externalEntityHeader3 instanceof ValueReferenceEntityHeader)) continue;
                                entityHeaderSet.add((EntityHeader)externalEntityHeader3);
                            }
                            catch (FindException findException) {
                                throw MigrationManagerImpl.a((Exception)((Object)findException));
                            }
                        }
                    } else {
                        for (EntityHeader entityHeader : this.b.findAllInScope(EntityHeaderUtils.getEntityClass((EntityHeader)externalEntityHeader2), (EntityHeader)externalEntityHeader, map2, 0, 50)) {
                            entityHeaderSet.add((EntityHeader)this.b(EntityHeaderUtils.toExternal(entityHeader)));
                        }
                    }
                    stringArray = e;
                    a.log(Level.FINEST, stringArray[4], new Object[]{entityHeaderSet.size(), externalEntityHeader2});
                    hashMap.put(externalEntityHeader2, (EntityHeaderSet<ExternalEntityHeader>)entityHeaderSet);
                }
                catch (FindException findException) {
                    throw new MigrationApi.MigrationException(e[46] + ExceptionUtils.getMessage((Throwable)findException), ExceptionUtils.getDebugException((Throwable)findException));
                }
            }
        }
        return hashMap;
    }

    private Map<String, String> a(ExternalEntityHeader externalEntityHeader, Map<String, String> map) {
        block17: {
            block15: {
                block16: {
                    block14: {
                        try {
                            if (EntityType.JMS_ENDPOINT != externalEntityHeader.getType() || !externalEntityHeader.getExtraProperties().containsKey(e[32])) break block14;
                        }
                        catch (IllegalStateException illegalStateException) {
                            throw MigrationManagerImpl.a(illegalStateException);
                        }
                        HashMap<String, String> hashMap = new HashMap<String, String>();
                        String[] stringArray = e;
                        hashMap.put(stringArray[15], externalEntityHeader.getProperty(stringArray[15]));
                        hashMap.putAll(map);
                        return hashMap;
                    }
                    try {
                        try {
                            if (EntityType.SSG_ACTIVE_CONNECTOR != externalEntityHeader.getType()) break block15;
                            if (externalEntityHeader.getExtraProperties().containsKey(e[50])) break block16;
                        }
                        catch (IllegalStateException illegalStateException) {
                            throw MigrationManagerImpl.a(illegalStateException);
                        }
                        if (!externalEntityHeader.getExtraProperties().containsKey(e[6])) break block15;
                    }
                    catch (IllegalStateException illegalStateException) {
                        throw MigrationManagerImpl.a(illegalStateException);
                    }
                }
                HashMap<String, String> hashMap = new HashMap<String, String>();
                try {
                    if (externalEntityHeader.getExtraProperties().containsKey(e[20])) {
                        hashMap.put(e[34], externalEntityHeader.getProperty(e[20]));
                    }
                }
                catch (IllegalStateException illegalStateException) {
                    throw MigrationManagerImpl.a(illegalStateException);
                }
                try {
                    if (externalEntityHeader.getExtraProperties().containsKey(e[22])) {
                        hashMap.put(e[43], externalEntityHeader.getProperty(e[22]));
                    }
                }
                catch (IllegalStateException illegalStateException) {
                    throw MigrationManagerImpl.a(illegalStateException);
                }
                hashMap.putAll(map);
                return hashMap;
            }
            try {
                if (EntityType.RESOURCE_ENTRY != externalEntityHeader.getType() || !externalEntityHeader.getExtraProperties().containsKey(e[25])) break block17;
            }
            catch (IllegalStateException illegalStateException) {
                throw MigrationManagerImpl.a(illegalStateException);
            }
            HashMap<String, String> hashMap = new HashMap<String, String>();
            String[] stringArray = e;
            hashMap.put(stringArray[57], externalEntityHeader.getProperty(stringArray[35]));
            hashMap.putAll(map);
            return hashMap;
        }
        return map;
    }

    public Collection<MigratedItem> importBundle(MigrationBundle migrationBundle, boolean bl2) throws MigrationApi.MigrationException {
        boolean bl3;
        ExternalEntityHeader externalEntityHeader;
        MigrationBundle migrationBundle2;
        MigrationManagerImpl migrationManagerImpl;
        MigrationMetadata migrationMetadata = migrationBundle.getMetadata();
        try {
            migrationManagerImpl = this;
            migrationBundle2 = migrationBundle;
            externalEntityHeader = migrationMetadata.getTargetFolder();
            bl3 = !migrationMetadata.isMigrateFolders();
        }
        catch (ObjectModelException objectModelException) {
            throw MigrationManagerImpl.a((Exception)((Object)objectModelException));
        }
        Collection<String> collection = migrationManagerImpl.a(migrationBundle2, externalEntityHeader, bl3);
        Map<ExternalEntityHeader, Entity> map = this.a(migrationMetadata);
        try {
            collection.addAll(this.a(migrationBundle, map));
            if (!collection.isEmpty()) {
                throw new MigrationApi.MigrationException(collection);
            }
        }
        catch (ObjectModelException objectModelException) {
            throw MigrationManagerImpl.a((Exception)((Object)objectModelException));
        }
        HashMap<ExternalEntityHeader, MigratedItem> hashMap = new HashMap<ExternalEntityHeader, MigratedItem>();
        for (ExternalEntityHeader externalEntityHeader2 : migrationMetadata.getHeaders()) {
            try {
                this.a(externalEntityHeader2, migrationBundle, map, hashMap, migrationMetadata.isOverwrite(), migrationMetadata.isEnableNewServices(), bl2, false);
            }
            catch (ObjectModelException objectModelException) {
                throw new MigrationApi.MigrationException(this.a(e[58], externalEntityHeader2, (Exception)((Object)objectModelException)));
            }
        }
        return hashMap.values();
    }

    private Map<ExternalEntityHeader, Entity> a(MigrationMetadata migrationMetadata) throws MigrationApi.MigrationException {
        HashMap<ExternalEntityHeader, Entity> hashMap = new HashMap<ExternalEntityHeader, Entity>();
        HashMap<Object, Boolean> hashMap2 = new HashMap<Object, Boolean>();
        for (Object object : migrationMetadata.getAllHeaders()) {
            try {
                if (migrationMetadata.isMapped((ExternalEntityHeader)object)) continue;
                hashMap2.put(object, false);
            }
            catch (MigrationApi.MigrationException migrationException) {
                throw MigrationManagerImpl.a((Exception)((Object)migrationException));
            }
        }
        for (Object object : migrationMetadata.getMappedHeaders()) {
            hashMap2.put(object, true);
        }
        for (Object object : migrationMetadata.getCopiedHeaders()) {
            hashMap2.put(object, true);
        }
        for (ExternalEntityHeader externalEntityHeader : hashMap2.keySet()) {
            try {
                Entity entity = this.d(externalEntityHeader);
                hashMap.put(externalEntityHeader, entity);
                hashMap.put(EntityHeaderUtils.toExternal(EntityHeaderUtils.fromEntity(entity)), entity);
            }
            catch (MigrationApi.MigrationException migrationException) {
                try {
                    if (!((Boolean)hashMap2.get(externalEntityHeader)).booleanValue()) continue;
                    throw migrationException;
                }
                catch (MigrationApi.MigrationException migrationException2) {
                    throw MigrationManagerImpl.a((Exception)((Object)migrationException2));
                }
            }
        }
        return hashMap;
    }

    /*
     * Loose catch block
     */
    private void a(ExternalEntityHeader externalEntityHeader, MigrationBundle migrationBundle, Map<ExternalEntityHeader, Entity> map, Map<ExternalEntityHeader, MigratedItem> map2, boolean bl2, boolean bl3, boolean bl4, boolean bl5) throws MigrationApi.MigrationException, UpdateException, SaveException {
        block47: {
            Entity entity;
            ExternalEntityHeader externalEntityHeader2;
            block46: {
                block45: {
                    MigratedItem.ImportOperation importOperation;
                    MigrationMetadata migrationMetadata;
                    block50: {
                        block44: {
                            block43: {
                                ExternalEntityHeader externalEntityHeader3;
                                block42: {
                                    block41: {
                                        block39: {
                                            block40: {
                                                block48: {
                                                    migrationMetadata = migrationBundle.getMetadata();
                                                    if (!map2.containsKey(externalEntityHeader)) break block39;
                                                    if (!bl5) break block40;
                                                    break block48;
                                                    catch (ObjectModelException objectModelException) {
                                                        throw MigrationManagerImpl.a((Exception)((Object)objectModelException));
                                                    }
                                                }
                                                try {
                                                    block49: {
                                                        if (migrationMetadata.hasHeader(externalEntityHeader)) break block40;
                                                        break block49;
                                                        catch (ObjectModelException objectModelException) {
                                                            throw MigrationManagerImpl.a((Exception)((Object)objectModelException));
                                                        }
                                                    }
                                                    a.log(Level.WARNING, e[27], externalEntityHeader);
                                                }
                                                catch (ObjectModelException objectModelException) {
                                                    throw MigrationManagerImpl.a((Exception)((Object)objectModelException));
                                                }
                                            }
                                            return;
                                        }
                                        if (migrationMetadata.isMapped(externalEntityHeader)) {
                                            importOperation = MigratedItem.ImportOperation.MAP;
                                            externalEntityHeader2 = this.a(migrationMetadata.getCopiedOrMapped(externalEntityHeader));
                                        } else {
                                            try {
                                                if (migrationMetadata.wasCopied(externalEntityHeader) || map.containsKey(externalEntityHeader)) break block41;
                                            }
                                            catch (ObjectModelException objectModelException) {
                                                throw MigrationManagerImpl.a((Exception)((Object)objectModelException));
                                            }
                                            importOperation = MigratedItem.ImportOperation.CREATE;
                                            externalEntityHeader2 = externalEntityHeader;
                                        }
                                        break block50;
                                    }
                                    if (!bl2) break block42;
                                    try {
                                        block51: {
                                            if (!migrationBundle.hasValueForHeader(externalEntityHeader)) break block42;
                                            break block51;
                                            catch (ObjectModelException objectModelException) {
                                                throw MigrationManagerImpl.a((Exception)((Object)objectModelException));
                                            }
                                        }
                                        if (EntityType.FOLDER != externalEntityHeader.getType()) break block43;
                                    }
                                    catch (ObjectModelException objectModelException) {
                                        throw MigrationManagerImpl.a((Exception)((Object)objectModelException));
                                    }
                                }
                                importOperation = MigratedItem.ImportOperation.MAP_EXISTING;
                                try {
                                    externalEntityHeader3 = migrationMetadata.wasCopied(externalEntityHeader) ? this.a(migrationMetadata.getCopiedOrMapped(externalEntityHeader)) : externalEntityHeader;
                                }
                                catch (ObjectModelException objectModelException) {
                                    throw MigrationManagerImpl.a((Exception)((Object)objectModelException));
                                }
                                externalEntityHeader2 = externalEntityHeader3;
                                break block50;
                            }
                            try {
                                if (!migrationMetadata.wasCopied(externalEntityHeader) || !map.containsKey(migrationMetadata.getCopied(externalEntityHeader))) break block44;
                            }
                            catch (ObjectModelException objectModelException) {
                                throw MigrationManagerImpl.a((Exception)((Object)objectModelException));
                            }
                            importOperation = MigratedItem.ImportOperation.UPDATE;
                            externalEntityHeader2 = migrationMetadata.getCopied(externalEntityHeader);
                            break block50;
                        }
                        importOperation = MigratedItem.ImportOperation.OVERWRITE;
                        try {
                            ExternalEntityHeader externalEntityHeader4 = externalEntityHeader2 = migrationMetadata.wasCopied(externalEntityHeader) ? this.a(migrationMetadata.getCopiedOrMapped(externalEntityHeader)) : externalEntityHeader;
                        }
                        catch (ObjectModelException objectModelException) {
                            throw MigrationManagerImpl.a((Exception)((Object)objectModelException));
                        }
                    }
                    if (importOperation.modifiesTarget()) {
                        for (MigrationDependency migrationDependency : migrationMetadata.getDependencies(externalEntityHeader)) {
                            try {
                                this.a(migrationDependency.getDependency(), migrationBundle, map, map2, bl2, bl3, bl4, true);
                            }
                            catch (ObjectModelException objectModelException) {
                                String[] stringArray = e;
                                throw new MigrationApi.MigrationException(this.a(stringArray[28], migrationDependency.getDependency(), (Exception)((Object)objectModelException)));
                            }
                        }
                    }
                    switch (com.l7tech.server.migration.e.a[importOperation.ordinal()]) {
                        case 1: 
                        case 2: {
                            entity = map.get(externalEntityHeader2);
                            break;
                        }
                        case 3: {
                            entity = this.a(externalEntityHeader, externalEntityHeader2, migrationBundle, map, bl4);
                            break;
                        }
                        case 4: {
                            entity = this.a(externalEntityHeader, externalEntityHeader2, migrationBundle, map, bl4);
                            break;
                        }
                        case 5: {
                            entity = this.a(externalEntityHeader, migrationBundle, bl3, bl4);
                            break;
                        }
                        default: {
                            String[] stringArray = e;
                            throw new IllegalStateException(stringArray[61] + String.valueOf(importOperation));
                        }
                    }
                    try {
                        if (entity == null) {
                            throw new MigrationApi.MigrationException(e[51] + String.valueOf(externalEntityHeader));
                        }
                    }
                    catch (ObjectModelException objectModelException) {
                        throw MigrationManagerImpl.a((Exception)((Object)objectModelException));
                    }
                    try {
                        try {
                            if (externalEntityHeader instanceof ValueReferenceEntityHeader && externalEntityHeader.getMappedValue() == null) break block45;
                        }
                        catch (ObjectModelException objectModelException) {
                            throw MigrationManagerImpl.a((Exception)((Object)objectModelException));
                        }
                        map2.put(externalEntityHeader, new MigratedItem(externalEntityHeader, EntityHeaderUtils.toExternal(EntityHeaderUtils.fromEntity(entity)), importOperation));
                    }
                    catch (ObjectModelException objectModelException) {
                        throw MigrationManagerImpl.a((Exception)((Object)objectModelException));
                    }
                }
                try {
                    if (!(externalEntityHeader instanceof ValueReferenceEntityHeader)) break block46;
                    this.a((ValueReferenceEntityHeader)externalEntityHeader, migrationBundle);
                    break block47;
                }
                catch (ObjectModelException objectModelException) {
                    throw MigrationManagerImpl.a((Exception)((Object)objectModelException));
                }
            }
            this.a(externalEntityHeader, entity, externalEntityHeader2, migrationBundle, map);
        }
    }

    private ExternalEntityHeader a(ExternalEntityHeader externalEntityHeader) throws MigrationApi.MigrationException {
        return EntityHeaderUtils.toExternal(EntityHeaderUtils.fromEntity(this.d(externalEntityHeader)));
    }

    private void a(ValueReferenceEntityHeader valueReferenceEntityHeader, MigrationBundle migrationBundle) throws MigrationApi.MigrationException {
        if (valueReferenceEntityHeader.getMappedValue() != null) {
            Entity entity = migrationBundle.getExportedEntity(valueReferenceEntityHeader.getOwnerHeader());
            try {
                PropertyResolver propertyResolver = this.b(entity, valueReferenceEntityHeader.getPropertyName());
                propertyResolver.applyMapping((Object)entity, valueReferenceEntityHeader.getPropertyName(), (ExternalEntityHeader)valueReferenceEntityHeader, (Object)valueReferenceEntityHeader.getMappedValue(), null);
            }
            catch (PropertyResolverException propertyResolverException) {
                throw new MigrationApi.MigrationException(e[41] + String.valueOf(valueReferenceEntityHeader), (Throwable)propertyResolverException);
            }
        }
    }

    private void a(ExternalEntityHeader externalEntityHeader, Entity entity, ExternalEntityHeader externalEntityHeader2, MigrationBundle migrationBundle, Map<ExternalEntityHeader, Entity> map) throws MigrationApi.MigrationException {
        MigrationMetadata migrationMetadata = migrationBundle.getMetadata();
        try {
            for (MigrationDependency migrationDependency : migrationMetadata.getDependants(externalEntityHeader)) {
                Entity entity2;
                ExternalEntityHeader externalEntityHeader3 = migrationDependency.getDependant();
                try {
                    entity2 = migrationMetadata.isMapped(externalEntityHeader3) ? map.get(migrationMetadata.getMapping(externalEntityHeader3)) : migrationBundle.getExportedEntity(externalEntityHeader3);
                }
                catch (PropertyResolverException propertyResolverException) {
                    throw MigrationManagerImpl.a((Exception)((Object)propertyResolverException));
                }
                Entity entity3 = entity2;
                try {
                    if (entity3 == entity) {
                        continue;
                    }
                }
                catch (PropertyResolverException propertyResolverException) {
                    throw MigrationManagerImpl.a((Exception)((Object)propertyResolverException));
                }
                String string = MigrationManagerImpl.a(entity3, migrationDependency.getPropName());
                PropertyResolver propertyResolver = this.b(entity3, string);
                try {
                    if (entity == null) {
                        throw new MigrationApi.MigrationException(e[7] + String.valueOf(migrationDependency.getDependency()));
                    }
                }
                catch (PropertyResolverException propertyResolverException) {
                    throw MigrationManagerImpl.a((Exception)((Object)propertyResolverException));
                }
                propertyResolver.applyMapping((Object)entity3, string, externalEntityHeader2, (Object)entity, externalEntityHeader);
            }
        }
        catch (PropertyResolverException propertyResolverException) {
            throw new MigrationApi.MigrationException((Throwable)propertyResolverException);
        }
    }

    /*
     * Exception decompiling
     */
    private static String a(Entity var0, String var1_1) {
        /*
         * This method has failed to decompile.  When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
         * 
         * org.benf.cfr.reader.util.ConfusedCFRException: Extractable last case doesn't follow previous, and can't clone.
         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.op3rewriters.SwitchReplacer.examineSwitchContiguity(SwitchReplacer.java:611)
         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.op3rewriters.SwitchReplacer.replaceRawSwitches(SwitchReplacer.java:94)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:517)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
         *     at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
         *     at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
         *     at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
         *     at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
         *     at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
         *     at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
         *     at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
         *     at org.benf.cfr.reader.Main.main(Main.java:54)
         */
        throw new IllegalStateException("Decompilation failed");
    }

    /*
     * Loose catch block
     */
    private Entity a(ExternalEntityHeader externalEntityHeader, ExternalEntityHeader externalEntityHeader2, MigrationBundle migrationBundle, Map<ExternalEntityHeader, Entity> map, boolean bl2) throws MigrationApi.MigrationException, UpdateException {
        Entity entity;
        block51: {
            int n2;
            int n3;
            PersistentEntity persistentEntity;
            block53: {
                block52: {
                    Entity entity2;
                    block50: {
                        block49: {
                            block48: {
                                EncapsulatedAssertionArgumentDescriptor encapsulatedAssertionArgumentDescriptor2222;
                                Object object2222;
                                block47: {
                                    block46: {
                                        Entity entity3;
                                        block45: {
                                            block44: {
                                                try {
                                                    if (externalEntityHeader instanceof ValueReferenceEntityHeader) {
                                                        return migrationBundle.getExportedEntity(((ValueReferenceEntityHeader)externalEntityHeader).getOwnerHeader());
                                                    }
                                                }
                                                catch (IOException iOException) {
                                                    throw MigrationManagerImpl.a(iOException);
                                                }
                                                if (!externalEntityHeader.isValueMappable()) break block44;
                                                try {
                                                    block54: {
                                                        if (externalEntityHeader.getMappedValue() == null) break block44;
                                                        break block54;
                                                        catch (IOException iOException) {
                                                            throw MigrationManagerImpl.a(iOException);
                                                        }
                                                    }
                                                    entity3 = this.a(externalEntityHeader, migrationBundle);
                                                    break block45;
                                                }
                                                catch (IOException iOException) {
                                                    throw MigrationManagerImpl.a(iOException);
                                                }
                                            }
                                            entity3 = migrationBundle.getExportedEntity(externalEntityHeader);
                                        }
                                        entity = entity3;
                                        try {
                                            if (entity == null) {
                                                throw new MigrationApi.MigrationException(e[54] + String.valueOf(externalEntityHeader));
                                            }
                                        }
                                        catch (IOException iOException) {
                                            throw MigrationManagerImpl.a(iOException);
                                        }
                                        entity2 = map.get(externalEntityHeader2);
                                        if (!(entity instanceof PersistentEntity)) break block46;
                                        try {
                                            block55: {
                                                if (!(entity2 instanceof PersistentEntity)) break block46;
                                                break block55;
                                                catch (IOException iOException) {
                                                    throw MigrationManagerImpl.a(iOException);
                                                }
                                            }
                                            ((PersistentEntity)entity).setGoid(((PersistentEntity)entity2).getGoid());
                                            ((PersistentEntity)entity).setVersion(((PersistentEntity)entity2).getVersion());
                                        }
                                        catch (IOException iOException) {
                                            throw MigrationManagerImpl.a(iOException);
                                        }
                                    }
                                    if (!(entity instanceof PublishedService)) break block47;
                                    try {
                                        block56: {
                                            if (!(entity2 instanceof PublishedService)) break block47;
                                            break block56;
                                            catch (IOException iOException) {
                                                throw MigrationManagerImpl.a(iOException);
                                            }
                                        }
                                        ((PublishedService)entity).getPolicy().setGoid(((PublishedService)entity2).getPolicy().getGoid());
                                        ((PublishedService)entity).getPolicy().setVersion(((PublishedService)entity2).getPolicy().getVersion());
                                        ((PublishedService)entity).setDisabled(((PublishedService)entity2).isDisabled());
                                        ((PublishedService)entity).parseWsdlStrategy(this.b(externalEntityHeader, migrationBundle));
                                    }
                                    catch (IOException iOException) {
                                        throw MigrationManagerImpl.a(iOException);
                                    }
                                }
                                try {
                                    if (!(entity instanceof EncapsulatedAssertionConfig) || !(entity2 instanceof EncapsulatedAssertionConfig)) break block48;
                                }
                                catch (IOException iOException) {
                                    throw MigrationManagerImpl.a(iOException);
                                }
                                EncapsulatedAssertionConfig encapsulatedAssertionConfig = (EncapsulatedAssertionConfig)entity;
                                EncapsulatedAssertionConfig encapsulatedAssertionConfig2 = (EncapsulatedAssertionConfig)entity2;
                                Set set = encapsulatedAssertionConfig.getArgumentDescriptors();
                                Set set2 = encapsulatedAssertionConfig2.getArgumentDescriptors();
                                boolean bl3 = false;
                                for (Object object2222 : set) {
                                    bl3 = false;
                                    for (EncapsulatedAssertionArgumentDescriptor encapsulatedAssertionArgumentDescriptor2222 : set2) {
                                        if (!object2222.getArgumentName().equalsIgnoreCase(encapsulatedAssertionArgumentDescriptor2222.getArgumentName())) continue;
                                        object2222.setEncapsulatedAssertionConfig(encapsulatedAssertionArgumentDescriptor2222.getEncapsulatedAssertionConfig());
                                        object2222.setGoid(encapsulatedAssertionArgumentDescriptor2222.getGoid());
                                        object2222.setVersion(encapsulatedAssertionArgumentDescriptor2222.getVersion());
                                        bl3 = true;
                                        break;
                                    }
                                    try {
                                        if (bl3) continue;
                                        object2222.setEncapsulatedAssertionConfig(encapsulatedAssertionConfig);
                                    }
                                    catch (IOException iOException) {
                                        throw MigrationManagerImpl.a(iOException);
                                    }
                                }
                                Set set3 = encapsulatedAssertionConfig.getResultDescriptors();
                                object2222 = encapsulatedAssertionConfig2.getResultDescriptors();
                                boolean bl4 = false;
                                encapsulatedAssertionArgumentDescriptor2222 = set3.iterator();
                                while (encapsulatedAssertionArgumentDescriptor2222.hasNext()) {
                                    EncapsulatedAssertionResultDescriptor encapsulatedAssertionResultDescriptor = (EncapsulatedAssertionResultDescriptor)encapsulatedAssertionArgumentDescriptor2222.next();
                                    bl4 = false;
                                    Iterator iterator = object2222.iterator();
                                    while (iterator.hasNext()) {
                                        EncapsulatedAssertionResultDescriptor encapsulatedAssertionResultDescriptor2 = (EncapsulatedAssertionResultDescriptor)iterator.next();
                                        if (!encapsulatedAssertionResultDescriptor.getResultName().equalsIgnoreCase(encapsulatedAssertionResultDescriptor2.getResultName())) continue;
                                        encapsulatedAssertionResultDescriptor.setEncapsulatedAssertionConfig(encapsulatedAssertionResultDescriptor2.getEncapsulatedAssertionConfig());
                                        encapsulatedAssertionResultDescriptor.setGoid(encapsulatedAssertionResultDescriptor2.getGoid());
                                        encapsulatedAssertionResultDescriptor.setVersion(encapsulatedAssertionResultDescriptor2.getVersion());
                                        bl4 = true;
                                        break;
                                    }
                                    try {
                                        if (bl4) continue;
                                        encapsulatedAssertionResultDescriptor.setEncapsulatedAssertionConfig(encapsulatedAssertionConfig);
                                    }
                                    catch (IOException iOException) {
                                        throw MigrationManagerImpl.a(iOException);
                                    }
                                }
                            }
                            if (!(entity instanceof PublishedService)) break block49;
                            try {
                                block57: {
                                    if (!(entity2 instanceof PublishedService)) break block49;
                                    break block57;
                                    catch (IOException iOException) {
                                        throw MigrationManagerImpl.a(iOException);
                                    }
                                }
                                ((PublishedService)entity).getPolicy().setGoid(((PublishedService)entity2).getPolicy().getGoid());
                                ((PublishedService)entity).getPolicy().setVersion(((PublishedService)entity2).getPolicy().getVersion());
                                ((PublishedService)entity).setDisabled(((PublishedService)entity2).isDisabled());
                                ((PublishedService)entity).parseWsdlStrategy(this.b(externalEntityHeader, migrationBundle));
                            }
                            catch (IOException iOException) {
                                throw MigrationManagerImpl.a(iOException);
                            }
                        }
                        try {
                            if (!(entity instanceof Flushable)) break block50;
                            ((Flushable)entity).flush();
                            break block50;
                        }
                        catch (MigrationApi.MigrationException migrationException) {
                            throw MigrationManagerImpl.a((Exception)((Object)migrationException));
                        }
                        {
                            catch (IOException iOException) {
                                throw new MigrationApi.MigrationException(e[29] + String.valueOf(externalEntityHeader), (Throwable)iOException);
                            }
                        }
                    }
                    try {
                        try {
                            try {
                                try {
                                    if (bl2) break block51;
                                    this.b.update(entity);
                                    if (!(entity instanceof PersistentEntity)) break block51;
                                }
                                catch (IOException iOException) {
                                    throw MigrationManagerImpl.a(iOException);
                                }
                                if (!(entity2 instanceof PersistentEntity)) break block51;
                            }
                            catch (IOException iOException) {
                                throw MigrationManagerImpl.a(iOException);
                            }
                            persistentEntity = (PersistentEntity)entity;
                            n3 = ((PersistentEntity)entity2).getVersion();
                            if (!entity.equals((Object)entity2)) break block52;
                        }
                        catch (IOException iOException) {
                            throw MigrationManagerImpl.a(iOException);
                        }
                        n2 = 0;
                        break block53;
                    }
                    catch (IOException iOException) {
                        throw MigrationManagerImpl.a(iOException);
                    }
                }
                n2 = 1;
            }
            persistentEntity.setVersion(n3 + n2);
        }
        return entity;
    }

    /*
     * Loose catch block
     */
    private Entity a(ExternalEntityHeader externalEntityHeader, MigrationBundle migrationBundle, boolean bl2, boolean bl3) throws MigrationApi.MigrationException, SaveException {
        Entity entity;
        block30: {
            Object object;
            block31: {
                block29: {
                    Entity entity2;
                    block28: {
                        block27: {
                            try {
                                if (externalEntityHeader instanceof ValueReferenceEntityHeader) {
                                    return migrationBundle.getExportedEntity(((ValueReferenceEntityHeader)externalEntityHeader).getOwnerHeader());
                                }
                            }
                            catch (IOException iOException) {
                                throw MigrationManagerImpl.a(iOException);
                            }
                            if (!externalEntityHeader.isValueMappable()) break block27;
                            try {
                                block32: {
                                    if (externalEntityHeader.getMappedValue() == null) break block27;
                                    break block32;
                                    catch (IOException iOException) {
                                        throw MigrationManagerImpl.a(iOException);
                                    }
                                }
                                entity2 = this.a(externalEntityHeader, migrationBundle);
                                break block28;
                            }
                            catch (IOException iOException) {
                                throw MigrationManagerImpl.a(iOException);
                            }
                        }
                        entity2 = migrationBundle.getExportedEntity(externalEntityHeader);
                    }
                    entity = entity2;
                    try {
                        if (entity == null) {
                            throw new MigrationApi.MigrationException(e[30] + String.valueOf(externalEntityHeader));
                        }
                    }
                    catch (IOException iOException) {
                        throw MigrationManagerImpl.a(iOException);
                    }
                    if (entity instanceof PublishedService) {
                        boolean bl4;
                        PublishedService publishedService;
                        object = (PublishedService)entity;
                        try {
                            object.parseWsdlStrategy(this.b(externalEntityHeader, migrationBundle));
                            publishedService = object;
                            bl4 = !bl2;
                        }
                        catch (IOException iOException) {
                            throw MigrationManagerImpl.a(iOException);
                        }
                        publishedService.setDisabled(bl4);
                    }
                    try {
                        if (!(entity instanceof Flushable)) break block29;
                        ((Flushable)entity).flush();
                        break block29;
                    }
                    catch (MigrationApi.MigrationException migrationException) {
                        throw MigrationManagerImpl.a((Exception)((Object)migrationException));
                    }
                    {
                        catch (IOException iOException) {
                            throw new MigrationApi.MigrationException(e[14] + String.valueOf(externalEntityHeader), (Throwable)iOException);
                        }
                    }
                }
                try {
                    try {
                        if (bl3) break block30;
                        if (!(entity instanceof PersistentEntity)) break block31;
                    }
                    catch (IOException iOException) {
                        throw MigrationManagerImpl.a(iOException);
                    }
                    ((PersistentEntity)entity).setVersion(0);
                }
                catch (IOException iOException) {
                    throw MigrationManagerImpl.a(iOException);
                }
            }
            if (entity instanceof EncapsulatedAssertionConfig) {
                Object object22222;
                object = (EncapsulatedAssertionConfig)entity;
                Set set = object.getArgumentDescriptors();
                for (Object object22222 : set) {
                    object22222.setEncapsulatedAssertionConfig((EncapsulatedAssertionConfig)object);
                    object22222.setGoid(EncapsulatedAssertionArgumentDescriptor.DEFAULT_GOID);
                }
                Set set2 = object.getResultDescriptors();
                object22222 = set2.iterator();
                while (object22222.hasNext()) {
                    EncapsulatedAssertionResultDescriptor encapsulatedAssertionResultDescriptor = (EncapsulatedAssertionResultDescriptor)object22222.next();
                    encapsulatedAssertionResultDescriptor.setEncapsulatedAssertionConfig((EncapsulatedAssertionConfig)object);
                    encapsulatedAssertionResultDescriptor.setGoid(EncapsulatedAssertionResultDescriptor.DEFAULT_GOID);
                }
            }
            object = this.b.save(entity);
            try {
                if (entity instanceof PersistentEntity) {
                    ((PersistentEntity)entity).setGoid((Goid)object);
                }
            }
            catch (IOException iOException) {
                throw MigrationManagerImpl.a(iOException);
            }
        }
        return entity;
    }

    /*
     * Loose catch block
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    private Entity a(ExternalEntityHeader externalEntityHeader, MigrationBundle migrationBundle) throws MigrationApi.MigrationException {
        block14: {
            String string = externalEntityHeader.getMappedValue();
            if (!externalEntityHeader.isValueMappable()) return null;
            try {
                if (string != null) break block14;
                return null;
                catch (PropertyResolverException propertyResolverException) {
                    throw MigrationManagerImpl.a((Exception)((Object)propertyResolverException));
                }
            }
            catch (PropertyResolverException propertyResolverException) {
                throw MigrationManagerImpl.a((Exception)((Object)propertyResolverException));
            }
        }
        PropertyResolver propertyResolver = null;
        for (MigrationDependency migrationDependency : migrationBundle.getMetadata().getDependants(externalEntityHeader)) {
            PropertyResolver propertyResolver2;
            block15: {
                propertyResolver2 = this.c.getPropertyResolver(migrationDependency.getResolverType());
                if (propertyResolver == null) break block15;
                try {
                    if (propertyResolver == propertyResolver2) break block15;
                    throw new MigrationApi.MigrationException(e[45] + String.valueOf(externalEntityHeader));
                    catch (PropertyResolverException propertyResolverException) {
                        throw MigrationManagerImpl.a((Exception)((Object)propertyResolverException));
                    }
                }
                catch (PropertyResolverException propertyResolverException) {
                    throw MigrationManagerImpl.a((Exception)((Object)propertyResolverException));
                }
            }
            propertyResolver = propertyResolver2;
        }
        try {
            if (propertyResolver == null) {
                throw new MigrationApi.MigrationException(e[26] + String.valueOf(externalEntityHeader));
            }
        }
        catch (PropertyResolverException propertyResolverException) {
            throw MigrationManagerImpl.a((Exception)((Object)propertyResolverException));
        }
        try {
            return propertyResolver.valueMapping(externalEntityHeader);
        }
        catch (PropertyResolverException propertyResolverException) {
            throw new MigrationApi.MigrationException((Throwable)propertyResolverException);
        }
    }

    private Collection<String> a(MigrationBundle migrationBundle, ExternalEntityHeader externalEntityHeader, boolean bl2) throws MigrationApi.MigrationException {
        HashSet<String> hashSet = new HashSet<String>();
        ExternalEntityHeader externalEntityHeader2 = this.b(externalEntityHeader);
        MigrationMetadata migrationMetadata = migrationBundle.getMetadata();
        if (bl2) {
            for (MigrationDependency migrationDependency : migrationMetadata.getDependencies()) {
                try {
                    if (migrationDependency.getDependency().getType() != EntityType.FOLDER) continue;
                    migrationMetadata.addMappingOrCopy(migrationDependency.getDependency(), externalEntityHeader2, false);
                }
                catch (MigrationApi.MigrationException migrationException) {
                    throw MigrationManagerImpl.a((Exception)((Object)migrationException));
                }
            }
        } else {
            String string = externalEntityHeader2.getDescription();
            for (ExternalEntityHeader externalEntityHeader3 : migrationMetadata.getAllHeaders()) {
                try {
                    try {
                        if (EntityType.FOLDER != externalEntityHeader3.getType() || migrationMetadata.getRootFolder().equals((Object)externalEntityHeader3)) continue;
                    }
                    catch (MigrationApi.MigrationException migrationException) {
                        throw MigrationManagerImpl.a((Exception)((Object)migrationException));
                    }
                    externalEntityHeader3.setDescription(string + externalEntityHeader3.getDescription());
                }
                catch (MigrationApi.MigrationException migrationException) {
                    throw MigrationManagerImpl.a((Exception)((Object)migrationException));
                }
            }
            this.a(migrationMetadata.getMappings().entrySet().iterator(), string);
            this.a(migrationMetadata.getCopies().entrySet().iterator(), string);
            migrationMetadata.addMappingOrCopy(migrationMetadata.getRootFolder(), externalEntityHeader2, false);
        }
        return hashSet;
    }

    private void a(Iterator<Map.Entry<ExternalEntityHeader, ExternalEntityHeader>> iterator, String string) {
        while (iterator.hasNext()) {
            ExternalEntityHeader externalEntityHeader = iterator.next().getValue();
            try {
                if (EntityType.FOLDER != externalEntityHeader.getType()) {
                    continue;
                }
            }
            catch (IllegalStateException illegalStateException) {
                throw MigrationManagerImpl.a(illegalStateException);
            }
            try {
                if (externalEntityHeader.getDescription().startsWith(string) && !externalEntityHeader.getDescription().equals(string)) continue;
            }
            catch (IllegalStateException illegalStateException) {
                throw MigrationManagerImpl.a(illegalStateException);
            }
            iterator.remove();
        }
    }

    private PropertyResolver b(Entity entity, String string) throws PropertyResolverException {
        return this.c.getPropertyResolver(MigrationUtils.getTargetType((Entity)entity, (String)string));
    }

    private Collection<String> a(MigrationBundle migrationBundle, Map<ExternalEntityHeader, Entity> map) {
        String[] stringArray = e;
        a.log(Level.FINEST, stringArray[9], migrationBundle);
        HashSet<String> hashSet = new HashSet<String>();
        MigrationMetadata migrationMetadata = migrationBundle.getMetadata();
        for (Object object : migrationMetadata.getAllHeaders()) {
            block20: {
                try {
                    try {
                        try {
                            try {
                                if (migrationBundle.hasValueForHeader((ExternalEntityHeader)object) || map.containsKey(object)) continue;
                            }
                            catch (IllegalStateException illegalStateException) {
                                throw MigrationManagerImpl.a(illegalStateException);
                            }
                            if (map.containsKey(migrationMetadata.getCopiedOrMapped((ExternalEntityHeader)object))) continue;
                        }
                        catch (IllegalStateException illegalStateException) {
                            throw MigrationManagerImpl.a(illegalStateException);
                        }
                        if (object.getType() != EntityType.ENCAPSULATED_ASSERTION) break block20;
                    }
                    catch (IllegalStateException illegalStateException) {
                        throw MigrationManagerImpl.a(illegalStateException);
                    }
                    hashSet.add(e[31] + String.valueOf(object) + e[12]);
                    continue;
                }
                catch (IllegalStateException illegalStateException) {
                    throw MigrationManagerImpl.a(illegalStateException);
                }
            }
            stringArray = e;
            hashSet.add(stringArray[37] + String.valueOf(object));
        }
        for (MigrationDependency migrationDependency : migrationMetadata.getDependencies()) {
            ExternalEntityHeader externalEntityHeader;
            block21: {
                externalEntityHeader = migrationDependency.getDependency();
                try {
                    try {
                        if (migrationDependency.getMappingType() != MigrationMappingSelection.REQUIRED || migrationMetadata.isMapped(externalEntityHeader)) break block21;
                    }
                    catch (IllegalStateException illegalStateException) {
                        throw MigrationManagerImpl.a(illegalStateException);
                    }
                    hashSet.add(e[40] + String.valueOf(migrationDependency));
                }
                catch (IllegalStateException illegalStateException) {
                    throw MigrationManagerImpl.a(illegalStateException);
                }
            }
            try {
                try {
                    try {
                        if (migrationMetadata.isMapped(externalEntityHeader) || externalEntityHeader.getValueMapping() != MigrationMappingSelection.REQUIRED) continue;
                    }
                    catch (IllegalStateException illegalStateException) {
                        throw MigrationManagerImpl.a(illegalStateException);
                    }
                    if (externalEntityHeader.getMappedValue() != null) continue;
                }
                catch (IllegalStateException illegalStateException) {
                    throw MigrationManagerImpl.a(illegalStateException);
                }
                hashSet.add(e[42] + String.valueOf(migrationDependency));
            }
            catch (IllegalStateException illegalStateException) {
                throw MigrationManagerImpl.a(illegalStateException);
            }
        }
        return hashSet;
    }

    private PublishedService.WsdlStrategy b(ExternalEntityHeader externalEntityHeader, MigrationBundle migrationBundle) {
        return new ServiceDocumentWsdlStrategy(this.b(externalEntityHeader, migrationBundle.getExportedEntities()));
    }

    private Collection<ServiceDocument> b(ExternalEntityHeader externalEntityHeader, Map<ExternalEntityHeader, Entity> map) {
        ArrayList<ServiceDocument> arrayList = new ArrayList<ServiceDocument>();
        for (ExternalEntityHeader externalEntityHeader2 : map.keySet()) {
            if (externalEntityHeader2.getType() != EntityType.SERVICE_DOCUMENT) continue;
            ServiceDocument serviceDocument = (ServiceDocument)map.get(externalEntityHeader2);
            try {
                if (!Goid.equals((Goid)serviceDocument.getServiceId(), (Goid)externalEntityHeader.getGoid())) continue;
                arrayList.add(serviceDocument);
            }
            catch (IllegalStateException illegalStateException) {
                throw MigrationManagerImpl.a(illegalStateException);
            }
        }
        return arrayList;
    }

    private void a(MigrationMetadata migrationMetadata, ExternalEntityHeader externalEntityHeader, Set<ExternalEntityHeader> set) throws MigrationApi.MigrationException, PropertyResolverException {
        String[] stringArray = e;
        a.log(Level.FINE, stringArray[13] + externalEntityHeader.toStringVerbose());
        set.add(externalEntityHeader);
        Entity entity = this.d(externalEntityHeader);
        for (Method method : entity.getClass().getMethods()) {
            if (!MigrationUtils.isDependency((Method)method)) continue;
            PropertyResolver propertyResolver = this.b(entity, method.getName());
            Map map = propertyResolver.getDependencies(externalEntityHeader, (Object)entity, method, MigrationUtils.propertyNameFromGetter((String)method.getName()));
            for (ExternalEntityHeader externalEntityHeader2 : map.keySet()) {
                ExternalEntityHeader externalEntityHeader3 = this.b(externalEntityHeader2);
                for (MigrationDependency migrationDependency : (Set)map.get(externalEntityHeader2)) {
                    try {
                        if (migrationDependency != null) {
                            migrationDependency.setDependency(externalEntityHeader3);
                            migrationMetadata.addDependency(migrationDependency);
                            a.log(Level.FINE, e[44] + String.valueOf(migrationDependency));
                        }
                    }
                    catch (MigrationApi.MigrationException migrationException) {
                        throw MigrationManagerImpl.a((Exception)((Object)migrationException));
                    }
                    try {
                        try {
                            try {
                                block16: {
                                    try {
                                        try {
                                            if (set.contains(externalEntityHeader3)) continue;
                                            if (migrationDependency == null) break block16;
                                        }
                                        catch (MigrationApi.MigrationException migrationException) {
                                            throw MigrationManagerImpl.a((Exception)((Object)migrationException));
                                        }
                                        if (migrationDependency.getMappingType() == MigrationMappingSelection.REQUIRED) continue;
                                    }
                                    catch (MigrationApi.MigrationException migrationException) {
                                        throw MigrationManagerImpl.a((Exception)((Object)migrationException));
                                    }
                                }
                                if (externalEntityHeader3.getValueMapping() == MigrationMappingSelection.REQUIRED) continue;
                            }
                            catch (MigrationApi.MigrationException migrationException) {
                                throw MigrationManagerImpl.a((Exception)((Object)migrationException));
                            }
                            if (externalEntityHeader2 instanceof ValueReferenceEntityHeader) continue;
                        }
                        catch (MigrationApi.MigrationException migrationException) {
                            throw MigrationManagerImpl.a((Exception)((Object)migrationException));
                        }
                        this.a(migrationMetadata, externalEntityHeader3, set);
                    }
                    catch (MigrationApi.MigrationException migrationException) {
                        throw MigrationManagerImpl.a((Exception)((Object)migrationException));
                    }
                }
            }
        }
    }

    private ExternalEntityHeader b(ExternalEntityHeader externalEntityHeader) throws MigrationApi.MigrationException {
        ExternalEntityHeader externalEntityHeader2;
        try {
            if (externalEntityHeader instanceof ValueReferenceEntityHeader) {
                return externalEntityHeader;
            }
        }
        catch (MigrationApi.MigrationException migrationException) {
            throw MigrationManagerImpl.a((Exception)((Object)migrationException));
        }
        Entity entity = null;
        try {
            entity = this.d(externalEntityHeader);
        }
        catch (MigrationApi.MigrationException migrationException) {
            a.log(Level.WARNING, e[24] + ExceptionUtils.getMessage((Throwable)migrationException), ExceptionUtils.getDebugException((Throwable)migrationException));
        }
        try {
            externalEntityHeader2 = entity == null ? externalEntityHeader : EntityHeaderUtils.toExternal(EntityHeaderUtils.fromEntity(entity));
        }
        catch (MigrationApi.MigrationException migrationException) {
            throw MigrationManagerImpl.a((Exception)((Object)migrationException));
        }
        ExternalEntityHeader externalEntityHeader3 = externalEntityHeader2;
        try {
            if (externalEntityHeader3 != externalEntityHeader) {
                externalEntityHeader3.addExtraProperties(externalEntityHeader.getExtraProperties());
            }
        }
        catch (MigrationApi.MigrationException migrationException) {
            throw MigrationManagerImpl.a((Exception)((Object)migrationException));
        }
        this.c(externalEntityHeader3);
        return externalEntityHeader3;
    }

    private Set<ExternalEntityHeader> a(Collection<ExternalEntityHeader> collection) throws MigrationApi.MigrationException {
        LinkedHashSet<ExternalEntityHeader> linkedHashSet = new LinkedHashSet<ExternalEntityHeader>(collection.size());
        for (ExternalEntityHeader externalEntityHeader : collection) {
            linkedHashSet.add(this.b(externalEntityHeader));
        }
        return linkedHashSet;
    }

    /*
     * WARNING - Removed back jump from a try to a catch block - possible behaviour change.
     * Unable to fully structure code
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    private void c(ExternalEntityHeader var1_1) throws MigrationApi.MigrationException {
        try {
            if (var1_1 == null) return;
            ** GOTO lbl8
        }
        catch (ExternalEntityHeaderEnhancer.EnhancementException v0) {
            try {
                throw MigrationManagerImpl.a(v0);
lbl8:
                // 2 sources

                if (this.d == null) return;
            }
            catch (MigrationApi.MigrationException v1) {
                throw MigrationManagerImpl.a((Exception)v1);
            }
            {
                try {}
                catch (ExternalEntityHeaderEnhancer.EnhancementException var2_2) {
                    throw new MigrationApi.MigrationException(ExceptionUtils.getMessage((Throwable)var2_2), (Throwable)var2_2);
                }
            }
        }
        this.d.enhance(var1_1);
    }

    private String a(String string, ExternalEntityHeader externalEntityHeader, Exception exception) {
        String string2;
        block12: {
            String string3;
            String string4;
            block11: {
                block10: {
                    EntityHeader entityHeader = EntityHeaderUtils.fromExternal(externalEntityHeader);
                    String[] stringArray = e;
                    string2 = string + stringArray[56];
                    if (entityHeader instanceof ServiceHeader) {
                        String string5 = this.a(entityHeader);
                        String string6 = ((ServiceHeader)entityHeader).getDisplayName();
                        String string7 = String.valueOf(entityHeader.getType());
                        string2 = string2 + string7 + stringArray[17] + string6 + string5 + stringArray[11];
                    } else {
                        String string8;
                        String string9;
                        String string10;
                        try {
                            string10 = string2;
                            string9 = String.valueOf(entityHeader.getType());
                            string8 = entityHeader.getName() == null ? "" : entityHeader.getName();
                        }
                        catch (IllegalStateException illegalStateException) {
                            throw MigrationManagerImpl.a(illegalStateException);
                        }
                        String string11 = this.a(entityHeader);
                        String string12 = string8;
                        String string13 = string9;
                        stringArray = e;
                        string2 = string10 + string13 + stringArray[17] + string12 + string11 + stringArray[16];
                    }
                    string4 = ExceptionUtils.getMessage((Throwable)exception);
                    try {
                        try {
                            if (exception != null && exception.getCause() != null) break block10;
                        }
                        catch (IllegalStateException illegalStateException) {
                            throw MigrationManagerImpl.a(illegalStateException);
                        }
                        string3 = "";
                        break block11;
                    }
                    catch (IllegalStateException illegalStateException) {
                        throw MigrationManagerImpl.a(illegalStateException);
                    }
                }
                string3 = ExceptionUtils.getMessage((Throwable)exception.getCause());
            }
            String string14 = string3;
            string2 = string2 + string4;
            try {
                if (string4 != null && string4.equals(string14)) break block12;
            }
            catch (IllegalStateException illegalStateException) {
                throw MigrationManagerImpl.a(illegalStateException);
            }
            string2 = string2 + e[1] + string14 + ")";
        }
        return string2;
    }

    private String a(EntityHeader entityHeader) {
        Object object;
        String string;
        block7: {
            block6: {
                try {
                    if (!(entityHeader instanceof GuidEntityHeader)) break block6;
                    string = ((GuidEntityHeader)entityHeader).getGuid();
                    break block7;
                }
                catch (IllegalStateException illegalStateException) {
                    throw MigrationManagerImpl.a(illegalStateException);
                }
            }
            try {
                string = !entityHeader.getGoid().equals((Object)PersistentEntity.DEFAULT_GOID) ? Goid.toString((Goid)entityHeader.getGoid()) : null;
            }
            catch (IllegalStateException illegalStateException) {
                throw MigrationManagerImpl.a(illegalStateException);
            }
        }
        String string2 = string;
        try {
            object = string2 == null ? "" : e[53] + string2 + ")";
        }
        catch (IllegalStateException illegalStateException) {
            throw MigrationManagerImpl.a(illegalStateException);
        }
        return object;
    }

    private Entity d(ExternalEntityHeader externalEntityHeader) throws MigrationApi.MigrationException {
        Entity entity;
        block8: {
            String string;
            String string2;
            MigrationApi.MigrationException migrationException;
            MigrationApi.MigrationException migrationException2;
            EntityHeader entityHeader;
            String[] stringArray;
            block10: {
                block9: {
                    stringArray = e;
                    a.log(Level.FINEST, stringArray[8], externalEntityHeader);
                    try {
                        entityHeader = EntityHeaderUtils.fromExternal(externalEntityHeader, false);
                    }
                    catch (IllegalArgumentException illegalArgumentException) {
                        stringArray = e;
                        throw new MigrationApi.MigrationException(stringArray[5] + externalEntityHeader.getExternalId(), (Throwable)illegalArgumentException);
                    }
                    try {
                        entity = entityHeader instanceof ValueReferenceEntityHeader ? this.b.find(EntityHeaderUtils.fromExternal(((ValueReferenceEntityHeader)entityHeader).getOwnerHeader())) : this.b.find(entityHeader);
                    }
                    catch (Exception exception) {
                        stringArray = e;
                        throw new MigrationApi.MigrationException(stringArray[18] + String.valueOf(entityHeader), (Throwable)exception);
                    }
                    try {
                        try {
                            MigrationApi.MigrationException migrationException3;
                            if (entity != null) break block8;
                            migrationException2 = migrationException3;
                            migrationException = migrationException3;
                            string2 = String.valueOf(entityHeader.getType());
                            if (entityHeader.getName() != null) break block9;
                        }
                        catch (IllegalArgumentException illegalArgumentException) {
                            throw MigrationManagerImpl.a(illegalArgumentException);
                        }
                        string = "";
                        break block10;
                    }
                    catch (IllegalArgumentException illegalArgumentException) {
                        throw MigrationManagerImpl.a(illegalArgumentException);
                    }
                }
                string = entityHeader.getName();
            }
            String string3 = String.valueOf(entityHeader.getGoid());
            String string4 = string;
            String string5 = string2;
            stringArray = e;
            migrationException2(stringArray[19] + string5 + stringArray[52] + string4 + stringArray[3] + string3 + ")");
            throw migrationException;
        }
        return entity;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[63];
                var3_1 = 0;
                var2_2 = "K\u0005X'\b<\u0000&\u001eN%\u0014;\u0015c\b\u000b$\u0000 \u0006k\t_1\u0013|\u0002&D\u001bK\u0005X'\b<\u0000&\u001eN%\u0014;\u0015c\b\u000b$\u0000 \u0006k\t_1\u0013|\u0003&D\b,@\u0003^:\u0005r\u001c6\u0011\u000b9\u0000\"\u0017o\u0002Lt\u00023\tb\u0005O5\u00157\u0014&\nD&A:\u0002g\bN&A)V{B(C\u001eY;\u0013r\u0017t\u0003H1\u0012!\u000eh\u000b\u000b \t7Gn\tJ0\u0004 G`\u0003Yt\u0004<\u0013o\u0018RnA\u0007o\u0002I;\u0014<\u0003HE\rE:\u000e&Gg\u001c[8\u0018r\ng\u001c[=\u000f5K&\u0018J&\u00067\u0013&\tE \b&\u001e&\u0002D A4\bs\u0002Ot\u0007=\u0015&\bN$\u0004<\u0003c\u0002H-A \u0002`\tY1\u000f1\u0002<L\u001eJ\u0003J0\b<\u0000&\tE \b&\u001e&\nD&A:\u0002g\bN&[r\u001c6\u0011\u0016P\rG=\u00053\u0013o\u0002Lt\u0003'\tb\u0000NnA)W{\u001bC\u001eY;\u0013r\u000bo\u001f_=\u000f5Gc\u0002_=\u0015;\u0002uLM;\u0013r\t\f\b^1A&\b<fL(L{8\u00043\u0014cLB9\u0011=\u0015rL_<\u0004r\"h\u000fJ$\u0012'\u000bg\u0018N0A\u0013\u0014u\tY \b=\t&\u0003Et\u0015:\u0002&\u0018J&\u00067\u0013&\u001cY=\u000e Gr\u0003\u000b9\b5\u0015g\u0018B:\u0006|\u001a@\u0005E0\b<\u0000&\bN$\u0004<\u0003c\u0002H=\u0004!G`\u0003YnA C\u001eY;\u0013r\u0001j\u0019X<\b<\u0000&\tE \b&\u001e&\nD&A!\u0006p\t\u0011t\rk\tX'\u00005\u0002U\u0003^&\u00027\t\f\b^1A&\b<f\u0002*L%C\u001eY;\u0013r\u000bi\rO=\u000f5Gr\u0004Nt\u0004<\u0013o\u0018Rt\u0007=\u0015&\u0004N5\u00057\u0015<L$C\u001eY;\u0013r\u000bi\rO=\u000f5Gr\u0004Nt\u0004<\u0013o\u0018Rt\u0007=\u0015&\u0004N5\u00057\u0015&\re\u0003E:\u00041\u0013i\u001e\u007f-\u00117\nC\u0002_=\u0015+ i\u0005O\u0007o\u0002I;\u0014<\u0003%@\u0005E0\b<\u0000&\bN$\u0004<\u0003c\u0002H=\u0004!G`\u0003Yt\t7\u0006b\tY'[r\u001c6\u0011\u0018C\u001eY;\u0013r\u0015c\u001fD8\u0017;\taLC1\u00006\u0002tV\u000b\ft\tX;\u0014 \u0004c8R$\u0004 H\u0003\u000b$\u0013=\u0017c\u001e_-A \u0002u\u0003G\"\u0004 G`\u0003^:\u0005r\u0001i\u001e\u0011t@E\u0005Y7\u0014>\u0006tLO1\u00117\tb\tE7\u0018r\u0015c\rH<\u00046Gb\u0019Y=\u000f5Gc\u0002_=\u0015+Gs\u001cG;\u00006G`\u0003Yt\t7\u0006b\tYt\u001ab\u001a($O\u0001[;\u0013&G`\rB8\u00046Gq\u0004N:A\"\u0015i\u000fN'\u0012;\taLN:\u0015;\u0013\u007f\"C\u001eY;\u0013r\u0001j\u0019X<\b<\u0000&\tE \b&\u001e&\nD&A'\u0017b\r_1[r+C\u0002_=\u0015+Gh\u0003_t\u0007=\u0012h\b\u000b=\u000fr\u0013n\t\u000b6\u0014<\u0003j\t\u000b2\u000e Gn\tJ0\u0004 ]&-C\u0002H5\u0011!\u0012j\r_1\u0005r&u\u001fN&\u0015;\bhLE;\u0015r\u0001i\u0019E0A4\btLC1\u00006\u0002tV\u000b\rk\tX'\u00005\u0002U\u0003^&\u00027\u0018H\u0003_t\u0004*\u0017i\u001e_=\u000f5Gn\tJ0\u0004 G}\\V\u0004r\u0015[1\ft\tX;\u0014 \u0004c8R$\u0004!C\u0002_=\u0015+Gp\rG!\u0004r\u0001i\u001e\u000b<\u00043\u0003c\u001e\u000b/Q/G<LPe\u001c\u001dC\u0002_=\u0015+Gh\u0003_t\u0007=\u0012h\b\u000b2\u000e Gn\tJ0\u0004 ]&\u001cC\u001eY;\u0013r\u0010n\tEt\u0011 \be\tX'\b<\u0000&\tE \b&\u001e,H\u0003_t\u00173\u000bo\bJ \b<\u0000&\u0004N5\u00057\u0015<LN:\u0015;\u0013\u007fLE;\u0015r\u0001i\u0019E0[r\u001c6\u0011\u0019S\u0002Y1\u0012=\u000bp\tOt\u000f3\ncAF5\u0011\"\u000eh\u000b\u0011t$C\u001eY;\u0013r\u0006v\u001cG-\b<\u0000&\u001aJ8\u00147Gt\tM1\u00137\te\t\u000b2\u000e ]&\u001aS\u0002Y1\u0012=\u000bp\tOt\u00173\u000bs\t\u00069\u0000\"\u0017o\u0002LnA\u0015v\u001eD$\u0004 \u0013o\tX\u000fF;\td\u0003^:\u0005u:\u0012G\bO1\u0005r\u0003c\u001cN:\u00057\te\u0015\u0011t+K\u0003Y1A&\u000fg\u0002\u000b;\u000f7Gv\u001eD$\u0004 \u0013\u007fLY1\u0012=\u000bp\tYt\u0007=\u0012h\b\u000b2\u000e ]&$C\u001eY;\u0013r\u0015c\u0018Y=\u0004$\u000eh\u000b\u000b9\u0000\"\u0017o\u0002Lt\u00023\tb\u0005O5\u00157]&\u0003&V\u000b\u001aC\u0014H1\u0011&\u000ei\u0002\u000b&\u00043\u0003o\u0002Lt\u0011=\u000bo\u000fRnA\u001fJ\u0005X \b<\u0000&\tE \b&\u000ec\u001f\u000b2\u000e Ge\u0000J'\u0012hG}\\V\re\u0003E:\u00041\u0013i\u001e\u007f-\u001173C\u0002_=\u0015+Gh\u0003_t\u0007=\u0012h\b\u000b;\u000fr\u0013n\t\u000b \u0000 \u0000c\u0018\u000b7\r'\u0014r\tYt\u0007=\u0015&\u0004N5\u00057\u0015<L\u0002*L\u0003&D\b+C\u0002_=\u0015+Gh\u0003_t\u0007=\u0012h\b\u000b=\u000fr\u0013n\t\u000b6\u0014<\u0003j\t\u000b2\u000e Gn\tJ0\u0004 ]&\u001cC\u001eY;\u0013r\u0010n\tEt\u0011 \be\tX'\b<\u0000&\tE \b&\u001e\u0002<f\u0004r\u0015[1$O\u0001[;\u0013&G`\rB8\u00046Gq\u0004N:A\"\u0015i\u000fN'\u0012;\taLN:\u0015;\u0013\u007f\tC\u0002_=\u0015+(o\b%C\u0014H1\u0011&\u000ei\u0002\u000b&\u00043\u0003o\u0002Lt\u0011'\u0005j\u0005X<\u00046Gu\tY\"\b1\u0002<L";
                var4_3 = "K\u0005X'\b<\u0000&\u001eN%\u0014;\u0015c\b\u000b$\u0000 \u0006k\t_1\u0013|\u0002&D\u001bK\u0005X'\b<\u0000&\u001eN%\u0014;\u0015c\b\u000b$\u0000 \u0006k\t_1\u0013|\u0003&D\b,@\u0003^:\u0005r\u001c6\u0011\u000b9\u0000\"\u0017o\u0002Lt\u00023\tb\u0005O5\u00157\u0014&\nD&A:\u0002g\bN&A)V{B(C\u001eY;\u0013r\u0017t\u0003H1\u0012!\u000eh\u000b\u000b \t7Gn\tJ0\u0004 G`\u0003Yt\u0004<\u0013o\u0018RnA\u0007o\u0002I;\u0014<\u0003HE\rE:\u000e&Gg\u001c[8\u0018r\ng\u001c[=\u000f5K&\u0018J&\u00067\u0013&\tE \b&\u001e&\u0002D A4\bs\u0002Ot\u0007=\u0015&\bN$\u0004<\u0003c\u0002H-A \u0002`\tY1\u000f1\u0002<L\u001eJ\u0003J0\b<\u0000&\tE \b&\u001e&\nD&A:\u0002g\bN&[r\u001c6\u0011\u0016P\rG=\u00053\u0013o\u0002Lt\u0003'\tb\u0000NnA)W{\u001bC\u001eY;\u0013r\u000bo\u001f_=\u000f5Gc\u0002_=\u0015;\u0002uLM;\u0013r\t\f\b^1A&\b<fL(L{8\u00043\u0014cLB9\u0011=\u0015rL_<\u0004r\"h\u000fJ$\u0012'\u000bg\u0018N0A\u0013\u0014u\tY \b=\t&\u0003Et\u0015:\u0002&\u0018J&\u00067\u0013&\u001cY=\u000e Gr\u0003\u000b9\b5\u0015g\u0018B:\u0006|\u001a@\u0005E0\b<\u0000&\bN$\u0004<\u0003c\u0002H=\u0004!G`\u0003YnA C\u001eY;\u0013r\u0001j\u0019X<\b<\u0000&\tE \b&\u001e&\nD&A!\u0006p\t\u0011t\rk\tX'\u00005\u0002U\u0003^&\u00027\t\f\b^1A&\b<f\u0002*L%C\u001eY;\u0013r\u000bi\rO=\u000f5Gr\u0004Nt\u0004<\u0013o\u0018Rt\u0007=\u0015&\u0004N5\u00057\u0015<L$C\u001eY;\u0013r\u000bi\rO=\u000f5Gr\u0004Nt\u0004<\u0013o\u0018Rt\u0007=\u0015&\u0004N5\u00057\u0015&\re\u0003E:\u00041\u0013i\u001e\u007f-\u00117\nC\u0002_=\u0015+ i\u0005O\u0007o\u0002I;\u0014<\u0003%@\u0005E0\b<\u0000&\bN$\u0004<\u0003c\u0002H=\u0004!G`\u0003Yt\t7\u0006b\tY'[r\u001c6\u0011\u0018C\u001eY;\u0013r\u0015c\u001fD8\u0017;\taLC1\u00006\u0002tV\u000b\ft\tX;\u0014 \u0004c8R$\u0004 H\u0003\u000b$\u0013=\u0017c\u001e_-A \u0002u\u0003G\"\u0004 G`\u0003^:\u0005r\u0001i\u001e\u0011t@E\u0005Y7\u0014>\u0006tLO1\u00117\tb\tE7\u0018r\u0015c\rH<\u00046Gb\u0019Y=\u000f5Gc\u0002_=\u0015+Gs\u001cG;\u00006G`\u0003Yt\t7\u0006b\tYt\u001ab\u001a($O\u0001[;\u0013&G`\rB8\u00046Gq\u0004N:A\"\u0015i\u000fN'\u0012;\taLN:\u0015;\u0013\u007f\"C\u001eY;\u0013r\u0001j\u0019X<\b<\u0000&\tE \b&\u001e&\nD&A'\u0017b\r_1[r+C\u0002_=\u0015+Gh\u0003_t\u0007=\u0012h\b\u000b=\u000fr\u0013n\t\u000b6\u0014<\u0003j\t\u000b2\u000e Gn\tJ0\u0004 ]&-C\u0002H5\u0011!\u0012j\r_1\u0005r&u\u001fN&\u0015;\bhLE;\u0015r\u0001i\u0019E0A4\btLC1\u00006\u0002tV\u000b\rk\tX'\u00005\u0002U\u0003^&\u00027\u0018H\u0003_t\u0004*\u0017i\u001e_=\u000f5Gn\tJ0\u0004 G}\\V\u0004r\u0015[1\ft\tX;\u0014 \u0004c8R$\u0004!C\u0002_=\u0015+Gp\rG!\u0004r\u0001i\u001e\u000b<\u00043\u0003c\u001e\u000b/Q/G<LPe\u001c\u001dC\u0002_=\u0015+Gh\u0003_t\u0007=\u0012h\b\u000b2\u000e Gn\tJ0\u0004 ]&\u001cC\u001eY;\u0013r\u0010n\tEt\u0011 \be\tX'\b<\u0000&\tE \b&\u001e,H\u0003_t\u00173\u000bo\bJ \b<\u0000&\u0004N5\u00057\u0015<LN:\u0015;\u0013\u007fLE;\u0015r\u0001i\u0019E0[r\u001c6\u0011\u0019S\u0002Y1\u0012=\u000bp\tOt\u000f3\ncAF5\u0011\"\u000eh\u000b\u0011t$C\u001eY;\u0013r\u0006v\u001cG-\b<\u0000&\u001aJ8\u00147Gt\tM1\u00137\te\t\u000b2\u000e ]&\u001aS\u0002Y1\u0012=\u000bp\tOt\u00173\u000bs\t\u00069\u0000\"\u0017o\u0002LnA\u0015v\u001eD$\u0004 \u0013o\tX\u000fF;\td\u0003^:\u0005u:\u0012G\bO1\u0005r\u0003c\u001cN:\u00057\te\u0015\u0011t+K\u0003Y1A&\u000fg\u0002\u000b;\u000f7Gv\u001eD$\u0004 \u0013\u007fLY1\u0012=\u000bp\tYt\u0007=\u0012h\b\u000b2\u000e ]&$C\u001eY;\u0013r\u0015c\u0018Y=\u0004$\u000eh\u000b\u000b9\u0000\"\u0017o\u0002Lt\u00023\tb\u0005O5\u00157]&\u0003&V\u000b\u001aC\u0014H1\u0011&\u000ei\u0002\u000b&\u00043\u0003o\u0002Lt\u0011=\u000bo\u000fRnA\u001fJ\u0005X \b<\u0000&\tE \b&\u000ec\u001f\u000b2\u000e Ge\u0000J'\u0012hG}\\V\re\u0003E:\u00041\u0013i\u001e\u007f-\u001173C\u0002_=\u0015+Gh\u0003_t\u0007=\u0012h\b\u000b;\u000fr\u0013n\t\u000b \u0000 \u0000c\u0018\u000b7\r'\u0014r\tYt\u0007=\u0015&\u0004N5\u00057\u0015<L\u0002*L\u0003&D\b+C\u0002_=\u0015+Gh\u0003_t\u0007=\u0012h\b\u000b=\u000fr\u0013n\t\u000b6\u0014<\u0003j\t\u000b2\u000e Gn\tJ0\u0004 ]&\u001cC\u001eY;\u0013r\u0010n\tEt\u0011 \be\tX'\b<\u0000&\tE \b&\u001e\u0002<f\u0004r\u0015[1$O\u0001[;\u0013&G`\rB8\u00046Gq\u0004N:A\"\u0015i\u000fN'\u0012;\taLN:\u0015;\u0013\u007f\tC\u0002_=\u0015+(o\b%C\u0014H1\u0011&\u000ei\u0002\u000b&\u00043\u0003o\u0002Lt\u0011'\u0005j\u0005X<\u00046Gu\tY\"\b1\u0002<L".length();
                var1_4 = 27;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = MigrationManagerImpl.a(v0, MigrationManagerImpl.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "\u0004J\u0010pXm\f\"W\u0005mKmE\"I@qEm\f&I\u000fhD#\f&\u001fB\u0014mC|Z$I\u0007?Gx\\=N\u000ex\nzM#C\t{KmI>\u0007\u0006pX9W}ZN";
                    var4_3 = "\u0004J\u0010pXm\f\"W\u0005mKmE\"I@qEm\f&I\u000fhD#\f&\u001fB\u0014mC|Z$I\u0007?Gx\\=N\u000ex\nzM#C\t{KmI>\u0007\u0006pX9W}ZN".length();
                    var1_4 = 28;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 118;
                        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++] = MigrationManagerImpl.a(v0, MigrationManagerImpl.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;
            }
        }
        MigrationManagerImpl.e = var5;
        MigrationManagerImpl.a = Logger.getLogger(MigrationManagerImpl.class.getName());
    }

    private static Exception a(Exception exception) {
        return exception;
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x5A);
        }
        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 -> 59;
                    case 1 -> 81;
                    case 2 -> 22;
                    case 3 -> 105;
                    case 4 -> 92;
                    case 5 -> 111;
                    default -> 90;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

