Package: CucRolePermission
CucRolePermission
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CucRolePermission() |
|
|
|
|
|
||||||||||||||||||||
doParse() |
|
|
|
|
|
||||||||||||||||||||
getAction() |
|
|
|
|
|
||||||||||||||||||||
getRoleId() |
|
|
|
|
|
||||||||||||||||||||
getScopeId() |
|
|
|
|
|
||||||||||||||||||||
getTargetScopeId() |
|
|
|
|
|
||||||||||||||||||||
setAction(Actions) |
|
|
|
|
|
||||||||||||||||||||
setRoleId(KapuaId) |
|
|
|
|
|
||||||||||||||||||||
setScopeId(KapuaId) |
|
|
|
|
|
||||||||||||||||||||
setTargetScopeId(KapuaId) |
|
|
|
|
|
Coverage
1: /*******************************************************************************
2: * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.qa.common.cucumber;
14:
15: import org.eclipse.kapua.commons.model.id.KapuaEid;
16: import org.eclipse.kapua.model.domain.Actions;
17: import org.eclipse.kapua.model.id.KapuaId;
18:
19: import java.math.BigInteger;
20:
21: public class CucRolePermission {
22:
23: private KapuaId scope;
24: private Integer scopeId;
25:
26: private KapuaId role;
27: private Integer roleId;
28:
29: private Actions action;
30: private String actionName;
31:
32: private KapuaId targetScope;
33: private Integer targetScopeId;
34:
35: public void doParse() {
36:• if (this.scopeId != null) {
37: this.scope = new KapuaEid(BigInteger.valueOf(scopeId));
38: }
39:• if (this.roleId != null) {
40: this.role = new KapuaEid(BigInteger.valueOf(roleId));
41: }
42:• if (this.actionName != null) {
43:• switch (actionName.trim().toLowerCase()) {
44: case "read":
45: this.action = Actions.read;
46: break;
47: case "write":
48: this.action = Actions.write;
49: break;
50: case "delete":
51: this.action = Actions.delete;
52: break;
53: case "connect":
54: this.action = Actions.connect;
55: break;
56: case "execute":
57: this.action = Actions.execute;
58: break;
59: }
60: }
61:• if (this.targetScopeId != null) {
62: this.targetScope = new KapuaEid(BigInteger.valueOf(targetScopeId));
63: }
64: }
65:
66: public void setScopeId(KapuaId id) {
67: this.scope = id;
68: }
69:
70: public KapuaId getScopeId() {
71: return this.scope;
72: }
73:
74: public void setRoleId(KapuaId id) {
75: this.role = id;
76: }
77:
78: public KapuaId getRoleId() {
79: return this.role;
80: }
81:
82: public Actions getAction() {
83: return action;
84: }
85:
86: public void setAction(Actions action) {
87: this.action = action;
88: }
89:
90: public KapuaId getTargetScopeId() {
91: return targetScope;
92: }
93:
94: public void setTargetScopeId(KapuaId targetScope) {
95: this.targetScope = targetScope;
96: }
97: }