• 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

47.83
/product-catalog/src/main/java/org/fiware/tmforum/productcatalog/TMForumMapper.java
1
package org.fiware.tmforum.productcatalog;
2

3
import io.github.wistefan.mapping.MappingException;
4
import org.fiware.productcatalog.model.*;
5
import org.fiware.tmforum.common.domain.Money;
6
import org.fiware.tmforum.common.domain.TaxItem;
7
import org.fiware.tmforum.common.domain.subscription.TMForumSubscription;
8
import org.fiware.tmforum.common.mapping.BaseMapper;
9
import org.fiware.tmforum.common.mapping.IdHelper;
10
import org.fiware.tmforum.product.*;
11
import org.fiware.tmforum.productcatalog.domain.Catalog;
12
import org.fiware.tmforum.service.CharacteristicValueSpecification;
13
import org.mapstruct.Mapper;
14
import org.mapstruct.Mapping;
15

16
import java.net.MalformedURLException;
17
import java.net.URI;
18
import java.net.URL;
19

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

26
        // catalog
27

28
        @Mapping(target = "id", source = "id")
29
        @Mapping(target = "href", source = "id")
30
        public abstract CatalogVO map(CatalogCreateVO catalogCreateVO, URI id);
31

32
        public abstract CatalogVO map(Catalog catalog);
33

34
        @Mapping(target = "href", source = "id")
35
        public abstract Catalog map(CatalogVO catalogVO);
36

37
        @Mapping(target = "id", source = "id")
38
        @Mapping(target = "href", source = "id")
39
        public abstract CatalogVO map(CatalogUpdateVO catalogUpdateVO, String id);
40

41
        // category
42

43
        @Mapping(target = "id", source = "id")
44
        @Mapping(target = "href", source = "id")
45
        public abstract CategoryVO map(CategoryCreateVO categoryCreateVO, URI id);
46

47
        @Mapping(target = "parentId", qualifiedByName = "fromCategoryRef")
48
        public abstract CategoryVO map(Category category);
49

50
        @Mapping(target = "href", source = "id")
51
        @Mapping(target = "parentId", source = "categoryVO.parentId", qualifiedByName = "toCategoryRef")
52
        public abstract Category map(CategoryVO categoryVO);
53

54
        @Mapping(target = "id", source = "id")
55
        @Mapping(target = "href", source = "id")
56
        public abstract CategoryVO map(CategoryUpdateVO categoryUpdateVO, String id);
57

58
        // product offering
59

60
        @Mapping(target = "id", source = "id")
61
        @Mapping(target = "href", source = "id")
62
        public abstract ProductOfferingVO map(ProductOfferingCreateVO productOfferingCreateVO, URI id);
63

64
        public abstract ProductOfferingVO map(ProductOffering productOfferingVO);
65

66
        @Mapping(target = "href", source = "id")
67
        public abstract ProductOffering map(ProductOfferingVO productOfferingVO);
68

69
        @Mapping(target = "id", source = "id")
70
        @Mapping(target = "href", source = "id")
71
        public abstract ProductOfferingVO map(ProductOfferingUpdateVO productOfferingUpdateVO, String id);
72

73
        // product offering price
74

75
        @Mapping(target = "id", source = "id")
76
        @Mapping(target = "href", source = "id")
77
        public abstract ProductOfferingPriceVO map(ProductOfferingPriceCreateVO productOfferingPriceCreateVO, URI id);
78

79
        public abstract ProductOfferingPriceVO map(ProductOfferingPrice productOfferingPrice);
80

81
        @Mapping(target = "href", source = "id")
82
        public abstract ProductOfferingPrice map(ProductOfferingPriceVO productOfferingPriceVO);
83

84
        @Mapping(target = "id", source = "id")
85
        @Mapping(target = "href", source = "id")
86
        public abstract ProductOfferingPriceVO map(ProductOfferingPriceUpdateVO productOfferingPriceUpdateVO, String id);
87

88
        // product specification
89

90
        @Mapping(target = "id", source = "id")
91
        @Mapping(target = "href", source = "id")
