• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wistefan / tmforum-api / #68

24 Oct 2023 01:20PM UTC coverage: 67.773% (-0.4%) from 68.167%
#68

push

web-flow
Make dome working (#37)

* set defaults

* update mapping dep

* add redis as option

3287 of 4850 relevant lines covered (67.77%)

0.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/common/src/main/java/org/fiware/tmforum/common/domain/EntityWithId.java
1
package org.fiware.tmforum.common.domain;
2

3
import com.fasterxml.jackson.annotation.JsonIgnore;
4
import io.github.wistefan.mapping.annotations.AttributeGetter;
5
import io.github.wistefan.mapping.annotations.AttributeSetter;
6
import io.github.wistefan.mapping.annotations.AttributeType;
7
import io.github.wistefan.mapping.annotations.DatasetId;
8
import io.github.wistefan.mapping.annotations.EntityId;
9
import io.github.wistefan.mapping.annotations.EntityType;
10
import io.github.wistefan.mapping.annotations.Ignore;
11
import io.github.wistefan.mapping.annotations.RelationshipObject;
12
import lombok.Getter;
13
import lombok.Setter;
14
import org.fiware.tmforum.common.mapping.IdHelper;
15
import javax.annotation.Nullable;
16
import java.net.URI;
17

18
/**
19
 * Abstract superclass for all entities with an id
20
 */
21
public abstract class EntityWithId {
22

23
        /**
24
         * Type of the entity
25
         */
26
        @Getter(onMethod = @__({ @EntityType })) final String type;
×
27

28
        /**
29
         * Id of the entity. This is the id part of "urn:ngsi-ld:TYPE:ID"
30
         */
31
        @Ignore
32
        @Getter(onMethod = @__({ @EntityId, @RelationshipObject, @DatasetId }))
×
33
        @Setter
×
34
        URI id;
35

36
        protected EntityWithId(String type, String id) {
×
37
                this.type = type;
×
38
                if (IdHelper.isNgsiLdId(id)) {
×
39
                        this.id = URI.create(id);
×
40
                } else {
41
                        this.id = IdHelper.toNgsiLd(id, type);
×
42
                }
43
        }
×
44

45
        /**
46
         * When sub-classing, this defines the super-class
47
         */
48
        @Getter(onMethod = @__({ @AttributeGetter(value = AttributeType.PROPERTY, targetName = "atBaseType") }))
×
49
        @Setter(onMethod = @__({ @AttributeSetter(value = AttributeType.PROPERTY, targetName = "atBaseType") }))
×
50
        @Nullable
51
        String atBaseType;
52

53
        /**
54
         * A URI to a JSON-Schema file that defines additional attributes and relationships
55
         */
56
        @Getter(onMethod = @__({ @AttributeGetter(value = AttributeType.PROPERTY, targetName = "atSchemaLocation") }))
×
57
        @Setter(onMethod = @__({ @AttributeSetter(value = AttributeType.PROPERTY, targetName = "atSchemaLocation") }))
×
58
        @Nullable
59
        URI atSchemaLocation;
60

61
        /**
62
         * When sub-classing, this defines the sub-class entity name.
63
         * We cannot use @type, since it clashes with the ngsi-ld type field(e.g. reserved name)
64
         */
65
        @Getter(onMethod = @__({ @AttributeGetter(value = AttributeType.PROPERTY, targetName = "tmForumType") }))
×
66
        @Setter(onMethod = @__({ @AttributeSetter(value = AttributeType.PROPERTY, targetName = "tmForumType") }))
×
67
        @Nullable
68
        String atType;
69

70
        @JsonIgnore
71
        public String getEntityState() {
72
                return "default";
×
73
        }
74

75
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc