/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package eu.dnetlib.espas.pep;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * A PEPResponse instance is a container of the Policy response message retrieved by the Policy Definition Point for a given request.
 * @author gathanas
 */

public class PEPResponseMap {
    
    private Map<String, PEPResponse> responseMap;

    
    public PEPResponseMap(Map<String, PEPResponse> responseList) {
        this.responseMap = responseList;
    }

    public PEPResponseMap() {
        this.responseMap = new HashMap<String, PEPResponse>();
    }


    public boolean isResourcePermited(String resourceId){
        if(this.responseMap.containsKey(resourceId))
            return responseMap.get(resourceId).isIsPermited();
        
        return false;
        }

    public String policyResponseMsg(String resourceId){
        if(this.responseMap.containsKey(resourceId))
            return responseMap.get(resourceId).getResponseMessage();
        
        return "";
    }
    
    public void addResponse(String requestedResource, PEPResponse response){
        this.responseMap.put(requestedResource, response);
    }
    /**
     * Get the value of responseList
     *
     * @return the value of responseList
     */
    public Map<String, PEPResponse> getResponseMap() {
        return responseMap;
    }

    
    
}