92
        public abstract ProductSpecificationVO map(ProductSpecificationCreateVO productSpecificationCreateVO, URI id);
93

94
        public abstract ProductSpecificationVO map(ProductSpecification productSpecification);
95

96
        @Mapping(target = "href", source = "id")
97
        public abstract ProductSpecification map(ProductSpecificationVO productSpecificationVO);
98

99
        @Mapping(target = "id", source = "id")
100
        @Mapping(target = "href", source = "id")
101
        public abstract ProductSpecificationVO map(ProductSpecificationUpdateVO productSpecificationUpdateVO, String id);
102

103
        @Mapping(target = "query", source = "rawQuery")
104
        public abstract EventSubscriptionVO map(TMForumSubscription subscription);
105

106
        @Mapping(target = "tmfValue", source = "value")
107
        public abstract Money map(MoneyVO moneyVO);
108

109
        @Mapping(target = "value", source = "tmfValue")
110
        public abstract MoneyVO map(Money money);
111

112
        @Mapping(target = "tmfId", source = "id")
113
        public abstract PricingLogicAlgorithm map(PricingLogicAlgorithmVO pricingLogicAlgorithmVO);
114

115
        @Mapping(target = "id", source = "tmfId")
116
        public abstract PricingLogicAlgorithmVO map(PricingLogicAlgorithm pricingLogicAlgorithm);
117

118
        @Mapping(target = "tmfId", source = "id")
119
        public abstract TaxItem map(TaxItemVO taxItemVO);
120

121
        @Mapping(target = "id", source = "tmfId")
122
        public abstract TaxItemVO map(TaxItem taxItem);
123

124
        @Mapping(target = "tmfId", source = "id")
125
        public abstract ProductSpecificationCharacteristic map(ProductSpecificationCharacteristicVO productSpecificationCharacteristicVO);
126

127
        @Mapping(target = "id", source = "tmfId")
128
        public abstract ProductSpecificationCharacteristicVO map(ProductSpecificationCharacteristic productSpecificationCharacteristic);
129

130
        @Mapping(target = "tmfValue", source = "value")
131
        public abstract CharacteristicValueSpecification map(CharacteristicValueSpecificationVO characteristicVO);
132

133
        @Mapping(target = "value", source = "tmfValue")
134
        public abstract CharacteristicValueSpecificationVO map(CharacteristicValueSpecification characteristic);
135

136
        @Mapping(target = "tmfId", source = "id")
137
        public abstract ProductSpecificationCharacteristicValueUse map(ProductSpecificationCharacteristicValueUseVO characteristicVO);
138

139
        @Mapping(target = "id", source = "tmfId")
140
        public abstract ProductSpecificationCharacteristicValueUseVO map(ProductSpecificationCharacteristicValueUse characteristic);
141

142
        @Mapping(target = "tmfId", source = "id")
143
        public abstract ProductSpecificationCharacteristicRelationship map(ProductSpecificationCharacteristicRelationshipVO characteristicVO);
144

145
        @Mapping(target = "id", source = "tmfId")
146
        public abstract ProductSpecificationCharacteristicRelationshipVO map(ProductSpecificationCharacteristicRelationship characteristic);
147
        
148
        public URL map(String value) {
NEW
149
                if (value == null) {
×
NEW
150
                        return null;
×
151
                }
152
                try {
NEW
153
                        return new URL(value);
×
NEW
154
                } catch (MalformedURLException e) {
×
NEW
155
                        throw new MappingException(String.format("%s is not a URL.", value), e);
×
156
                }
157
        }
158

159
        public String map(URL value) {
NEW
160
                if (value == null) {
×
NEW
161
                        return null;
×
162
                }
NEW
163
                return value.toString();
×
164
        }
165

166
        public URI mapToURI(String value) {
167
                if (value == null) {
1✔
168
                        return null;
1✔
169
                }
170
                return URI.create(value);
1✔
171
        }
172

173
        public String mapFromURI(URI value) {
174
                if (value == null) {
1✔
175
                        return null;
1✔
176
                }
177
                return value.toString();
1✔
178
        }
179
}
180

181

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