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

wistefan / tmforum-api / #49

29 Sep 2023 06:20AM UTC coverage: 67.488% (-4.3%) from 71.815%
#49

push

web-flow
Notifications (#23)

* Squashed commits

* Added cache invalidation for entity deletion

* Updated error message

618 of 618 new or added lines in 86 files covered. (100.0%)

2794 of 4140 relevant lines covered (67.49%)

0.67 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 io.github.wistefan.mapping.annotations.AttributeGetter;
4
import io.github.wistefan.mapping.annotations.AttributeSetter;
5
import io.github.wistefan.mapping.annotations.AttributeType;
6
import io.github.wistefan.mapping.annotations.DatasetId;
7
import io.github.wistefan.mapping.annotations.EntityId;
8
import io.github.wistefan.mapping.annotations.EntityType;
9
import io.github.wistefan.mapping.annotations.Ignore;
10
import io.github.wistefan.mapping.annotations.RelationshipObject;
11
import lombok.Getter;
12
import lombok.Setter;
13
import org.fiware.tmforum.common.mapping.IdHelper;
14
import javax.annotation.Nullable;
15
import java.net.URI;
16

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

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

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

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

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

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

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

69
        public String getEntityState() {
70
                return "default";
×
71
        }
72

73
}
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