1 | package org.cardanofoundation.explorer.api.mapper; | |
2 | ||
3 | import java.time.Duration; | |
4 | import java.time.LocalDateTime; | |
5 | import java.util.Date; | |
6 | import java.util.GregorianCalendar; | |
7 | import javax.annotation.processing.Generated; | |
8 | import javax.xml.datatype.DatatypeConfigurationException; | |
9 | import javax.xml.datatype.DatatypeConstants; | |
10 | import javax.xml.datatype.DatatypeFactory; | |
11 | import javax.xml.datatype.XMLGregorianCalendar; | |
12 | import org.cardanofoundation.explorer.api.model.response.token.TokenFilterResponse; | |
13 | import org.cardanofoundation.explorer.api.model.response.token.TokenMetadataResponse; | |
14 | import org.cardanofoundation.explorer.api.projection.TokenProjection; | |
15 | import org.cardanofoundation.explorer.common.entity.ledgersync.AssetMetadata; | |
16 | import org.springframework.stereotype.Component; | |
17 | ||
18 | @Generated( | |
19 | value = "org.mapstruct.ap.MappingProcessor", | |
20 | date = "2024-11-05T06:00:27+0000", | |
21 | comments = "version: 1.5.3.Final, compiler: javac, environment: Java 18.0.2.1 (Eclipse Adoptium)" | |
22 | ) | |
23 | @Component | |
24 | public class AssetMetadataMapperImpl extends AssetMetadataMapper { | |
25 | ||
26 | private final DatatypeFactory datatypeFactory; | |
27 | ||
28 | public AssetMetadataMapperImpl() { | |
29 | try { | |
30 | datatypeFactory = DatatypeFactory.newInstance(); | |
31 | } | |
32 | catch ( DatatypeConfigurationException ex ) { | |
33 | throw new RuntimeException( ex ); | |
34 | } | |
35 | } | |
36 | ||
37 | @Override | |
38 | public TokenFilterResponse fromTokenProjectionToTokenFilterResponse(TokenProjection tokenProjection) { | |
39 |
1
1. fromTokenProjectionToTokenFilterResponse : negated conditional → NO_COVERAGE |
if ( tokenProjection == null ) { |
40 | return null; | |
41 | } | |
42 | ||
43 | TokenFilterResponse.TokenFilterResponseBuilder tokenFilterResponse = TokenFilterResponse.builder(); | |
44 | ||
45 | tokenFilterResponse.createdOn( xmlGregorianCalendarToLocalDateTime( dateToXmlGregorianCalendar( tokenProjection.getTime() ) ) ); | |
46 | tokenFilterResponse.id( tokenProjection.getId() ); | |
47 | tokenFilterResponse.name( tokenProjection.getName() ); | |
48 | tokenFilterResponse.policy( tokenProjection.getPolicy() ); | |
49 | tokenFilterResponse.fingerprint( tokenProjection.getFingerprint() ); | |
50 |
1
1. fromTokenProjectionToTokenFilterResponse : negated conditional → NO_COVERAGE |
if ( tokenProjection.getTxCount() != null ) { |
51 | tokenFilterResponse.txCount( tokenProjection.getTxCount().intValue() ); | |
52 | } | |
53 |
1
1. fromTokenProjectionToTokenFilterResponse : negated conditional → NO_COVERAGE |
if ( tokenProjection.getSupply() != null ) { |
54 | tokenFilterResponse.supply( tokenProjection.getSupply().toString() ); | |
55 | } | |
56 |
1
1. fromTokenProjectionToTokenFilterResponse : negated conditional → NO_COVERAGE |
if ( tokenProjection.getTotalVolume() != null ) { |
57 | tokenFilterResponse.totalVolume( tokenProjection.getTotalVolume().toString() ); | |
58 | } | |
59 | tokenFilterResponse.unit( tokenProjection.getUnit() ); | |
60 | ||
61 | tokenFilterResponse.displayName( getDisplayName(tokenProjection.getNameView(), tokenProjection.getFingerprint()) ); | |
62 | tokenFilterResponse.metadata( getMetadata(tokenProjection) ); | |
63 | ||
64 |
1
1. fromTokenProjectionToTokenFilterResponse : replaced return value with null for org/cardanofoundation/explorer/api/mapper/AssetMetadataMapperImpl::fromTokenProjectionToTokenFilterResponse → NO_COVERAGE |
return tokenFilterResponse.build(); |
65 | } | |
66 | ||
67 | @Override | |
68 | public TokenFilterResponse fromTokenProjectionToFilterResponse(TokenProjection tokenProjection) { | |
69 |
1
1. fromTokenProjectionToFilterResponse : negated conditional → KILLED |
if ( tokenProjection == null ) { |
70 | return null; | |
71 | } | |
72 | ||
73 | TokenFilterResponse.TokenFilterResponseBuilder tokenFilterResponse = TokenFilterResponse.builder(); | |
74 | ||
75 | tokenFilterResponse.displayName( tokenProjection.getNameView() ); | |
76 | tokenFilterResponse.createdOn( xmlGregorianCalendarToLocalDateTime( dateToXmlGregorianCalendar( tokenProjection.getTime() ) ) ); | |
77 | tokenFilterResponse.id( tokenProjection.getId() ); | |
78 | tokenFilterResponse.name( tokenProjection.getName() ); | |
79 | tokenFilterResponse.policy( tokenProjection.getPolicy() ); | |
80 | tokenFilterResponse.fingerprint( tokenProjection.getFingerprint() ); | |
81 |
1
1. fromTokenProjectionToFilterResponse : negated conditional → SURVIVED |
if ( tokenProjection.getTxCount() != null ) { |
82 | tokenFilterResponse.txCount( tokenProjection.getTxCount().intValue() ); | |
83 | } | |
84 |
1
1. fromTokenProjectionToFilterResponse : negated conditional → KILLED |
if ( tokenProjection.getSupply() != null ) { |
85 | tokenFilterResponse.supply( tokenProjection.getSupply().toString() ); | |
86 | } | |
87 |
1
1. fromTokenProjectionToFilterResponse : negated conditional → KILLED |
if ( tokenProjection.getTotalVolume() != null ) { |
88 | tokenFilterResponse.totalVolume( tokenProjection.getTotalVolume().toString() ); | |
89 | } | |
90 | tokenFilterResponse.unit( tokenProjection.getUnit() ); | |
91 | ||
92 | tokenFilterResponse.metadata( getMetadata(tokenProjection) ); | |
93 | ||
94 |
1
1. fromTokenProjectionToFilterResponse : replaced return value with null for org/cardanofoundation/explorer/api/mapper/AssetMetadataMapperImpl::fromTokenProjectionToFilterResponse → KILLED |
return tokenFilterResponse.build(); |
95 | } | |
96 | ||
97 | @Override | |
98 | public TokenMetadataResponse fromAssetMetadata(AssetMetadata metadata) { | |
99 |
1
1. fromAssetMetadata : negated conditional → NO_COVERAGE |
if ( metadata == null ) { |
100 | return null; | |
101 | } | |
102 | ||
103 | TokenMetadataResponse.TokenMetadataResponseBuilder tokenMetadataResponse = TokenMetadataResponse.builder(); | |
104 | ||
105 | tokenMetadataResponse.logo( getTokenLogoEndpoint( metadata.getLogo() ) ); | |
106 | tokenMetadataResponse.url( metadata.getUrl() ); | |
107 | tokenMetadataResponse.ticker( metadata.getTicker() ); | |
108 | tokenMetadataResponse.decimals( metadata.getDecimals() ); | |
109 | tokenMetadataResponse.description( metadata.getDescription() ); | |
110 | ||
111 |
1
1. fromAssetMetadata : replaced return value with null for org/cardanofoundation/explorer/api/mapper/AssetMetadataMapperImpl::fromAssetMetadata → NO_COVERAGE |
return tokenMetadataResponse.build(); |
112 | } | |
113 | ||
114 | private XMLGregorianCalendar dateToXmlGregorianCalendar( Date date ) { | |
115 |
1
1. dateToXmlGregorianCalendar : negated conditional → KILLED |
if ( date == null ) { |
116 | return null; | |
117 | } | |
118 | ||
119 | GregorianCalendar c = new GregorianCalendar(); | |
120 |
1
1. dateToXmlGregorianCalendar : removed call to java/util/GregorianCalendar::setTime → NO_COVERAGE |
c.setTime( date ); |
121 |
1
1. dateToXmlGregorianCalendar : replaced return value with null for org/cardanofoundation/explorer/api/mapper/AssetMetadataMapperImpl::dateToXmlGregorianCalendar → NO_COVERAGE |
return datatypeFactory.newXMLGregorianCalendar( c ); |
122 | } | |
123 | ||
124 | private static LocalDateTime xmlGregorianCalendarToLocalDateTime( XMLGregorianCalendar xcal ) { | |
125 |
1
1. xmlGregorianCalendarToLocalDateTime : negated conditional → KILLED |
if ( xcal == null ) { |
126 | return null; | |
127 | } | |
128 | ||
129 |
1
1. xmlGregorianCalendarToLocalDateTime : negated conditional → NO_COVERAGE |
if ( xcal.getYear() != DatatypeConstants.FIELD_UNDEFINED |
130 |
1
1. xmlGregorianCalendarToLocalDateTime : negated conditional → NO_COVERAGE |
&& xcal.getMonth() != DatatypeConstants.FIELD_UNDEFINED |
131 |
1
1. xmlGregorianCalendarToLocalDateTime : negated conditional → NO_COVERAGE |
&& xcal.getDay() != DatatypeConstants.FIELD_UNDEFINED |
132 |
1
1. xmlGregorianCalendarToLocalDateTime : negated conditional → NO_COVERAGE |
&& xcal.getHour() != DatatypeConstants.FIELD_UNDEFINED |
133 |
1
1. xmlGregorianCalendarToLocalDateTime : negated conditional → NO_COVERAGE |
&& xcal.getMinute() != DatatypeConstants.FIELD_UNDEFINED |
134 | ) { | |
135 |
1
1. xmlGregorianCalendarToLocalDateTime : negated conditional → NO_COVERAGE |
if ( xcal.getSecond() != DatatypeConstants.FIELD_UNDEFINED |
136 |
1
1. xmlGregorianCalendarToLocalDateTime : negated conditional → NO_COVERAGE |
&& xcal.getMillisecond() != DatatypeConstants.FIELD_UNDEFINED ) { |
137 |
1
1. xmlGregorianCalendarToLocalDateTime : replaced return value with null for org/cardanofoundation/explorer/api/mapper/AssetMetadataMapperImpl::xmlGregorianCalendarToLocalDateTime → NO_COVERAGE |
return LocalDateTime.of( |
138 | xcal.getYear(), | |
139 | xcal.getMonth(), | |
140 | xcal.getDay(), | |
141 | xcal.getHour(), | |
142 | xcal.getMinute(), | |
143 | xcal.getSecond(), | |
144 | Duration.ofMillis( xcal.getMillisecond() ).getNano() | |
145 | ); | |
146 | } | |
147 |
1
1. xmlGregorianCalendarToLocalDateTime : negated conditional → NO_COVERAGE |
else if ( xcal.getSecond() != DatatypeConstants.FIELD_UNDEFINED ) { |
148 |
1
1. xmlGregorianCalendarToLocalDateTime : replaced return value with null for org/cardanofoundation/explorer/api/mapper/AssetMetadataMapperImpl::xmlGregorianCalendarToLocalDateTime → NO_COVERAGE |
return LocalDateTime.of( |
149 | xcal.getYear(), | |
150 | xcal.getMonth(), | |
151 | xcal.getDay(), | |
152 | xcal.getHour(), | |
153 | xcal.getMinute(), | |
154 | xcal.getSecond() | |
155 | ); | |
156 | } | |
157 | else { | |
158 |
1
1. xmlGregorianCalendarToLocalDateTime : replaced return value with null for org/cardanofoundation/explorer/api/mapper/AssetMetadataMapperImpl::xmlGregorianCalendarToLocalDateTime → NO_COVERAGE |
return LocalDateTime.of( |
159 | xcal.getYear(), | |
160 | xcal.getMonth(), | |
161 | xcal.getDay(), | |
162 | xcal.getHour(), | |
163 | xcal.getMinute() | |
164 | ); | |
165 | } | |
166 | } | |
167 | return null; | |
168 | } | |
169 | } | |
Mutations | ||
39 |
1.1 |
|
50 |
1.1 |
|
53 |
1.1 |
|
56 |
1.1 |
|
64 |
1.1 |
|
69 |
1.1 |
|
81 |
1.1 |
|
84 |
1.1 |
|
87 |
1.1 |
|
94 |
1.1 |
|
99 |
1.1 |
|
111 |
1.1 |
|
115 |
1.1 |
|
120 |
1.1 |
|
121 |
1.1 |
|
125 |
1.1 |
|
129 |
1.1 |
|
130 |
1.1 |
|
131 |
1.1 |
|
132 |
1.1 |
|
133 |
1.1 |
|
135 |
1.1 |
|
136 |
1.1 |
|
137 |
1.1 |
|
147 |
1.1 |
|
148 |
1.1 |
|
158 |
1.1 |