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

wistefan / tmforum-api / #62

19 Oct 2023 01:12PM UTC coverage: 68.167% (+0.5%) from 67.631%
#62

push

web-flow
Account management api implementation (#34)

* Creating the directories

* Adding pom

* now adding pom, error on last commit

* Account complete implementation, no testing

* Solving problems with git config

* Adding some left out classes and some tests

* Adding FinancialAccount Integration Test and solving some errors on the main classes

* adding Integration Test and solved errors for Party, Bill, Settlement and Financial Account, and BillFormat

* Adding final integration tests and adapting api to query format

* Fixing Event Subscription

* Cleaning the code from comments

---------

Co-authored-by: MVazquez <marcosvazquezcampos@MacBook-Air-de-Marcos.local>

475 of 475 new or added lines in 32 files covered. (100.0%)

3150 of 4621 relevant lines covered (68.17%)

0.68 hits per line

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

26.67
/account/src/main/java/org/fiware/tmforum/account/TMForumMapper.java
1
package org.fiware.tmforum.account;
2

3
import org.fiware.tmforum.common.domain.subscription.Subscription;
4
import org.fiware.tmforum.common.mapping.IdHelper;
5
import org.mapstruct.Mapper;
6
import org.mapstruct.Mapping;
7
import org.fiware.tmforum.common.domain.TimePeriod;
8
import io.github.wistefan.mapping.MappingException;
9
import org.fiware.tmforum.common.mapping.IdHelper;
10
import org.fiware.account.model.*;
11
import org.fiware.tmforum.account.domain.*;
12
import java.net.MalformedURLException;
13
import java.net.URI;
14
import java.net.URL;
15

16
/**
17
 * Mapper between the internal model and api-domain objects
18
 */
19
@Mapper(componentModel = "jsr330", uses = { IdHelper.class, MappingHelper.class })
20
public interface TMForumMapper {
21

22
    //BillFormat
23

24
    @Mapping(target = "id", source = "id")
25
    @Mapping(target = "href", source = "id")
26
    BillFormatVO map(BillFormatCreateVO billFormatCreateVO, URI id);
27

28
    BillFormatVO map(BillFormat billFormat);
29

30
    @Mapping(target = "href", source = "id")
31
    BillFormat map(BillFormatVO billFormatVO);
32

33
    @Mapping(target = "id", source = "id")
34
    @Mapping(target = "href", source = "id")
35
    BillFormatVO map(BillFormatUpdateVO billFormatUpdateVO, String id);
36

37
    //BillingAccount
38

39
    @Mapping(target = "id", source = "id")
40
    @Mapping(target = "href", source = "id")
41
    BillingAccountVO map(BillingAccountCreateVO billingAccountCreateVO, URI id);
42

43
    BillingAccountVO map(BillingAccount billingAccount);
44

45
    @Mapping(target = "href", source = "id")
46
    BillingAccount map(BillingAccountVO billingAccountVO);
47

48
    @Mapping(target = "id", source = "id")
49
    @Mapping(target = "href", source = "id")
50
    BillingAccountVO map(BillingAccountUpdateVO billingAccountUpdateVO, String id);
51

52
    //BillingCycleSpecification
53

54
    @Mapping(target = "id", source = "id")
55
    @Mapping(target = "href", source = "id")
56
    BillingCycleSpecificationVO map(BillingCycleSpecificationCreateVO billingCycleSpecificationCreateVO, URI id);
57

58
    BillingCycleSpecificationVO map(BillingCycleSpecification billingCycleSpecification);
59

60
    @Mapping(target = "href", source = "id")
61
    BillingCycleSpecification map(BillingCycleSpecificationVO billingCycleSpecificationVO);
62

63
    @Mapping(target = "id", source = "id")
64
    @Mapping(target = "href", source = "id")
65
    BillingCycleSpecificationVO map(BillingCycleSpecificationUpdateVO billingCycleSpecificationUpdateVO, String id);
66

67
    //BillPresentationMedia
68

69
    @Mapping(target = "id", source = "id")
70
    @Mapping(target = "href", source = "id")
71
    BillPresentationMediaVO map(BillPresentationMediaCreateVO billPresentationMediaCreateVO, URI id);
72

73
    BillPresentationMediaVO map(BillPresentationMedia billPresentationMedia);
74

75
    @Mapping(target = "href", source = "id")
76
    BillPresentationMedia map(BillPresentationMediaVO billPresentationMediaVO);
77

78
    @Mapping(target = "id", source = "id")
79
    @Mapping(target = "href", source = "id")
80
    BillPresentationMediaVO map(BillPresentationMediaUpdateVO billPresentationMediaUpdateVO, String id);
81

82
    //FinancialAccount
83

84
    @Mapping(target = "id", source = "id")
85
    @Mapping(target = "href", source = "id")
86
    FinancialAccountVO map(FinancialAccountCreateVO financialAccountCreateVO, URI id);
87

88
    FinancialAccountVO map(FinancialAccount financialAccount);
89

90
    @Mapping(target = "href", source = "id")
91
    FinancialAccount map(FinancialAccountVO financialAccountVO);
92

93
    @Mapping(target = "id", source = "id")
94
    @Mapping(target = "href", source = "id")
95
    FinancialAccountVO map(FinancialAccountUpdateVO financialAccountUpdateVO, String id);
96

97
    //PartyAccount
98

99
    @Mapping(target = "id", source = "id")
100
    @Mapping(target = "href", source = "id")
101
    PartyAccountVO map(PartyAccountCreateVO partyAccountCreateVO, URI id);
102

103
    PartyAccountVO map(PartyAccount partyAccount);
104

105
    @Mapping(target = "href", source = "id")
106
    PartyAccount map(PartyAccountVO partyAccountVO);
107

108
    @Mapping(target = "id", source = "id")
109
    @Mapping(target = "href", source = "id")
110
    PartyAccountVO map(PartyAccountUpdateVO partyAccountUpdateVO, String id);
111

112
    //SettlementAccount
113

114
    @Mapping(target = "id", source = "id")
115
    @Mapping(target = "href", source = "id")
116
    SettlementAccountVO map(SettlementAccountCreateVO settlementAccountCreateVO, URI id);
117

118
    SettlementAccountVO map(SettlementAccount settlementAccount);
119

120
    @Mapping(target = "href", source = "id")
121
    SettlementAccount map(SettlementAccountVO settlementAccountVO);
122

123
    @Mapping(target = "id", source = "id")
124
    @Mapping(target = "href", source = "id")
125
    SettlementAccountVO map(SettlementAccountUpdateVO settlementAccountUpdateVO, String id);
126

127
    @Mapping(target = "query", source = "rawQuery")
128
    EventSubscriptionVO map(Subscription subscription);
129

130
    TimePeriod map(TimePeriodVO value);
131

132
    default String map(URL value) {
133
        if (value == null) {
×
134
            return null;
×
135
        }
136
        return value.toString();
×
137
    }
138

139
    default URI mapToURI(String value) {
140
        if (value == null) {
1✔
141
            return null;
×
142
        }
143
        return URI.create(value);
1✔
144
    }
145

146
    default URL mapToURL(String value) {
147
        if (value == null) {
×
148
            return null;
×
149
        }
150
        try {
151
            return new URL(value);
×
152
        } catch (MalformedURLException e) {
×
153
            e.printStackTrace();
×
154
        }
155
        return null;
×
156
    }
157

158
    default String mapFromURI(URI value) {
159
        if (value == null) {
1✔
160
            return null;
×
161
        }
162
        return value.toString();
1✔
163
    }
164

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