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

wistefan / tmforum-api / #154

10 Jul 2025 07:36AM UTC coverage: 29.525%. First build
#154

push

web-flow
Merge ae947a920 into a23e3db6a

389 of 5758 branches covered (6.76%)

Branch coverage included in aggregate %.

37 of 69 new or added lines in 23 files covered. (53.62%)

2627 of 4457 relevant lines covered (58.94%)

0.59 hits per line

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

48.84
/resource-catalog/src/main/java/org/fiware/tmforum/resourcecatalog/TMForumMapper.java
1
package org.fiware.tmforum.resourcecatalog;
2

3
import io.github.wistefan.mapping.MappingException;
4
import org.fiware.resourcecatalog.model.*;
5
import org.fiware.tmforum.common.domain.Money;
6
import org.fiware.tmforum.common.domain.subscription.TMForumSubscription;
7
import org.fiware.tmforum.common.mapping.BaseMapper;
8
import org.fiware.tmforum.common.mapping.IdHelper;
9
import org.fiware.tmforum.resource.*;
10
import org.fiware.tmforum.resourcecatalog.domain.ResourceCatalog;
11
import org.mapstruct.Mapper;
12
import org.mapstruct.Mapping;
13

14
import java.net.MalformedURLException;
15
import java.net.URI;
16
import java.net.URL;
17

18
/**
19
 * Mapper between the internal model and api-domain objects
20
 */
