StakeKeyReportMapperImpl.java

1
package org.cardanofoundation.explorer.api.mapper;
2
3
import java.sql.Timestamp;
4
import java.time.Instant;
5
import java.time.LocalDateTime;
6
import java.time.ZoneOffset;
7
import javax.annotation.processing.Generated;
8
import org.cardanofoundation.explorer.api.model.request.stake.report.StakeKeyReportRequest;
9
import org.cardanofoundation.explorer.api.model.response.stake.report.StakeKeyReportHistoryResponse;
10
import org.cardanofoundation.explorer.common.entity.enumeration.ReportStatus;
11
import org.cardanofoundation.explorer.common.entity.enumeration.ReportType;
12
import org.cardanofoundation.explorer.common.entity.explorer.ReportHistory;
13
import org.cardanofoundation.explorer.common.entity.explorer.StakeKeyReportHistory;
14
import org.springframework.stereotype.Component;
15
16
@Generated(
17
    value = "org.mapstruct.ap.MappingProcessor",
18
    date = "2024-11-05T06:00:27+0000",
19
    comments = "version: 1.5.3.Final, compiler: javac, environment: Java 18.0.2.1 (Eclipse Adoptium)"
20
)
21
@Component
22
public class StakeKeyReportMapperImpl implements StakeKeyReportMapper {
23
24
    @Override
25
    public StakeKeyReportHistoryResponse toStakeKeyReportHistoryResponse(StakeKeyReportHistory stakeKeyReportHistory) {
26 1 1. toStakeKeyReportHistoryResponse : negated conditional → NO_COVERAGE
        if ( stakeKeyReportHistory == null ) {
27
            return null;
28
        }
29
30
        StakeKeyReportHistoryResponse.StakeKeyReportHistoryResponseBuilder stakeKeyReportHistoryResponse = StakeKeyReportHistoryResponse.builder();
31
32
        stakeKeyReportHistoryResponse.username( stakeKeyReportHistoryReportHistoryUsername( stakeKeyReportHistory ) );
33
        stakeKeyReportHistoryResponse.reportName( stakeKeyReportHistoryReportHistoryReportName( stakeKeyReportHistory ) );
34
        stakeKeyReportHistoryResponse.status( stakeKeyReportHistoryReportHistoryStatus( stakeKeyReportHistory ) );
35
        stakeKeyReportHistoryResponse.type( stakeKeyReportHistoryReportHistoryType( stakeKeyReportHistory ) );
36
        stakeKeyReportHistoryResponse.createdAt( stakeKeyReportHistoryReportHistoryCreatedAt( stakeKeyReportHistory ) );
37
        stakeKeyReportHistoryResponse.id( stakeKeyReportHistory.getId() );
38
        stakeKeyReportHistoryResponse.stakeKey( stakeKeyReportHistory.getStakeKey() );
39
        stakeKeyReportHistoryResponse.fromDate( stakeKeyReportHistory.getFromDate() );
40
        stakeKeyReportHistoryResponse.toDate( stakeKeyReportHistory.getToDate() );
41
        stakeKeyReportHistoryResponse.isADATransfer( stakeKeyReportHistory.getIsADATransfer() );
42
        stakeKeyReportHistoryResponse.isFeesPaid( stakeKeyReportHistory.getIsFeesPaid() );
43
        stakeKeyReportHistoryResponse.eventRegistration( stakeKeyReportHistory.getEventRegistration() );
44
        stakeKeyReportHistoryResponse.eventDelegation( stakeKeyReportHistory.getEventDelegation() );
45
        stakeKeyReportHistoryResponse.eventRewards( stakeKeyReportHistory.getEventRewards() );
46
        stakeKeyReportHistoryResponse.eventWithdrawal( stakeKeyReportHistory.getEventWithdrawal() );
47
        stakeKeyReportHistoryResponse.eventDeregistration( stakeKeyReportHistory.getEventDeregistration() );
48
49 1 1. toStakeKeyReportHistoryResponse : replaced return value with null for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::toStakeKeyReportHistoryResponse → NO_COVERAGE
        return stakeKeyReportHistoryResponse.build();
50
    }
51
52
    @Override
53
    public StakeKeyReportHistory toStakeKeyReportHistory(StakeKeyReportRequest stakeKeyReportRequest) {
54 1 1. toStakeKeyReportHistory : negated conditional → NO_COVERAGE
        if ( stakeKeyReportRequest == null ) {
55
            return null;
56
        }
57
58
        StakeKeyReportHistory.StakeKeyReportHistoryBuilder<?, ?> stakeKeyReportHistory = StakeKeyReportHistory.builder();
59
60
        stakeKeyReportHistory.reportHistory( stakeKeyReportRequestToReportHistory( stakeKeyReportRequest ) );
61
        stakeKeyReportHistory.stakeKey( stakeKeyReportRequest.getStakeKey() );
62
        stakeKeyReportHistory.fromDate( stakeKeyReportRequest.getFromDate() );
63
        stakeKeyReportHistory.toDate( stakeKeyReportRequest.getToDate() );
64
        stakeKeyReportHistory.isADATransfer( stakeKeyReportRequest.getIsADATransfer() );
65
        stakeKeyReportHistory.isFeesPaid( stakeKeyReportRequest.getIsFeesPaid() );
66
        stakeKeyReportHistory.eventRegistration( stakeKeyReportRequest.getEventRegistration() );
67
        stakeKeyReportHistory.eventDelegation( stakeKeyReportRequest.getEventDelegation() );
68
        stakeKeyReportHistory.eventRewards( stakeKeyReportRequest.getEventRewards() );
69
        stakeKeyReportHistory.eventWithdrawal( stakeKeyReportRequest.getEventWithdrawal() );
70
        stakeKeyReportHistory.eventDeregistration( stakeKeyReportRequest.getEventDeregistration() );
71
72 1 1. toStakeKeyReportHistory : replaced return value with null for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::toStakeKeyReportHistory → NO_COVERAGE
        return stakeKeyReportHistory.build();
73
    }
74
75
    private String stakeKeyReportHistoryReportHistoryUsername(StakeKeyReportHistory stakeKeyReportHistory) {
76 1 1. stakeKeyReportHistoryReportHistoryUsername : negated conditional → NO_COVERAGE
        if ( stakeKeyReportHistory == null ) {
77 1 1. stakeKeyReportHistoryReportHistoryUsername : replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryUsername → NO_COVERAGE
            return null;
78
        }
79
        ReportHistory reportHistory = stakeKeyReportHistory.getReportHistory();
80 1 1. stakeKeyReportHistoryReportHistoryUsername : negated conditional → NO_COVERAGE
        if ( reportHistory == null ) {
81 1 1. stakeKeyReportHistoryReportHistoryUsername : replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryUsername → NO_COVERAGE
            return null;
82
        }
83
        String username = reportHistory.getUsername();
84 1 1. stakeKeyReportHistoryReportHistoryUsername : negated conditional → NO_COVERAGE
        if ( username == null ) {
85 1 1. stakeKeyReportHistoryReportHistoryUsername : replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryUsername → NO_COVERAGE
            return null;
86
        }
87 1 1. stakeKeyReportHistoryReportHistoryUsername : replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryUsername → NO_COVERAGE
        return username;
88
    }
89
90
    private String stakeKeyReportHistoryReportHistoryReportName(StakeKeyReportHistory stakeKeyReportHistory) {
91 1 1. stakeKeyReportHistoryReportHistoryReportName : negated conditional → NO_COVERAGE
        if ( stakeKeyReportHistory == null ) {
92 1 1. stakeKeyReportHistoryReportHistoryReportName : replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryReportName → NO_COVERAGE
            return null;
93
        }
94
        ReportHistory reportHistory = stakeKeyReportHistory.getReportHistory();
95 1 1. stakeKeyReportHistoryReportHistoryReportName : negated conditional → NO_COVERAGE
        if ( reportHistory == null ) {
96 1 1. stakeKeyReportHistoryReportHistoryReportName : replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryReportName → NO_COVERAGE
            return null;
97
        }
98
        String reportName = reportHistory.getReportName();
99 1 1. stakeKeyReportHistoryReportHistoryReportName : negated conditional → NO_COVERAGE
        if ( reportName == null ) {
100 1 1. stakeKeyReportHistoryReportHistoryReportName : replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryReportName → NO_COVERAGE
            return null;
101
        }
102 1 1. stakeKeyReportHistoryReportHistoryReportName : replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryReportName → NO_COVERAGE
        return reportName;
103
    }
104
105
    private ReportStatus stakeKeyReportHistoryReportHistoryStatus(StakeKeyReportHistory stakeKeyReportHistory) {
106 1 1. stakeKeyReportHistoryReportHistoryStatus : negated conditional → NO_COVERAGE
        if ( stakeKeyReportHistory == null ) {
107
            return null;
108
        }
109
        ReportHistory reportHistory = stakeKeyReportHistory.getReportHistory();
110 1 1. stakeKeyReportHistoryReportHistoryStatus : negated conditional → NO_COVERAGE
        if ( reportHistory == null ) {
111
            return null;
112
        }
113
        ReportStatus status = reportHistory.getStatus();
114 1 1. stakeKeyReportHistoryReportHistoryStatus : negated conditional → NO_COVERAGE
        if ( status == null ) {
115
            return null;
116
        }
117 1 1. stakeKeyReportHistoryReportHistoryStatus : replaced return value with null for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryStatus → NO_COVERAGE
        return status;
118
    }
119
120
    private ReportType stakeKeyReportHistoryReportHistoryType(StakeKeyReportHistory stakeKeyReportHistory) {
121 1 1. stakeKeyReportHistoryReportHistoryType : negated conditional → NO_COVERAGE
        if ( stakeKeyReportHistory == null ) {
122
            return null;
123
        }
124
        ReportHistory reportHistory = stakeKeyReportHistory.getReportHistory();
125 1 1. stakeKeyReportHistoryReportHistoryType : negated conditional → NO_COVERAGE
        if ( reportHistory == null ) {
126
            return null;
127
        }
128
        ReportType type = reportHistory.getType();
129 1 1. stakeKeyReportHistoryReportHistoryType : negated conditional → NO_COVERAGE
        if ( type == null ) {
130
            return null;
131
        }
132 1 1. stakeKeyReportHistoryReportHistoryType : replaced return value with null for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryType → NO_COVERAGE
        return type;
133
    }
134
135
    private Timestamp stakeKeyReportHistoryReportHistoryCreatedAt(StakeKeyReportHistory stakeKeyReportHistory) {
136 1 1. stakeKeyReportHistoryReportHistoryCreatedAt : negated conditional → NO_COVERAGE
        if ( stakeKeyReportHistory == null ) {
137
            return null;
138
        }
139
        ReportHistory reportHistory = stakeKeyReportHistory.getReportHistory();
140 1 1. stakeKeyReportHistoryReportHistoryCreatedAt : negated conditional → NO_COVERAGE
        if ( reportHistory == null ) {
141
            return null;
142
        }
143
        Timestamp createdAt = reportHistory.getCreatedAt();
144 1 1. stakeKeyReportHistoryReportHistoryCreatedAt : negated conditional → NO_COVERAGE
        if ( createdAt == null ) {
145
            return null;
146
        }
147 1 1. stakeKeyReportHistoryReportHistoryCreatedAt : replaced return value with null for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryCreatedAt → NO_COVERAGE
        return createdAt;
148
    }
149
150
    protected ReportHistory stakeKeyReportRequestToReportHistory(StakeKeyReportRequest stakeKeyReportRequest) {
151 1 1. stakeKeyReportRequestToReportHistory : negated conditional → NO_COVERAGE
        if ( stakeKeyReportRequest == null ) {
152
            return null;
153
        }
154
155
        ReportHistory.ReportHistoryBuilder<?, ?> reportHistory = ReportHistory.builder();
156
157
        reportHistory.reportName( stakeKeyReportRequest.getReportName() );
158
159
        reportHistory.createdAt( Timestamp.valueOf(LocalDateTime.ofInstant(Instant.now(), ZoneOffset.UTC)) );
160
161 1 1. stakeKeyReportRequestToReportHistory : replaced return value with null for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportRequestToReportHistory → NO_COVERAGE
        return reportHistory.build();
162
    }
163
}

