Clover icon

sunshower-base

  1. Project Clover database Fri Apr 6 2018 03:41:27 UTC
  2. Package io.sunshower.persistence.core

File DistributableHierarchicalEntity.java

 

Coverage histogram

../../../../img/srcFileCovDistChart0.png
50% of files have more coverage

Code metrics

4
7
6
1
55
46
8
1.14
1.17
6
1.33

Classes

Class Line # Actions
DistributableHierarchicalEntity 16 7 8
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package io.sunshower.persistence.core;
2   
3    import io.sunshower.common.Identifier;
4    import javax.persistence.Column;
5    import javax.persistence.Id;
6    import javax.persistence.IdClass;
7    import javax.persistence.MappedSuperclass;
8    import javax.xml.bind.annotation.XmlAttribute;
9    import javax.xml.bind.annotation.XmlRootElement;
10    import org.hibernate.search.annotations.DocumentId;
11    import org.hibernate.search.annotations.FieldBridge;
12   
13    @MappedSuperclass
14    @IdClass(Identifier.class)
15    @XmlRootElement(name = "hierarchical-entity")
 
16    public abstract class DistributableHierarchicalEntity<T extends Hierarchical<Identifier, T>>
17    extends HierarchichalEntity<Identifier, T> {
18   
19    @Id
20    @DocumentId
21    @Column(name = "id")
22    @XmlAttribute(name = "id")
23    @FieldBridge(impl = ByteArrayBridge.class)
24    private byte[] id;
25   
 
26  0 toggle protected DistributableHierarchicalEntity(Identifier id) {
27  0 super(id);
28    }
29   
 
30  0 toggle protected DistributableHierarchicalEntity() {
31  0 this(DistributableEntity.sequence.next());
32    }
33   
 
34  0 toggle @Override
35    public Identifier getIdentifier() {
36  0 return getId();
37    }
38   
 
39  0 toggle @Override
40    public Identifier getId() {
41  0 return id == null ? null : Identifier.valueOf(id);
42    }
43   
 
44  0 toggle @Override
45    public void setId(Identifier id) {
46  0 if (id != null) {
47  0 this.id = id.value();
48    }
49    }
50   
 
51  0 toggle @Override
52    public String toString() {
53  0 return getClass().getSimpleName() + "{" + "id=" + id + '}';
54    }
55    }