21
@Mapper(componentModel = "jsr330", uses = IdHelper.class)
22
public abstract class TMForumMapper extends BaseMapper {
1✔
23

24
        // resource catalog
25

26
        @Mapping(target = "id", source = "id")
27
        @Mapping(target = "href", source = "id")
28
        public abstract ResourceCatalogVO map(ResourceCatalogCreateVO resourceCatalogCreateVO, URI id);
29

30
        public abstract ResourceCatalogVO map(ResourceCatalog resourceCatalog);
31

32
        public abstract ResourceCatalog map(ResourceCatalogVO resourceCatalogVO);
33

34
        @Mapping(target = "id", source = "id")
35
        public abstract ResourceCatalog map(ResourceCatalogUpdateVO resourceCatalogUpdateVO, String id);
36

37
        // resource specification
38

39
        @Mapping(target = "id", source = "id")
40
        @Mapping(target = "href", source = "id")
41
        public abstract ResourceSpecificationVO map(ResourceSpecificationCreateVO resourceSpecificationCreateVO, URI id);
42

43
        public abstract ResourceSpecificationVO map(ResourceSpecification resourceSpecification);
44

45
        public abstract ResourceSpecification map(ResourceSpecificationVO resourceCandidateVO);
46

47
        @Mapping(target = "id", source = "id")
48
        public abstract ResourceSpecification map(ResourceSpecificationUpdateVO resourceSpecificationUpdateVO, String id);
49

50
        // resource catalog
51

52
        @Mapping(target = "id", source = "id")
53
        @Mapping(target = "href", source = "id")
54
        public abstract ResourceCandidateVO map(ResourceCandidateCreateVO resourceCandidateCreateVO, URI id);
55

56
        public abstract ResourceCandidateVO map(ResourceCandidate resourceCandidate);
57

58
        public abstract ResourceCandidate map(ResourceCandidateVO resourceCandidateVO);
59

60
        @Mapping(target = "id", source = "id")
61
        public abstract ResourceCandidate map(ResourceCandidateUpdateVO resourceCandidateUpdateVO, String id);
62

63
        // resource catalog
64

65
        @Mapping(target = "id", source = "id")
66
        @Mapping(target = "href", source = "id")
67
        public abstract ResourceCategoryVO map(ResourceCategoryCreateVO resourceCategoryCreateVO, URI id);
68

69
        public abstract ResourceCategoryVO map(ResourceCategory resourceCategory);
70

71
        public abstract ResourceCategory map(ResourceCategoryVO resourceCategoryVO);
72

73
        @Mapping(target = "id", source = "id")
74
        public abstract ResourceCategory map(ResourceCategoryUpdateVO resourceCategoryUpdateVO, String id);
75

76
        @Mapping(target = "query", source = "rawQuery")
77
        public abstract EventSubscriptionVO map(TMForumSubscription subscription);
78

79
        @Mapping(target = "tmfId", source = "id")
80
        public abstract FeatureSpecification map(FeatureSpecificationVO featureSpecificationVO);
81

82
        @Mapping(target = "id", source = "tmfId")
83
        public abstract FeatureSpecificationVO map(FeatureSpecification featureSpecification);
84

85
        @Mapping(target = "tmfId", source = "id")
86
        public abstract FeatureSpecificationCharacteristic map(FeatureSpecificationCharacteristicVO featureSpecificationVO);
87

88
        @Mapping(target = "id", source = "tmfId")
89
        public abstract FeatureSpecificationCharacteristicVO map(FeatureSpecificationCharacteristic featureSpecification);
90

91
        @Mapping(target = "tmfId", source = "id")
92
        public abstract FeatureSpecificationCharacteristicRelationship map(FeatureSpecificationCharacteristicRelationshipVO featureSpecificationVO);
93

94
        @Mapping(target = "id", source = "tmfId")
95
        public abstract FeatureSpecificationCharacteristicRelationshipVO map(FeatureSpecificationCharacteristicRelationship featureSpecification);
96

97
        @Mapping(target = "tmfId", source = "id")
98
        public abstract FeatureSpecificationRelationship map(FeatureSpecificationRelationshipVO featureSpecificationVO);
99

100
        @Mapping(target = "id", source = "tmfId")
101
        public abstract FeatureSpecificationRelationshipVO map(FeatureSpecificationRelationship featureSpecification);
102

103
        @Mapping(target = "tmfValue", source = "value")
104
        public abstract CharacteristicValue map(CharacteristicValueSpecificationVO characteristicVO);
105

106
        @Mapping(target = "value", source = "tmfValue")
107
        public abstract CharacteristicValueSpecificationVO map(CharacteristicValue characteristic);
108

109
        public URL map(String value) {
NEW
110
                if (value == null) {
×
NEW
111
                        return null;
×
112
                }
113
                try {
NEW
114
                        return new URL(value);
×
NEW
115
                } catch (MalformedURLException e) {
×
NEW
116
                        throw new MappingException(String.format("%s is not a URL.", value), e);
×
117
                }
118
        }
119

120
        public String map(URL value) {
NEW
121
                if (value == null) {
×
NEW
122
                        return null;
×
123
                }
NEW
124
                return value.toString();
×
125
        }
126

127
        public URI mapToURI(String value) {
128
                if (value == null) {
1!
NEW
129
                        return null;
×
130
                }
131
                return URI.create(value);
1✔
132
        }
133

134
        public String mapFromURI(URI value) {
135
                if (value == null) {
1!
NEW
136
                        return null;
×
137
                }
138
                return value.toString();
1✔
139
        }
140

141
        public ResourceSpecificationRef mapFromResourceSpecId(String id) {
142
                if (id == null) {
1!
143
                        return null;
1✔
144
                }
NEW
145
                return new ResourceSpecificationRef(id);
×
146
        }
147

148
        public ResourceCategoryRef mapFromCategoryId(String id) {
149
                if (id == null) {
1✔
150
                        return null;
1✔
151
                }
152
                return new ResourceCategoryRef(URI.create(id));
1✔
153
        }
154

155
        public String mapFromCategoryRef(ResourceCategoryRef categoryRef) {
156
                if (categoryRef == null) {
1!
157
                        return null;
1✔
158
                }
NEW
159
                return categoryRef.getEntityId().toString();
×
160
        }
161

162
        public String mapFromResourceSpecificationRef(ResourceSpecificationRef resourceSpecificationRef) {
163
                if (resourceSpecificationRef == null) {
1!
164
                        return null;
1✔
165
                }
NEW
166
                return resourceSpecificationRef.getEntityId().toString();
×
167
        }
168
}
169

170

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

© 2026 Coveralls, Inc