Mutations

26

1.1
Location : toStakeKeyReportHistoryResponse
Killed by : none
negated conditional → NO_COVERAGE

49

1.1
Location : toStakeKeyReportHistoryResponse
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::toStakeKeyReportHistoryResponse → NO_COVERAGE

54

1.1
Location : toStakeKeyReportHistory
Killed by : none
negated conditional → NO_COVERAGE

72

1.1
Location : toStakeKeyReportHistory
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::toStakeKeyReportHistory → NO_COVERAGE

76

1.1
Location : stakeKeyReportHistoryReportHistoryUsername
Killed by : none
negated conditional → NO_COVERAGE

77

1.1
Location : stakeKeyReportHistoryReportHistoryUsername
Killed by : none
replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryUsername → NO_COVERAGE

80

1.1
Location : stakeKeyReportHistoryReportHistoryUsername
Killed by : none
negated conditional → NO_COVERAGE

81

1.1
Location : stakeKeyReportHistoryReportHistoryUsername
Killed by : none
replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryUsername → NO_COVERAGE

84

1.1
Location : stakeKeyReportHistoryReportHistoryUsername
Killed by : none
negated conditional → NO_COVERAGE

85

1.1
Location : stakeKeyReportHistoryReportHistoryUsername
Killed by : none
replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryUsername → NO_COVERAGE

