/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.policy.assertion.AssertionStatus
 *  com.l7tech.policy.assertion.AuditAssertion
 *  com.l7tech.policy.assertion.PolicyAssertionException
 */
package com.l7tech.server.policy.assertion;

import com.l7tech.policy.assertion.AssertionStatus;
import com.l7tech.policy.assertion.AuditAssertion;
import com.l7tech.policy.assertion.PolicyAssertionException;
import com.l7tech.server.message.PolicyEnforcementContext;
import com.l7tech.server.policy.assertion.AbstractServerAssertion;
import com.l7tech.server.policy.assertion.ServerAssertion;
import java.io.IOException;
import java.util.logging.Level;

public class ServerAuditAssertion
extends AbstractServerAssertion
implements ServerAssertion {
    private AuditAssertion d;
    private Level e;

    public ServerAuditAssertion(AuditAssertion auditAssertion) {
        super(auditAssertion);
        this.d = auditAssertion;
        this.e = Level.parse(auditAssertion.getLevel());
    }

    @Override
    public AssertionStatus checkRequest(PolicyEnforcementContext policyEnforcementContext) throws IOException, PolicyAssertionException {
        try {
            policyEnforcementContext.setAuditLevel(this.e);
            if (this.d.isChangeSaveRequest()) {
                policyEnforcementContext.setAuditSaveRequest(this.d.isSaveRequest());
            }
        }
        catch (IOException iOException) {
            throw ServerAuditAssertion.a(iOException);
        }
        try {
            if (this.d.isChangeSaveResponse()) {
                policyEnforcementContext.setAuditSaveResponse(this.d.isSaveResponse());
            }
        }
        catch (IOException iOException) {
            throw ServerAuditAssertion.a(iOException);
        }
        return AssertionStatus.NONE;
    }

    private static IOException a(IOException iOException) {
        return iOException;
    }
}

