Skip to content

Package: Domain$1

Domain$1

nameinstructionbranchcomplexitylinemethod
getActions()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getGroupable()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getName()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
{...}
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

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.service.authorization.domain;
14:
15: import org.eclipse.kapua.model.KapuaEntity;
16: import org.eclipse.kapua.model.domain.AbstractDomain;
17: import org.eclipse.kapua.model.domain.Actions;
18: import org.eclipse.kapua.service.KapuaService;
19: import org.eclipse.kapua.service.authorization.permission.Permission;
20:
21: import javax.xml.bind.annotation.XmlAccessType;
22: import javax.xml.bind.annotation.XmlAccessorType;
23: import javax.xml.bind.annotation.XmlElement;
24: import javax.xml.bind.annotation.XmlElementWrapper;
25: import javax.xml.bind.annotation.XmlRootElement;
26: import javax.xml.bind.annotation.XmlTransient;
27: import javax.xml.bind.annotation.XmlType;
28: import java.util.Set;
29:
30: /**
31: * {@link Domain} {@link KapuaEntity} definition
32: * <p>
33: * {@link Domain} contains the information about the available {@link Actions} for a {@link KapuaEntity} {@link Domain}<br>
34: * Services needs to register their own specific {@link Domain}.
35: *
36: * @since 1.0.0
37: */
38: @XmlRootElement(name = "domain")
39: @XmlAccessorType(XmlAccessType.PROPERTY)
40: @XmlType(propOrder = {"name",
41: "actions",
42: "groupable"})
43: public interface Domain extends KapuaEntity {//, org.eclipse.kapua.model.domain.Domain {
44:
45: String TYPE = "domain";
46:
47: @Override
48: default String getType() {
49: return TYPE;
50: }
51:
52: /**
53: * Sets the {@link Domain} name.<br>
54: * It must be unique within the scope.
55: *
56: * @param name The name of the {@link Domain}
57: * @since 1.0.0
58: */
59: void setName(String name);
60:
61: /**
62: * Sets the {@link Domain} service Name.<br>
63: *
64: * @param serviceName The service name of the {@link Domain}
65: * @since 6.0.0
66: */
67: void setServiceName(String serviceName);
68:
69: /**
70: * Gets the {@link Domain} name.
71: *
72: * @return The {@link Domain} name.
73: * @since 1.0.0
74: */
75: @XmlElement(name = "name")
76: String getName();
77:
78: /**
79: * Gets the {@link Domain} service name.
80: *
81: * @return The {@link Domain} service name.
82: * @since 6.0.0
83: */
84: @XmlTransient
85: String getServiceName();
86:
87: /**
88: * Sets the set of {@link Actions} available in this {@link Domain}.<br>
89: * It up to the implementation class to make a clone of the set or use the given set.
90: *
91: * @param actions The set of {@link Actions}.
92: * @since 1.0.0
93: */
94: void setActions(Set<Actions> actions);
95:
96: /**
97: * Gets the set of {@link Actions} available in this {@link Domain}.<br>
98: * The implementation must return the reference of the set and not make a clone.
99: *
100: * @return The set of {@link Actions}.
101: * @since 1.0.0
102: */
103: @XmlElementWrapper(name = "actions")
104: @XmlElement(name = "action")
105: Set<Actions> getActions();
106:
107: /**
108: * Sets whether or not this {@link Domain} is group-able or not.
109: * This determines if the {@link org.eclipse.kapua.service.authorization.permission.Permission} in this {@link Domain} can have a {@link org.eclipse.kapua.service.authorization.group.Group} or not.
110: * This is related to the {@link org.eclipse.kapua.service.authorization.group.Groupable} property of a {@link KapuaEntity}.
111: *
112: * @param groupable {@code true} if the {@link org.eclipse.kapua.service.authorization.permission.Permission} on this {@link Domain} can have the {@link Permission#getGroupId()} property set, {@code false} otherwise.
113: * @since 0.3.1
114: */
115: void setGroupable(boolean groupable);
116:
117: /**
118: * Gets whether or not this {@link Domain} is group-able or not.
119: *
120: * @return {@code true} if the {@link Permission#getGroupId()} can be set, {@code false} otherwise.
121: * @since 0.3.1
122: */
123: @XmlElement(name = "groupable")
124: boolean getGroupable();
125:
126: /**
127: * Returns the {@link KapuaService} {@link org.eclipse.kapua.model.domain.Domain} represented from {@code this} {@link Domain} registry entry.
128: *
129: * @return The {@link KapuaService} {@link org.eclipse.kapua.model.domain.Domain} of {@code this} {@link Domain}
130: * @since 1.0.0
131: */
132: @XmlTransient
133: default org.eclipse.kapua.model.domain.Domain getDomain() {
134: return new AbstractDomain() {
135:
136: @Override
137: public String getName() {
138: return Domain.this.getName();
139: }
140:
141: @Override
142: public Set<Actions> getActions() {
143: return Domain.this.getActions();
144: }
145:
146: @Override
147: public boolean getGroupable() {
148: return Domain.this.getGroupable();
149: }
150: };
151: }
152: }