87

1.1
Location : stakeKeyReportHistoryReportHistoryUsername
Killed by : none
replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryUsername → NO_COVERAGE

91

1.1
Location : stakeKeyReportHistoryReportHistoryReportName
Killed by : none
negated conditional → NO_COVERAGE

92

1.1
Location : stakeKeyReportHistoryReportHistoryReportName
Killed by : none
replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryReportName → NO_COVERAGE

95

1.1
Location : stakeKeyReportHistoryReportHistoryReportName
Killed by : none
negated conditional → NO_COVERAGE

96

1.1
Location : stakeKeyReportHistoryReportHistoryReportName
Killed by : none
replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryReportName → NO_COVERAGE

99

1.1
Location : stakeKeyReportHistoryReportHistoryReportName
Killed by : none
negated conditional → NO_COVERAGE

100

1.1
Location : stakeKeyReportHistoryReportHistoryReportName
Killed by : none
replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryReportName → NO_COVERAGE

102

1.1
Location : stakeKeyReportHistoryReportHistoryReportName
Killed by : none
replaced return value with "" for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryReportName → NO_COVERAGE

106

1.1
Location : stakeKeyReportHistoryReportHistoryStatus
Killed by : none
negated conditional → NO_COVERAGE

110

1.1
Location : stakeKeyReportHistoryReportHistoryStatus
Killed by : none
negated conditional → NO_COVERAGE

