/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.mapping.MessageContextMappingKeys
 *  com.l7tech.gateway.common.mapping.MessageContextMappingValues
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.Goid
 *  com.l7tech.objectmodel.PersistentEntity
 *  com.l7tech.objectmodel.SaveException
 *  com.l7tech.objectmodel.UpdateException
 */
package com.l7tech.server.mapping;

import com.l7tech.gateway.common.mapping.MessageContextMappingKeys;
import com.l7tech.gateway.common.mapping.MessageContextMappingValues;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.PersistentEntity;
import com.l7tech.objectmodel.SaveException;
import com.l7tech.objectmodel.UpdateException;
import com.l7tech.server.mapping.MessageContextMappingKeyManager;
import com.l7tech.server.mapping.MessageContextMappingManager;
import com.l7tech.server.mapping.MessageContextMappingValueManager;

public class MessageContextMappingManagerImpl
implements MessageContextMappingManager {
    private final MessageContextMappingKeyManager a;
    private final MessageContextMappingValueManager b;

    public MessageContextMappingManagerImpl(MessageContextMappingKeyManager messageContextMappingKeyManager, MessageContextMappingValueManager messageContextMappingValueManager) {
        this.a = messageContextMappingKeyManager;
        this.b = messageContextMappingValueManager;
    }

    @Override
    public Goid saveMessageContextMappingKeys(MessageContextMappingKeys messageContextMappingKeys) throws SaveException, FindException, UpdateException {
        MessageContextMappingKeys messageContextMappingKeys2 = this.a.getMessageContextMappingKeys(messageContextMappingKeys);
        try {
            if (messageContextMappingKeys2 == null) {
                messageContextMappingKeys.setCreateTime(System.currentTimeMillis());
                return this.a.save((PersistentEntity)messageContextMappingKeys);
            }
        }
        catch (SaveException saveException) {
            throw MessageContextMappingManagerImpl.a(saveException);
        }
        return messageContextMappingKeys2.getGoid();
    }

    @Override
    public Goid saveMessageContextMappingValues(MessageContextMappingValues messageContextMappingValues) throws SaveException, FindException {
        MessageContextMappingValues messageContextMappingValues2 = this.b.getMessageContextMappingValues(messageContextMappingValues);
        try {
            if (messageContextMappingValues2 == null) {
                messageContextMappingValues.setCreateTime(System.currentTimeMillis());
                return this.b.save((PersistentEntity)messageContextMappingValues);
            }
        }
        catch (SaveException saveException) {
            throw MessageContextMappingManagerImpl.a(saveException);
        }
        return messageContextMappingValues2.getGoid();
    }

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

