Skip to contentPackage: CucRole
CucRole
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: import java.util.HashSet;
21: import java.util.Set;
22:
23: public class CucRole {
24:
25: private String name;
26: private Integer scopeId;
27: private String actions;
28: private KapuaId id;
29: private Set<Actions> actionSet;
30:
31: public void doParse() {
32:• if (scopeId != null) {
33: id = new KapuaEid(BigInteger.valueOf(scopeId));
34: }
35:• if (actions != null) {
36: String tmpAct = actions.trim().toLowerCase();
37:• if (tmpAct.length() != 0) {
38: actionSet = new HashSet<>();
39: String[] tmpList = actions.split(",");
40:
41:• for (String tmpS : tmpList) {
42:• switch (tmpS.trim().toLowerCase()) {
43: case "read":
44: actionSet.add(Actions.read);
45: break;
46: case "write":
47: actionSet.add(Actions.write);
48: break;
49: case "delete":
50: actionSet.add(Actions.delete);
51: break;
52: case "connect":
53: actionSet.add(Actions.connect);
54: break;
55: case "execute":
56: actionSet.add(Actions.execute);
57: break;
58: }
59: }
60: }
61: }
62: }
63:
64: public String getName() {
65: return name;
66: }
67:
68: public void setName(String name) {
69: this.name = name;
70: }
71:
72: public void setScopeId(KapuaId id) {
73: this.id = id;
74: }
75:
76: public KapuaId getScopeId() {
77: return id;
78: }
79:
80: public Set<Actions> getActions() {
81: return actionSet;
82: }
83:
84: public void setActions(Set<Actions> actions) {
85: actionSet = actions;
86: }
87: }