114

1.1
Location : stakeKeyReportHistoryReportHistoryStatus
Killed by : none
negated conditional → NO_COVERAGE

117

1.1
Location : stakeKeyReportHistoryReportHistoryStatus
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryStatus → NO_COVERAGE

121

1.1
Location : stakeKeyReportHistoryReportHistoryType
Killed by : none
negated conditional → NO_COVERAGE

125

1.1
Location : stakeKeyReportHistoryReportHistoryType
Killed by : none
negated conditional → NO_COVERAGE

129

1.1
Location : stakeKeyReportHistoryReportHistoryType
Killed by : none
negated conditional → NO_COVERAGE

132

1.1
Location : stakeKeyReportHistoryReportHistoryType
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryType → NO_COVERAGE

136

1.1
Location : stakeKeyReportHistoryReportHistoryCreatedAt
Killed by : none
negated conditional → NO_COVERAGE

140

1.1
Location : stakeKeyReportHistoryReportHistoryCreatedAt
Killed by : none
negated conditional → NO_COVERAGE

144

1.1
Location : stakeKeyReportHistoryReportHistoryCreatedAt
Killed by : none
negated conditional → NO_COVERAGE

147

1.1
Location : stakeKeyReportHistoryReportHistoryCreatedAt
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportHistoryReportHistoryCreatedAt → NO_COVERAGE

151

1.1
Location : stakeKeyReportRequestToReportHistory
Killed by : none
negated conditional → NO_COVERAGE

161

1.1
Location : stakeKeyReportRequestToReportHistory
Killed by : none
replaced return value with null for org/cardanofoundation/explorer/api/mapper/StakeKeyReportMapperImpl::stakeKeyReportRequestToReportHistory → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.14.2