summaryrefslogtreecommitdiff
path: root/base/src/main/java/com/smartdevicelink/managers/permission/PermissionStatus.java
blob: 11f46455291e0adbac1cc830d5cd79467a56894b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package com.smartdevicelink.managers.permission;

import android.support.annotation.NonNull;

import com.smartdevicelink.protocol.enums.FunctionID;

import java.util.Map;

/**
 * PermissionStatus gives a detailed view about whether an RPC and its permission parameters are allowed or not
 */
public class PermissionStatus {
    private final FunctionID rpcName;
    private boolean isRPCAllowed;
    private Map<String, Boolean> allowedParameters;

    /**
     * Creates a new PermissionStatus instance
     * @param rpcName
     * @param isRPCAllowed
     * @param allowedParameters
     */
    public PermissionStatus(@NonNull FunctionID rpcName, @NonNull boolean isRPCAllowed, Map<String, Boolean> allowedParameters) {
        this.rpcName = rpcName;
        this.isRPCAllowed = isRPCAllowed;
        this.allowedParameters = allowedParameters;
    }

    /**
     * Get the name of the RPC
     * @return FunctionID value represents the name of the RPC
     */
    public FunctionID getRPCName() {
        return rpcName;
    }

    /**
     * Get whether the RCP is allowed or not
     * @return boolean represents whether the RCP is allowed or not
     */
    public boolean getIsRPCAllowed() {
        return isRPCAllowed;
    }

    /**
     * Set whether the RPC is allowed or not
     * @param isRPCAllowed
     */
    protected void setIsRPCAllowed(@NonNull boolean isRPCAllowed) {
        this.isRPCAllowed = isRPCAllowed;
    }

    /**
     * Get the status of the permission parameter for the RPC
     * @return Map<String, Boolean> object with keys that represent the permission parameter names and values that represent whether the parameters are allowed or not
     */
    public Map<String, Boolean> getAllowedParameters() {
        return allowedParameters;
    }

    /**
     * Set the status of the permission parameter for the RPC
     * @param allowedParameters
     */
    protected void setAllowedParameters(Map<String, Boolean> allowedParameters) {
        this.allowedParameters = allowedParameters;
    }
}