Skip to content

Package: ScratchCodeImpl

ScratchCodeImpl

nameinstructionbranchcomplexitylinemethod
ScratchCodeImpl()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
ScratchCodeImpl(KapuaId)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
ScratchCodeImpl(KapuaId, KapuaId, String)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
ScratchCodeImpl(ScratchCode)
M: 12 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getCode()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getMfaOptionId()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
setCode(String)
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
setMfaOptionId(KapuaId)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2020, 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.authentication.credential.mfa.shiro;
14:
15: import org.eclipse.kapua.commons.model.AbstractKapuaUpdatableEntity;
16: import org.eclipse.kapua.commons.model.id.KapuaEid;
17: import org.eclipse.kapua.model.id.KapuaId;
18: import org.eclipse.kapua.service.authentication.credential.mfa.ScratchCode;
19:
20: import javax.persistence.AttributeOverride;
21: import javax.persistence.AttributeOverrides;
22: import javax.persistence.Basic;
23: import javax.persistence.Column;
24: import javax.persistence.Embedded;
25: import javax.persistence.Entity;
26: import javax.persistence.Table;
27: import javax.xml.bind.annotation.XmlAccessType;
28: import javax.xml.bind.annotation.XmlAccessorType;
29: import javax.xml.bind.annotation.XmlRootElement;
30:
31: /**
32: * {@link ScratchCode} implementation.
33: *
34: * @since 1.3.0
35: */
36: @XmlRootElement
37: @XmlAccessorType(XmlAccessType.PROPERTY)
38: @Entity(name = "ScratchCode")
39: @Table(name = "atht_scratch_code")
40: public class ScratchCodeImpl extends AbstractKapuaUpdatableEntity implements ScratchCode {
41:
42: private static final long serialVersionUID = -2785931432917205759L;
43:
44: @Embedded
45: @AttributeOverrides({
46: @AttributeOverride(name = "eid", column = @Column(name = "mfa_option_id", updatable = false, nullable = false))
47: })
48: private KapuaEid mfaOptionId;
49:
50: @Basic
51: @Column(name = "scratch_code", nullable = false)
52: private String code;
53:
54: /**
55: * Constructor.
56: *
57: * @since 1.3.0
58: */
59: public ScratchCodeImpl() {
60: super();
61: }
62:
63: /**
64: * Constructor.
65: *
66: * @param scopeId The {@link ScratchCode#getScopeId()}.
67: * @since 1.3.0
68: */
69: public ScratchCodeImpl(KapuaId scopeId) {
70: super(scopeId);
71: }
72:
73: /**
74: * Constructor.
75: *
76: * @param scopeId The scope {@link KapuaId} to set into the {@link ScratchCode}.
77: * @param code The code to set into the {@link ScratchCode}.
78: * @since 1.3.0
79: */
80: public ScratchCodeImpl(KapuaId scopeId, KapuaId mfaOptionId, String code) {
81: super(scopeId);
82:
83: setMfaOptionId(KapuaEid.parseKapuaId(mfaOptionId));
84: setCode(code);
85: }
86:
87: /**
88: * Clone constructor.
89: *
90: * @param scratchCode The {@link ScratchCode} to clone.
91: * @since 1.3.0
92: */
93: public ScratchCodeImpl(ScratchCode scratchCode) {
94: super(scratchCode);
95:
96: setMfaOptionId(scratchCode.getMfaOptionId());
97: setCode(scratchCode.getCode());
98: }
99:
100: @Override
101: public KapuaId getMfaOptionId() {
102: return this.mfaOptionId;
103: }
104:
105: @Override
106: public void setMfaOptionId(KapuaId mfaOptionId) {
107: this.mfaOptionId = KapuaEid.parseKapuaId(mfaOptionId);
108: }
109:
110: @Override
111: public String getCode() {
112: return this.code;
113: }
114:
115: @Override
116: public void setCode(String code) {
117: this.code = code;
118: }
119: }