1 | package org.cardanofoundation.explorer.api.util; | |
2 | ||
3 | import java.util.ArrayList; | |
4 | import java.util.HashMap; | |
5 | import java.util.List; | |
6 | import java.util.Map; | |
7 | import java.util.Map.Entry; | |
8 | import java.util.Objects; | |
9 | ||
10 | import lombok.AccessLevel; | |
11 | import lombok.NoArgsConstructor; | |
12 | import lombok.extern.slf4j.Slf4j; | |
13 | ||
14 | import com.fasterxml.jackson.core.type.TypeReference; | |
15 | import com.fasterxml.jackson.databind.ObjectMapper; | |
16 | ||
17 | import org.cardanofoundation.explorer.api.common.enumeration.FormatFieldType; | |
18 | import org.cardanofoundation.explorer.api.common.enumeration.MetadataField; | |
19 | import org.cardanofoundation.explorer.api.model.metadatastandard.BaseProperty; | |
20 | import org.cardanofoundation.explorer.api.model.metadatastandard.cip.MetadataCIP; | |
21 | import org.cardanofoundation.explorer.api.model.metadatastandard.cip.TokenCIP; | |
22 | ||
23 | @NoArgsConstructor(access = AccessLevel.PRIVATE) | |
24 | @Slf4j | |
25 | public class MetadataCIP60Utils { | |
26 | ||
27 | @SuppressWarnings("unchecked") | |
28 | public static MetadataCIP standard(String jsonMetadata) { | |
29 | MetadataCIP metadataCIP = new MetadataCIP(); | |
30 |
1
1. standard : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/cip/MetadataCIP::setValid → SURVIVED |
metadataCIP.setValid(false); |
31 | Map<Object, TokenCIP> tokenMap = new HashMap<>(); | |
32 | try { | |
33 | ObjectMapper objectMapper = new ObjectMapper(); | |
34 | Map<Object, Object> metadataMap = | |
35 | objectMapper.readValue(jsonMetadata, new TypeReference<>() {}); | |
36 | boolean musicVersionValid = true; | |
37 | for (Map.Entry<Object, Object> metadataEntry : metadataMap.entrySet()) { | |
38 |
1
1. standard : negated conditional → SURVIVED |
if (metadataEntry.getValue() instanceof HashMap<?, ?> assetMap) { |
39 | Object policyId = metadataEntry.getKey(); | |
40 | for (Entry<?, ?> assetEntry : assetMap.entrySet()) { | |
41 | TokenCIP token = new TokenCIP(); | |
42 | Map<Object, Object> assetValMap = (Map<Object, Object>) assetEntry.getValue(); | |
43 | int musicVersion = | |
44 | detectMusicVersion(assetValMap.get(MetadataField.MUSIC_METADATA_VERSION.getName())); | |
45 | int version = | |
46 |
1
1. standard : negated conditional → SURVIVED |
musicVersion == 3 |
47 | ? 0 | |
48 | : MetadataCIP25Utils.detectVersion( | |
49 | metadataMap.get(MetadataField.VERSION.getName())); | |
50 | // require | |
51 | List<BaseProperty> requireProperties = new ArrayList<>(); | |
52 | requireProperties.add(MetadataCIP25Utils.policy(policyId, version)); | |
53 | requireProperties.add(MetadataCIP25Utils.assetName(assetEntry.getKey(), version)); | |
54 | requireProperties.add( | |
55 | MetadataCIP25Utils.name(assetValMap.get(MetadataField.NAME.getName()), version)); | |
56 | requireProperties.add( | |
57 | MetadataCIP25Utils.image(assetValMap.get(MetadataField.IMAGE.getName()), version)); | |
58 | requireProperties.add( | |
59 | musicMetadataVersion( | |
60 | musicVersion, assetValMap.get(MetadataField.MUSIC_METADATA_VERSION.getName()))); | |
61 | requireProperties.add( | |
62 | releaseType(assetValMap.get(MetadataField.RELEASE_TYPE.getName()), version)); | |
63 | // optional | |
64 | List<BaseProperty> optionalProperties = new ArrayList<>(); | |
65 | Object desc = assetValMap.get(MetadataField.DESCRIPTION.getName()); | |
66 | int currentIdx = 1; | |
67 |
1
1. standard : negated conditional → SURVIVED |
if (Objects.nonNull(desc)) { |
68 | optionalProperties.add( | |
69 | MetadataCIP25Utils.description(desc, String.valueOf(currentIdx), version)); | |
70 |
1
1. standard : Changed increment from 1 to -1 → NO_COVERAGE |
currentIdx++; |
71 | } | |
72 | Object mediaType = assetValMap.get(MetadataField.MEDIA_TYPE.getName()); | |
73 |
1
1. standard : negated conditional → SURVIVED |
if (Objects.nonNull(mediaType)) { |
74 | optionalProperties.add( | |
75 | MetadataCIP25Utils.mediaType(mediaType, String.valueOf(currentIdx), version)); | |
76 |
1
1. standard : Changed increment from 1 to -1 → SURVIVED |
currentIdx++; |
77 | } | |
78 |
1
1. standard : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP25Utils::version → SURVIVED |
MetadataCIP25Utils.version( |
79 | metadataMap.get(MetadataField.VERSION.getName()), | |
80 | String.valueOf(currentIdx), | |
81 | optionalProperties); | |
82 | switch (musicVersion) { | |
83 | case 0 -> { | |
84 | log.warn("Metadata standard CIP-60 incorrect"); | |
85 |
1
1. standard : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/cip/MetadataCIP::setValid → SURVIVED |
metadataCIP.setValid(null); |
86 |
1
1. standard : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/cip/MetadataCIP::setTokenMap → SURVIVED |
metadataCIP.setTokenMap(tokenMap); |
87 |
1
1. standard : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::standard → SURVIVED |
return metadataCIP; |
88 | } | |
89 |
1
1. standard : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::setFieldsWithMusicVersionOne → NO_COVERAGE |
case 1 -> setFieldsWithMusicVersionOne( |
90 | assetValMap, requireProperties, optionalProperties, version); | |
91 |
1
1. standard : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::setFieldsWithMusicVersionTwo → NO_COVERAGE |
case 2 -> setFieldsWithMusicVersionTwo(assetValMap, requireProperties, version); |
92 | case 3 -> { | |
93 | log.warn("Metadata standard CIP-60 incorrect"); | |
94 |
1
1. standard : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::filesMusicVersionIncorrect → NO_COVERAGE |
filesMusicVersionIncorrect( |
95 | assetValMap.get(MetadataField.FILES.getName()), requireProperties); | |
96 | musicVersionValid = false; | |
97 | } | |
98 | default -> log.warn("music version: " + musicVersion); | |
99 | } | |
100 |
1
1. standard : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::setDataForToken → NO_COVERAGE |
setDataForToken(assetEntry, token, requireProperties, optionalProperties, tokenMap); |
101 | } | |
102 | } | |
103 | } | |
104 |
1
1. standard : negated conditional → NO_COVERAGE |
if (musicVersionValid) { |
105 |
1
1. standard : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/cip/MetadataCIP::setValid → NO_COVERAGE |
metadataCIP.setValid(valid(tokenMap)); |
106 | } | |
107 | } catch (Exception ex) { | |
108 | log.error("Error: structure incorrect, message=" + ex.getMessage()); | |
109 | log.error("Check standard CIP-25 fail"); | |
110 | } | |
111 |
1
1. standard : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/cip/MetadataCIP::setTokenMap → SURVIVED |
metadataCIP.setTokenMap(tokenMap); |
112 |
1
1. standard : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::standard → SURVIVED |
return metadataCIP; |
113 | } | |
114 | ||
115 | private static void setDataForToken( | |
116 | Entry<?, ?> assetEntry, | |
117 | TokenCIP token, | |
118 | List<BaseProperty> requireProperties, | |
119 | List<BaseProperty> optionalProperties, | |
120 | Map<Object, TokenCIP> tokenMap) { | |
121 |
1
1. setDataForToken : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/cip/TokenCIP::setTokenName → NO_COVERAGE |
token.setTokenName(assetEntry.getKey()); |
122 |
1
1. setDataForToken : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/cip/TokenCIP::setRequireProperties → NO_COVERAGE |
token.setRequireProperties(requireProperties); |
123 |
1
1. setDataForToken : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/cip/TokenCIP::setOptionalProperties → NO_COVERAGE |
token.setOptionalProperties(optionalProperties); |
124 | tokenMap.put(assetEntry.getKey(), token); | |
125 | } | |
126 | ||
127 | public static int detectMusicVersion(Object musicVersion) { | |
128 |
1
1. detectMusicVersion : negated conditional → SURVIVED |
if (Objects.isNull(musicVersion)) { |
129 | return 0; | |
130 |
1
1. detectMusicVersion : negated conditional → NO_COVERAGE |
} else if (musicVersion instanceof Integer musicVersionInt |
131 |
1
1. detectMusicVersion : negated conditional → NO_COVERAGE |
&& List.of(1, 2).contains(musicVersionInt)) { |
132 |
1
1. detectMusicVersion : replaced int return with 0 for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::detectMusicVersion → NO_COVERAGE |
return musicVersionInt; |
133 | } else { | |
134 |
1
1. detectMusicVersion : replaced int return with 0 for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::detectMusicVersion → NO_COVERAGE |
return 3; |
135 | } | |
136 | } | |
137 | ||
138 | private static void setFieldsWithMusicVersionOne( | |
139 | Map<Object, Object> assetValMap, | |
140 | List<BaseProperty> requireProperties, | |
141 | List<BaseProperty> optionalProperties, | |
142 | int version) { | |
143 | ||
144 | String releaseType = "invalid"; | |
145 | Object val = assetValMap.get(MetadataField.RELEASE_TYPE.getName()); | |
146 |
2
1. setFieldsWithMusicVersionOne : negated conditional → NO_COVERAGE 2. setFieldsWithMusicVersionOne : negated conditional → NO_COVERAGE |
if (Objects.nonNull(val) && val instanceof String valStr) { |
147 | releaseType = valStr; | |
148 | } | |
149 | switch (releaseType) { | |
150 | case "Single" -> { | |
151 | // require | |
152 | requireProperties.add( | |
153 | albumTitleMetadataCIP60( | |
154 | assetValMap.get(MetadataField.ALBUM_TITLE.getName()), "7", version)); | |
155 | requireProperties.add( | |
156 | trackNumber(assetValMap.get(MetadataField.TRACK_NUMBER.getName()), "8", version)); | |
157 | requireProperties.add( | |
158 | songTitle(assetValMap.get(MetadataField.SONG_TITLE.getName()), "9", version)); | |
159 | requireProperties.add( | |
160 | songDuration(assetValMap.get(MetadataField.SONG_DURATION.getName()), "10", version)); | |
161 | requireProperties.add( | |
162 | genres(assetValMap.get(MetadataField.GENRES.getName()), "11", version)); | |
163 | requireProperties.add( | |
164 | copyright(assetValMap.get(MetadataField.COPYRIGHT.getName()), "12", version)); | |
165 | artists(assetValMap.get(MetadataField.ARTISTS.getName()), requireProperties, "13", version); | |
166 |
1
1. setFieldsWithMusicVersionOne : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::filesVerOneSingle → NO_COVERAGE |
filesVerOneSingle( |
167 | assetValMap.get(MetadataField.FILES.getName()), requireProperties, version); | |
168 | // optional | |
169 | Object links = assetValMap.get(MetadataField.LINKS.getName()); | |
170 |
1
1. setFieldsWithMusicVersionOne : negated conditional → NO_COVERAGE |
if (Objects.nonNull(links)) { |
171 | optionalProperties.add( | |
172 |
1
1. setFieldsWithMusicVersionOne : Replaced integer addition with subtraction → NO_COVERAGE |
links(links, null, String.valueOf(optionalProperties.size() + 1), version)); |
173 | } | |
174 | int subArtistOne = | |
175 | contributingArtists( | |
176 | assetValMap.get(MetadataField.CONTRIBUTING_ARTISTS.getName()), | |
177 | optionalProperties, | |
178 |
1
1. setFieldsWithMusicVersionOne : Replaced integer addition with subtraction → NO_COVERAGE |
String.valueOf((optionalProperties.size() + 1)), |
179 | version); | |
180 | int subArtistTwo = | |
181 | featuredArtist( | |
182 | assetValMap.get(MetadataField.FEATURED_ARTIST.getName()), | |
183 | optionalProperties, | |
184 |
1
1. setFieldsWithMusicVersionOne : Replaced integer addition with subtraction → NO_COVERAGE |
String.valueOf((optionalProperties.size() + 1)), |
185 | version); | |
186 |
1
1. setFieldsWithMusicVersionOne : Replaced integer addition with subtraction → NO_COVERAGE |
int subArtist = subArtistOne + subArtistTwo; |
187 |
1
1. setFieldsWithMusicVersionOne : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::basePropertiesPartOne → NO_COVERAGE |
basePropertiesPartOne(assetValMap, optionalProperties, null, version, subArtist); |
188 |
1
1. setFieldsWithMusicVersionOne : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::basePropertiesPartTwo → NO_COVERAGE |
basePropertiesPartTwo(assetValMap, optionalProperties, null, version, subArtist); |
189 |
1
1. setFieldsWithMusicVersionOne : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::basePropertiesPartThree → NO_COVERAGE |
basePropertiesPartThree(assetValMap, optionalProperties, null, version, subArtist); |
190 | } | |
191 |
1
1. setFieldsWithMusicVersionOne : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::filesVerOneMultiple → NO_COVERAGE |
case "Multiple" -> filesVerOneMultiple( |
192 | assetValMap.get(MetadataField.FILES.getName()), requireProperties, version); | |
193 | default -> log.warn("json metadata invalid"); | |
194 | } | |
195 | } | |
196 | ||
197 | private static void setFieldsWithMusicVersionTwo( | |
198 | Map<Object, Object> assetValMap, List<BaseProperty> requireProperties, int version) { | |
199 |
1
1. setFieldsWithMusicVersionTwo : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::release → NO_COVERAGE |
release(assetValMap.get(MetadataField.RELEASE.getName()), requireProperties, version); |
200 |
1
1. setFieldsWithMusicVersionTwo : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::filesVerTwo → NO_COVERAGE |
filesVerTwo(assetValMap.get(MetadataField.FILES.getName()), requireProperties, version); |
201 | } | |
202 | ||
203 | private static void release(Object release, List<BaseProperty> requireProperties, int version) { | |
204 | BaseProperty releaseProperty = | |
205 | BaseProperty.builder() | |
206 | .valid(false) | |
207 | .property(MetadataField.RELEASE.getName()) | |
208 | .index("7") | |
209 | .build(); | |
210 | List<BaseProperty> requirePropertiesInRelease = new ArrayList<>(); | |
211 | String ind = releaseProperty.getIndex(); | |
212 |
2
1. release : negated conditional → NO_COVERAGE 2. release : negated conditional → NO_COVERAGE |
if (Objects.nonNull(release) && release instanceof HashMap<?, ?> releaseMap) { |
213 | requirePropertiesInRelease.add( | |
214 | metadataString( | |
215 | releaseMap.get(MetadataField.RELEASE_TITLE.getName()), | |
216 | MetadataField.RELEASE_TITLE.getName(), | |
217 | ind, | |
218 | "1", | |
219 | version)); | |
220 | requirePropertiesInRelease.add( | |
221 | metadataString( | |
222 | releaseMap.get(MetadataField.COPYRIGHT.getName()), | |
223 | MetadataField.COPYRIGHT.getName(), | |
224 | ind, | |
225 | "2", | |
226 | version)); | |
227 | int index = 3; | |
228 | Object visualArtist = releaseMap.get(MetadataField.VISUAL_ARTIST.getName()); | |
229 |
1
1. release : negated conditional → NO_COVERAGE |
if (Objects.nonNull(visualArtist)) { |
230 | requirePropertiesInRelease.add( | |
231 | metadataString( | |
232 | visualArtist, | |
233 | MetadataField.VISUAL_ARTIST.getName(), | |
234 | ind, | |
235 | String.valueOf(index), | |
236 | version)); | |
237 |
1
1. release : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
238 | } | |
239 | Object distributor = releaseMap.get(MetadataField.DISTRIBUTOR.getName()); | |
240 |
1
1. release : negated conditional → NO_COVERAGE |
if (Objects.nonNull(distributor)) { |
241 | requirePropertiesInRelease.add( | |
242 | metadataString( | |
243 | distributor, | |
244 | MetadataField.DISTRIBUTOR.getName(), | |
245 | ind, | |
246 | String.valueOf(index), | |
247 | version)); | |
248 |
1
1. release : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
249 | } | |
250 | Object releaseDate = releaseMap.get(MetadataField.RELEASE_DATE.getName()); | |
251 |
1
1. release : negated conditional → NO_COVERAGE |
if (Objects.nonNull(releaseDate)) { |
252 | requirePropertiesInRelease.add( | |
253 | metadataString( | |
254 | releaseDate, | |
255 | MetadataField.RELEASE_DATE.getName(), | |
256 | ind, | |
257 | String.valueOf(index), | |
258 | version)); | |
259 |
1
1. release : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
260 | } | |
261 | Object publicationDate = releaseMap.get(MetadataField.PUBLICATION_DATE.getName()); | |
262 |
1
1. release : negated conditional → NO_COVERAGE |
if (Objects.nonNull(publicationDate)) { |
263 | requirePropertiesInRelease.add( | |
264 | metadataString( | |
265 | publicationDate, | |
266 | MetadataField.PUBLICATION_DATE.getName(), | |
267 | ind, | |
268 | String.valueOf(index), | |
269 | version)); | |
270 |
1
1. release : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
271 | } | |
272 | Object catalogNumber = releaseMap.get(MetadataField.CATALOG_NUMBER.getName()); | |
273 |
1
1. release : negated conditional → NO_COVERAGE |
if (Objects.nonNull(catalogNumber)) { |
274 | requirePropertiesInRelease.add( | |
275 | metadataInt( | |
276 | catalogNumber, | |
277 | MetadataField.CATALOG_NUMBER.getName(), | |
278 | ind, | |
279 | String.valueOf(index), | |
280 | version)); | |
281 |
1
1. release : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
282 | } | |
283 | Object releaseVersion = releaseMap.get(MetadataField.RELEASE_VERSION.getName()); | |
284 |
1
1. release : negated conditional → NO_COVERAGE |
if (Objects.nonNull(releaseVersion)) { |
285 | requirePropertiesInRelease.add( | |
286 | metadataInt( | |
287 | releaseVersion, | |
288 | MetadataField.RELEASE_VERSION.getName(), | |
289 | ind, | |
290 | String.valueOf(index), | |
291 | version)); | |
292 |
1
1. release : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
293 | } | |
294 | Object producer = releaseMap.get(MetadataField.PRODUCER.getName()); | |
295 |
1
1. release : negated conditional → NO_COVERAGE |
if (Objects.nonNull(producer)) { |
296 | requirePropertiesInRelease.add( | |
297 | metadataString( | |
298 | producer, MetadataField.PRODUCER.getName(), ind, String.valueOf(index), version)); | |
299 |
1
1. release : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
300 | } | |
301 | Object coProducer = releaseMap.get(MetadataField.CO_PRODUCER.getName()); | |
302 |
1
1. release : negated conditional → NO_COVERAGE |
if (Objects.nonNull(coProducer)) { |
303 | requirePropertiesInRelease.add( | |
304 | metadataString( | |
305 | coProducer, | |
306 | MetadataField.CO_PRODUCER.getName(), | |
307 | ind, | |
308 | String.valueOf(index), | |
309 | version)); | |
310 |
1
1. release : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
311 | } | |
312 | Object metadataLanguage = releaseMap.get(MetadataField.METADATA_LANGUAGE.getName()); | |
313 |
1
1. release : negated conditional → NO_COVERAGE |
if (Objects.nonNull(metadataLanguage)) { |
314 | requirePropertiesInRelease.add( | |
315 | metadataString( | |
316 | metadataLanguage, | |
317 | MetadataField.METADATA_LANGUAGE.getName(), | |
318 | ind, | |
319 | String.valueOf(index), | |
320 | version)); | |
321 |
1
1. release : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
322 | } | |
323 | Object language = releaseMap.get(MetadataField.LANGUAGE.getName()); | |
324 |
1
1. release : negated conditional → NO_COVERAGE |
if (Objects.nonNull(language)) { |
325 | requirePropertiesInRelease.add( | |
326 | metadataString( | |
327 | language, MetadataField.LANGUAGE.getName(), ind, String.valueOf(index), version)); | |
328 |
1
1. release : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
329 | } | |
330 | Object links = releaseMap.get(MetadataField.LINKS.getName()); | |
331 |
1
1. release : negated conditional → NO_COVERAGE |
if (Objects.nonNull(links)) { |
332 | requirePropertiesInRelease.add(links(links, ind, String.valueOf(index), version)); | |
333 | } | |
334 |
1
1. release : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
releaseProperty.setValid( |
335 | requirePropertiesInRelease.stream() | |
336 |
2
1. lambda$release$0 : replaced boolean return with true for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$release$0 → NO_COVERAGE 2. lambda$release$0 : replaced boolean return with false for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$release$0 → NO_COVERAGE |
.allMatch(baseProperty -> baseProperty.getValid().equals(true))); |
337 | } else { | |
338 | requirePropertiesInRelease.add( | |
339 | metadataString(null, MetadataField.RELEASE_TITLE.getName(), ind, "1", version)); | |
340 | requirePropertiesInRelease.add( | |
341 | metadataString(null, MetadataField.COPYRIGHT.getName(), ind, "2", version)); | |
342 | } | |
343 | requireProperties.add(releaseProperty); | |
344 | requireProperties.addAll(requirePropertiesInRelease); | |
345 | } | |
346 | ||
347 | private static void basePropertiesPartThree( | |
348 | Map<?, ?> valMap, | |
349 | List<BaseProperty> baseProperties, | |
350 | String indexInSong, | |
351 | int version, | |
352 | int subArtist) { | |
353 |
2
1. basePropertiesPartThree : Replaced integer addition with subtraction → NO_COVERAGE 2. basePropertiesPartThree : Replaced integer subtraction with addition → NO_COVERAGE |
int index = baseProperties.size() + 1 - subArtist; |
354 | Object explicit = valMap.get(MetadataField.EXPLICIT.getName()); | |
355 |
1
1. basePropertiesPartThree : negated conditional → NO_COVERAGE |
if (Objects.nonNull(explicit)) { |
356 | baseProperties.add( | |
357 | metadataBool( | |
358 | explicit, | |
359 | MetadataField.EXPLICIT.getName(), | |
360 | indexInSong, | |
361 | String.valueOf(index), | |
362 | version)); | |
363 |
1
1. basePropertiesPartThree : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
364 | } | |
365 | Object isrc = valMap.get(MetadataField.ISRC.getName()); | |
366 |
1
1. basePropertiesPartThree : negated conditional → NO_COVERAGE |
if (Objects.nonNull(isrc)) { |
367 | baseProperties.add( | |
368 | metadataString( | |
369 | isrc, MetadataField.ISRC.getName(), indexInSong, String.valueOf(index), version)); | |
370 |
1
1. basePropertiesPartThree : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
371 | } | |
372 | Object iswc = valMap.get(MetadataField.ISWC.getName()); | |
373 |
1
1. basePropertiesPartThree : negated conditional → NO_COVERAGE |
if (Objects.nonNull(iswc)) { |
374 | baseProperties.add( | |
375 | metadataString( | |
376 | iswc, MetadataField.ISWC.getName(), indexInSong, String.valueOf(index), version)); | |
377 |
1
1. basePropertiesPartThree : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
378 | } | |
379 | Object ipi = valMap.get(MetadataField.IPI.getName()); | |
380 |
1
1. basePropertiesPartThree : negated conditional → NO_COVERAGE |
if (Objects.nonNull(ipi)) { |
381 | baseProperties.add( | |
382 | metadataArrayString( | |
383 | ipi, MetadataField.IPI.getName(), indexInSong, String.valueOf(index), version)); | |
384 |
1
1. basePropertiesPartThree : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
385 | } | |
386 | Object ipn = valMap.get(MetadataField.IPN.getName()); | |
387 |
1
1. basePropertiesPartThree : negated conditional → NO_COVERAGE |
if (Objects.nonNull(ipn)) { |
388 | baseProperties.add( | |
389 | metadataArrayString( | |
390 | ipn, MetadataField.IPN.getName(), indexInSong, String.valueOf(index), version)); | |
391 |
1
1. basePropertiesPartThree : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
392 | } | |
393 | Object isni = valMap.get(MetadataField.ISNI.getName()); | |
394 |
1
1. basePropertiesPartThree : negated conditional → NO_COVERAGE |
if (Objects.nonNull(isni)) { |
395 | baseProperties.add( | |
396 | metadataArrayString( | |
397 | isni, MetadataField.ISNI.getName(), indexInSong, String.valueOf(index), version)); | |
398 |
1
1. basePropertiesPartThree : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
399 | } | |
400 | Object metadataLanguage = valMap.get(MetadataField.METADATA_LANGUAGE.getName()); | |
401 |
1
1. basePropertiesPartThree : negated conditional → NO_COVERAGE |
if (Objects.nonNull(metadataLanguage)) { |
402 | baseProperties.add( | |
403 | metadataString( | |
404 | metadataLanguage, | |
405 | MetadataField.METADATA_LANGUAGE.getName(), | |
406 | indexInSong, | |
407 | String.valueOf(index), | |
408 | version)); | |
409 |
1
1. basePropertiesPartThree : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
410 | } | |
411 | Object countryOfOrigin = valMap.get(MetadataField.COUNTRY_OF_ORIGIN.getName()); | |
412 |
1
1. basePropertiesPartThree : negated conditional → NO_COVERAGE |
if (Objects.nonNull(countryOfOrigin)) { |
413 | baseProperties.add( | |
414 | metadataString( | |
415 | countryOfOrigin, | |
416 | MetadataField.COUNTRY_OF_ORIGIN.getName(), | |
417 | indexInSong, | |
418 | String.valueOf(index), | |
419 | version)); | |
420 |
1
1. basePropertiesPartThree : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
421 | } | |
422 | Object language = valMap.get(MetadataField.LANGUAGE.getName()); | |
423 |
1
1. basePropertiesPartThree : negated conditional → NO_COVERAGE |
if (Objects.nonNull(language)) { |
424 | baseProperties.add( | |
425 | metadataString( | |
426 | language, | |
427 | MetadataField.LANGUAGE.getName(), | |
428 | indexInSong, | |
429 | String.valueOf(index), | |
430 | version)); | |
431 |
1
1. basePropertiesPartThree : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
432 | } | |
433 | Object derivedFrom = valMap.get(MetadataField.DERIVED_FROM.getName()); | |
434 |
1
1. basePropertiesPartThree : negated conditional → NO_COVERAGE |
if (Objects.nonNull(derivedFrom)) { |
435 | baseProperties.add( | |
436 | metadataString( | |
437 | derivedFrom, | |
438 | MetadataField.DERIVED_FROM.getName(), | |
439 | indexInSong, | |
440 | String.valueOf(index), | |
441 | version)); | |
442 | } | |
443 | } | |
444 | ||
445 | private static void basePropertiesPartTwo( | |
446 | Map<?, ?> valMap, | |
447 | List<BaseProperty> baseProperties, | |
448 | String indexInSong, | |
449 | int version, | |
450 | int subArtist) { | |
451 |
2
1. basePropertiesPartTwo : Replaced integer subtraction with addition → NO_COVERAGE 2. basePropertiesPartTwo : Replaced integer addition with subtraction → NO_COVERAGE |
int index = baseProperties.size() + 1 - subArtist; |
452 | Object publicationDate = valMap.get(MetadataField.PUBLICATION_DATE.getName()); | |
453 |
1
1. basePropertiesPartTwo : negated conditional → NO_COVERAGE |
if (Objects.nonNull(publicationDate)) { |
454 | baseProperties.add( | |
455 | metadataString( | |
456 | publicationDate, | |
457 | MetadataField.PUBLICATION_DATE.getName(), | |
458 | indexInSong, | |
459 | String.valueOf(index), | |
460 | version)); | |
461 |
1
1. basePropertiesPartTwo : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
462 | } | |
463 | Object catalogNumber = valMap.get(MetadataField.CATALOG_NUMBER.getName()); | |
464 |
1
1. basePropertiesPartTwo : negated conditional → NO_COVERAGE |
if (Objects.nonNull(catalogNumber)) { |
465 | baseProperties.add( | |
466 | metadataInt( | |
467 | catalogNumber, | |
468 | MetadataField.CATALOG_NUMBER.getName(), | |
469 | indexInSong, | |
470 | String.valueOf(index), | |
471 | version)); | |
472 |
1
1. basePropertiesPartTwo : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
473 | } | |
474 | Object bitrate = valMap.get(MetadataField.BITRATE.getName()); | |
475 |
1
1. basePropertiesPartTwo : negated conditional → NO_COVERAGE |
if (Objects.nonNull(bitrate)) { |
476 | baseProperties.add( | |
477 | metadataString( | |
478 | bitrate, | |
479 | MetadataField.BITRATE.getName(), | |
480 | indexInSong, | |
481 | String.valueOf(index), | |
482 | version)); | |
483 |
1
1. basePropertiesPartTwo : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
484 | } | |
485 | Object mixEngineer = valMap.get(MetadataField.MIX_ENGINEER.getName()); | |
486 |
1
1. basePropertiesPartTwo : negated conditional → NO_COVERAGE |
if (Objects.nonNull(mixEngineer)) { |
487 | baseProperties.add( | |
488 | metadataString( | |
489 | mixEngineer, | |
490 | MetadataField.MIX_ENGINEER.getName(), | |
491 | indexInSong, | |
492 | String.valueOf(index), | |
493 | version)); | |
494 |
1
1. basePropertiesPartTwo : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
495 | } | |
496 | Object masteringEngineer = valMap.get(MetadataField.MASTERING_ENGINEER.getName()); | |
497 |
1
1. basePropertiesPartTwo : negated conditional → NO_COVERAGE |
if (Objects.nonNull(masteringEngineer)) { |
498 | baseProperties.add( | |
499 | metadataString( | |
500 | masteringEngineer, | |
501 | MetadataField.MASTERING_ENGINEER.getName(), | |
502 | indexInSong, | |
503 | String.valueOf(index), | |
504 | version)); | |
505 |
1
1. basePropertiesPartTwo : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
506 | } | |
507 | Object producer = valMap.get(MetadataField.PRODUCER.getName()); | |
508 |
1
1. basePropertiesPartTwo : negated conditional → NO_COVERAGE |
if (Objects.nonNull(producer)) { |
509 | baseProperties.add( | |
510 | metadataString( | |
511 | producer, | |
512 | MetadataField.PRODUCER.getName(), | |
513 | indexInSong, | |
514 | String.valueOf(index), | |
515 | version)); | |
516 |
1
1. basePropertiesPartTwo : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
517 | } | |
518 | Object coProducer = valMap.get(MetadataField.CO_PRODUCER.getName()); | |
519 |
1
1. basePropertiesPartTwo : negated conditional → NO_COVERAGE |
if (Objects.nonNull(coProducer)) { |
520 | baseProperties.add( | |
521 | metadataString( | |
522 | coProducer, | |
523 | MetadataField.CO_PRODUCER.getName(), | |
524 | indexInSong, | |
525 | String.valueOf(index), | |
526 | version)); | |
527 |
1
1. basePropertiesPartTwo : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
528 | } | |
529 | Object recordingEngineer = valMap.get(MetadataField.RECORDING_ENGINEER.getName()); | |
530 |
1
1. basePropertiesPartTwo : negated conditional → NO_COVERAGE |
if (Objects.nonNull(recordingEngineer)) { |
531 | baseProperties.add( | |
532 | metadataString( | |
533 | recordingEngineer, | |
534 | MetadataField.RECORDING_ENGINEER.getName(), | |
535 | indexInSong, | |
536 | String.valueOf(index), | |
537 | version)); | |
538 |
1
1. basePropertiesPartTwo : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
539 | } | |
540 | Object releaseVersion = valMap.get(MetadataField.RELEASE_VERSION.getName()); | |
541 |
1
1. basePropertiesPartTwo : negated conditional → NO_COVERAGE |
if (Objects.nonNull(releaseVersion)) { |
542 | baseProperties.add( | |
543 | metadataInt( | |
544 | releaseVersion, | |
545 | MetadataField.RELEASE_VERSION.getName(), | |
546 | indexInSong, | |
547 | String.valueOf(index), | |
548 | version)); | |
549 |
1
1. basePropertiesPartTwo : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
550 | } | |
551 | Object parentalAdvisory = valMap.get(MetadataField.PARENTAL_ADVISORY.getName()); | |
552 |
1
1. basePropertiesPartTwo : negated conditional → NO_COVERAGE |
if (Objects.nonNull(parentalAdvisory)) { |
553 | baseProperties.add( | |
554 | metadataString( | |
555 | parentalAdvisory, | |
556 | MetadataField.PARENTAL_ADVISORY.getName(), | |
557 | indexInSong, | |
558 | String.valueOf(index), | |
559 | version)); | |
560 | } | |
561 | } | |
562 | ||
563 | private static void basePropertiesPartOne( | |
564 | Map<?, ?> valMap, | |
565 | List<BaseProperty> baseProperties, | |
566 | String indexInSong, | |
567 | int version, | |
568 | int subArtist) { | |
569 | Object series = valMap.get(MetadataField.SERIES.getName()); | |
570 |
2
1. basePropertiesPartOne : Replaced integer addition with subtraction → NO_COVERAGE 2. basePropertiesPartOne : Replaced integer subtraction with addition → NO_COVERAGE |
int index = baseProperties.size() + 1 - subArtist; |
571 |
1
1. basePropertiesPartOne : negated conditional → NO_COVERAGE |
if (Objects.nonNull(series)) { |
572 | baseProperties.add( | |
573 | metadataString( | |
574 | series, MetadataField.SERIES.getName(), indexInSong, String.valueOf(index), version)); | |
575 |
1
1. basePropertiesPartOne : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
576 | } | |
577 | Object collection = valMap.get(MetadataField.COLLECTION.getName()); | |
578 |
1
1. basePropertiesPartOne : negated conditional → NO_COVERAGE |
if (Objects.nonNull(collection)) { |
579 | baseProperties.add( | |
580 | metadataString( | |
581 | collection, | |
582 | MetadataField.COLLECTION.getName(), | |
583 | indexInSong, | |
584 | String.valueOf(index), | |
585 | version)); | |
586 |
1
1. basePropertiesPartOne : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
587 | } | |
588 | Object set = valMap.get(MetadataField.SET.getName()); | |
589 |
1
1. basePropertiesPartOne : negated conditional → NO_COVERAGE |
if (Objects.nonNull(set)) { |
590 | baseProperties.add( | |
591 | metadataString( | |
592 | set, MetadataField.SET.getName(), indexInSong, String.valueOf(index), version)); | |
593 |
1
1. basePropertiesPartOne : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
594 | } | |
595 | Object mood = valMap.get(MetadataField.MOOD.getName()); | |
596 |
1
1. basePropertiesPartOne : negated conditional → NO_COVERAGE |
if (Objects.nonNull(mood)) { |
597 | baseProperties.add( | |
598 | metadataString( | |
599 | mood, MetadataField.MOOD.getName(), indexInSong, String.valueOf(index), version)); | |
600 |
1
1. basePropertiesPartOne : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
601 | } | |
602 | Object lyrics = valMap.get(MetadataField.LYRICS.getName()); | |
603 |
1
1. basePropertiesPartOne : negated conditional → NO_COVERAGE |
if (Objects.nonNull(lyrics)) { |
604 | baseProperties.add( | |
605 | metadataURL( | |
606 | lyrics, MetadataField.LYRICS.getName(), indexInSong, String.valueOf(index), version)); | |
607 |
1
1. basePropertiesPartOne : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
608 | } | |
609 | Object lyricists = valMap.get(MetadataField.LYRICISTS.getName()); | |
610 |
1
1. basePropertiesPartOne : negated conditional → NO_COVERAGE |
if (Objects.nonNull(lyricists)) { |
611 | baseProperties.add( | |
612 | metadataArrayString( | |
613 | lyricists, | |
614 | MetadataField.LYRICISTS.getName(), | |
615 | indexInSong, | |
616 | String.valueOf(index), | |
617 | version)); | |
618 |
1
1. basePropertiesPartOne : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
619 | } | |
620 | Object specialThanks = valMap.get(MetadataField.SPECIAL_THANKS.getName()); | |
621 |
1
1. basePropertiesPartOne : negated conditional → NO_COVERAGE |
if (Objects.nonNull(specialThanks)) { |
622 | baseProperties.add( | |
623 | metadataArrayString( | |
624 | specialThanks, | |
625 | MetadataField.SPECIAL_THANKS.getName(), | |
626 | indexInSong, | |
627 | String.valueOf(index), | |
628 | version)); | |
629 |
1
1. basePropertiesPartOne : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
630 | } | |
631 | Object visualArtist = valMap.get(MetadataField.VISUAL_ARTIST.getName()); | |
632 |
1
1. basePropertiesPartOne : negated conditional → NO_COVERAGE |
if (Objects.nonNull(visualArtist)) { |
633 | baseProperties.add( | |
634 | metadataString( | |
635 | visualArtist, | |
636 | MetadataField.VISUAL_ARTIST.getName(), | |
637 | indexInSong, | |
638 | String.valueOf(index), | |
639 | version)); | |
640 |
1
1. basePropertiesPartOne : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
641 | } | |
642 | Object distributor = valMap.get(MetadataField.DISTRIBUTOR.getName()); | |
643 |
1
1. basePropertiesPartOne : negated conditional → NO_COVERAGE |
if (Objects.nonNull(distributor)) { |
644 | baseProperties.add( | |
645 | metadataString( | |
646 | distributor, | |
647 | MetadataField.DISTRIBUTOR.getName(), | |
648 | indexInSong, | |
649 | String.valueOf(index), | |
650 | version)); | |
651 |
1
1. basePropertiesPartOne : Changed increment from 1 to -1 → NO_COVERAGE |
index++; |
652 | } | |
653 | Object releaseDate = valMap.get(MetadataField.RELEASE_DATE.getName()); | |
654 |
1
1. basePropertiesPartOne : negated conditional → NO_COVERAGE |
if (Objects.nonNull(releaseDate)) { |
655 | baseProperties.add( | |
656 | metadataString( | |
657 | releaseDate, | |
658 | MetadataField.RELEASE_DATE.getName(), | |
659 | indexInSong, | |
660 | String.valueOf(index), | |
661 | version)); | |
662 | } | |
663 | } | |
664 | ||
665 | private static void filesVerOneSingle( | |
666 | Object files, List<BaseProperty> requireProperties, int version) { | |
667 | BaseProperty filesProperty = | |
668 | BaseProperty.builder() | |
669 | .valid(false) | |
670 | .property(MetadataField.FILES.getName()) | |
671 | .format(FormatFieldType.ARRAY.getValue()) | |
672 | .index("14") | |
673 | .build(); | |
674 | List<BaseProperty> requirePropertiesInFile = new ArrayList<>(); | |
675 |
3
1. filesVerOneSingle : negated conditional → NO_COVERAGE 2. filesVerOneSingle : negated conditional → NO_COVERAGE 3. filesVerOneSingle : negated conditional → NO_COVERAGE |
if (Objects.nonNull(files) && files instanceof ArrayList<?> fileList && !fileList.isEmpty()) { |
676 | int indexInFile = 1; | |
677 | for (Object file : fileList) { | |
678 |
1
1. filesVerOneSingle : negated conditional → NO_COVERAGE |
if (file instanceof HashMap<?, ?> fileMap) { |
679 | String index = filesProperty.getIndex() + "." + indexInFile; | |
680 | BaseProperty nameFile = | |
681 | MetadataCIP25Utils.nameFile(fileMap.get(MetadataField.NAME.getName()), version); | |
682 |
1
1. filesVerOneSingle : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setIndex → NO_COVERAGE |
nameFile.setIndex(index + ".1"); |
683 | requirePropertiesInFile.add(nameFile); | |
684 | BaseProperty srcFile = | |
685 | MetadataCIP25Utils.srcFile(fileMap.get(MetadataField.SRC.getName()), version); | |
686 |
1
1. filesVerOneSingle : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setIndex → NO_COVERAGE |
srcFile.setIndex(index + ".2"); |
687 | requirePropertiesInFile.add(srcFile); | |
688 | BaseProperty mediaTypeFile = | |
689 | MetadataCIP25Utils.mediaTypeFile( | |
690 | fileMap.get(MetadataField.MEDIA_TYPE.getName()), version); | |
691 |
1
1. filesVerOneSingle : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setIndex → NO_COVERAGE |
mediaTypeFile.setIndex(index + ".3"); |
692 | requirePropertiesInFile.add(mediaTypeFile); | |
693 |
1
1. filesVerOneSingle : Changed increment from 1 to -1 → NO_COVERAGE |
indexInFile++; |
694 | } | |
695 | } | |
696 |
1
1. filesVerOneSingle : negated conditional → NO_COVERAGE |
if (version == 0) { |
697 |
1
1. filesVerOneSingle : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
filesProperty.setValid(null); |
698 |
1
1. filesVerOneSingle : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
filesProperty.setFormat(null); |
699 | } else { | |
700 |
1
1. filesVerOneSingle : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
filesProperty.setValid( |
701 | requirePropertiesInFile.stream() | |
702 |
2
1. lambda$filesVerOneSingle$1 : replaced boolean return with false for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$filesVerOneSingle$1 → NO_COVERAGE 2. lambda$filesVerOneSingle$1 : replaced boolean return with true for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$filesVerOneSingle$1 → NO_COVERAGE |
.allMatch(baseProperty -> baseProperty.getValid().equals(true))); |
703 | } | |
704 | requireProperties.add(filesProperty); | |
705 | requireProperties.addAll(requirePropertiesInFile); | |
706 | } else { | |
707 | requireProperties.add(filesProperty); | |
708 |
1
1. filesVerOneSingle : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::defaultFiles → NO_COVERAGE |
defaultFiles(version, requireProperties, filesProperty.getIndex(), false); |
709 | } | |
710 | } | |
711 | ||
712 | private static void filesMusicVersionIncorrect( | |
713 | Object files, List<BaseProperty> requireProperties) { | |
714 | requireProperties.add( | |
715 | BaseProperty.builder() | |
716 | .valid(null) | |
717 | .property(MetadataField.FILES.getName()) | |
718 | .format(null) | |
719 | .index("7") | |
720 | .build()); | |
721 |
3
1. filesMusicVersionIncorrect : negated conditional → NO_COVERAGE 2. filesMusicVersionIncorrect : negated conditional → NO_COVERAGE 3. filesMusicVersionIncorrect : negated conditional → NO_COVERAGE |
if (Objects.nonNull(files) && files instanceof ArrayList<?> fileList && !fileList.isEmpty()) { |
722 | int indexInFile = 1; | |
723 | for (Object file : fileList) { | |
724 |
1
1. filesMusicVersionIncorrect : negated conditional → NO_COVERAGE |
if (file instanceof HashMap<?, ?> fileMap) { |
725 | String index = "7." + indexInFile; | |
726 | BaseProperty nameFile = | |
727 | MetadataCIP25Utils.nameFile(fileMap.get(MetadataField.NAME.getName()), 0); | |
728 |
1
1. filesMusicVersionIncorrect : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setIndex → NO_COVERAGE |
nameFile.setIndex(index + ".1"); |
729 | requireProperties.add(nameFile); | |
730 | BaseProperty srcFile = | |
731 | MetadataCIP25Utils.srcFile(fileMap.get(MetadataField.SRC.getName()), 0); | |
732 |
1
1. filesMusicVersionIncorrect : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setIndex → NO_COVERAGE |
srcFile.setIndex(index + ".2"); |
733 | requireProperties.add(srcFile); | |
734 | BaseProperty mediaTypeFile = | |
735 | MetadataCIP25Utils.mediaTypeFile(fileMap.get(MetadataField.MEDIA_TYPE.getName()), 0); | |
736 |
1
1. filesMusicVersionIncorrect : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setIndex → NO_COVERAGE |
mediaTypeFile.setIndex(index + ".3"); |
737 | requireProperties.add(mediaTypeFile); | |
738 |
1
1. filesMusicVersionIncorrect : Changed increment from 1 to -1 → NO_COVERAGE |
indexInFile++; |
739 | } | |
740 | } | |
741 | } | |
742 | } | |
743 | ||
744 | private static void filesVerOneMultiple( | |
745 | Object files, List<BaseProperty> requireProperties, int version) { | |
746 | BaseProperty filesProperty = | |
747 | BaseProperty.builder() | |
748 | .valid(false) | |
749 | .property(MetadataField.FILES.getName()) | |
750 | .format(FormatFieldType.ARRAY.getValue()) | |
751 | .index("7") | |
752 | .build(); | |
753 | List<BaseProperty> requirePropertiesInFile = new ArrayList<>(); | |
754 |
3
1. filesVerOneMultiple : negated conditional → NO_COVERAGE 2. filesVerOneMultiple : negated conditional → NO_COVERAGE 3. filesVerOneMultiple : negated conditional → NO_COVERAGE |
if (Objects.nonNull(files) && files instanceof ArrayList<?> fileList && !fileList.isEmpty()) { |
755 | int indexInFile = 1; | |
756 | List<BaseProperty> requirePropertiesPerFile; | |
757 | for (Object file : fileList) { | |
758 |
1
1. filesVerOneMultiple : negated conditional → NO_COVERAGE |
if (file instanceof HashMap<?, ?> fileMap) { |
759 | requirePropertiesPerFile = new ArrayList<>(); | |
760 | String index = filesProperty.getIndex() + "." + indexInFile; | |
761 | BaseProperty nameFile = | |
762 | MetadataCIP25Utils.nameFile(fileMap.get(MetadataField.NAME.getName()), version); | |
763 |
1
1. filesVerOneMultiple : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setIndex → NO_COVERAGE |
nameFile.setIndex(index + ".1"); |
764 | requirePropertiesPerFile.add(nameFile); | |
765 | BaseProperty srcFile = | |
766 | MetadataCIP25Utils.srcFile(fileMap.get(MetadataField.SRC.getName()), version); | |
767 |
1
1. filesVerOneMultiple : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setIndex → NO_COVERAGE |
srcFile.setIndex(index + ".2"); |
768 | requirePropertiesPerFile.add(srcFile); | |
769 | BaseProperty mediaTypeFile = | |
770 | MetadataCIP25Utils.mediaTypeFile( | |
771 | fileMap.get(MetadataField.MEDIA_TYPE.getName()), version); | |
772 |
1
1. filesVerOneMultiple : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setIndex → NO_COVERAGE |
mediaTypeFile.setIndex(index + ".3"); |
773 | requirePropertiesPerFile.add(mediaTypeFile); | |
774 | int subArtistOne = | |
775 | artists( | |
776 | fileMap.get(MetadataField.ARTISTS.getName()), | |
777 | requirePropertiesPerFile, | |
778 | index + ".4", | |
779 | version); | |
780 | requirePropertiesPerFile.add( | |
781 | trackNumber( | |
782 | fileMap.get(MetadataField.TRACK_NUMBER.getName()), index + ".5", version)); | |
783 | requirePropertiesPerFile.add( | |
784 | songTitle(fileMap.get(MetadataField.SONG_TITLE.getName()), index + ".6", version)); | |
785 | requirePropertiesPerFile.add( | |
786 | songDuration( | |
787 | fileMap.get(MetadataField.SONG_DURATION.getName()), index + ".7", version)); | |
788 | requirePropertiesPerFile.add( | |
789 | genres(fileMap.get(MetadataField.GENRES.getName()), index + ".8", version)); | |
790 | requirePropertiesPerFile.add( | |
791 | copyright(fileMap.get(MetadataField.COPYRIGHT.getName()), index + ".9", version)); | |
792 | int subArtistTwo = | |
793 | contributingArtists( | |
794 | fileMap.get(MetadataField.CONTRIBUTING_ARTISTS.getName()), | |
795 | requirePropertiesPerFile, | |
796 | index + ".10", | |
797 | version); | |
798 | int subArtistThree = | |
799 | featuredArtist( | |
800 | fileMap.get(MetadataField.FEATURED_ARTIST.getName()), | |
801 | requirePropertiesPerFile, | |
802 | index + ".11", | |
803 | version); | |
804 |
2
1. filesVerOneMultiple : Replaced integer addition with subtraction → NO_COVERAGE 2. filesVerOneMultiple : Replaced integer addition with subtraction → NO_COVERAGE |
int subArtist = subArtistOne + subArtistTwo + subArtistThree; |
805 |
1
1. filesVerOneMultiple : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::basePropertiesPartOne → NO_COVERAGE |
basePropertiesPartOne(fileMap, requirePropertiesPerFile, index, version, subArtist); |
806 |
1
1. filesVerOneMultiple : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::basePropertiesPartTwo → NO_COVERAGE |
basePropertiesPartTwo(fileMap, requirePropertiesPerFile, index, version, subArtist); |
807 |
1
1. filesVerOneMultiple : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::basePropertiesPartThree → NO_COVERAGE |
basePropertiesPartThree(fileMap, requirePropertiesPerFile, index, version, subArtist); |
808 | requirePropertiesInFile.addAll(requirePropertiesPerFile); | |
809 |
1
1. filesVerOneMultiple : Changed increment from 1 to -1 → NO_COVERAGE |
indexInFile++; |
810 | } | |
811 | } | |
812 |
1
1. filesVerOneMultiple : negated conditional → NO_COVERAGE |
if (version == 0) { |
813 |
1
1. filesVerOneMultiple : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
filesProperty.setValid(null); |
814 |
1
1. filesVerOneMultiple : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
filesProperty.setFormat(null); |
815 | } else { | |
816 |
1
1. filesVerOneMultiple : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
filesProperty.setValid( |
817 | requirePropertiesInFile.stream() | |
818 |
2
1. lambda$filesVerOneMultiple$2 : replaced boolean return with true for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$filesVerOneMultiple$2 → NO_COVERAGE 2. lambda$filesVerOneMultiple$2 : replaced boolean return with false for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$filesVerOneMultiple$2 → NO_COVERAGE |
.allMatch(baseProperty -> baseProperty.getValid().equals(true))); |
819 | } | |
820 | requireProperties.add(filesProperty); | |
821 | requireProperties.addAll(requirePropertiesInFile); | |
822 | } else { | |
823 | requireProperties.add(filesProperty); | |
824 |
1
1. filesVerOneMultiple : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::defaultFiles → NO_COVERAGE |
defaultFiles(version, requireProperties, filesProperty.getIndex(), true); |
825 | } | |
826 | } | |
827 | ||
828 | private static void filesVerTwo(Object files, List<BaseProperty> requireProperties, int version) { | |
829 | BaseProperty filesProperty = | |
830 | BaseProperty.builder() | |
831 | .valid(false) | |
832 | .property(MetadataField.FILES.getName()) | |
833 | .format(FormatFieldType.ARRAY.getValue()) | |
834 | .index("8") | |
835 | .build(); | |
836 | List<BaseProperty> requirePropertiesInFile = new ArrayList<>(); | |
837 |
3
1. filesVerTwo : negated conditional → NO_COVERAGE 2. filesVerTwo : negated conditional → NO_COVERAGE 3. filesVerTwo : negated conditional → NO_COVERAGE |
if (Objects.nonNull(files) && files instanceof ArrayList<?> fileList && !fileList.isEmpty()) { |
838 | int indexInFile = 1; | |
839 | for (Object file : fileList) { | |
840 |
1
1. filesVerTwo : negated conditional → NO_COVERAGE |
if (file instanceof HashMap<?, ?> fileMap) { |
841 | String index = filesProperty.getIndex() + "." + indexInFile; | |
842 | BaseProperty nameFile = | |
843 | MetadataCIP25Utils.nameFile(fileMap.get(MetadataField.NAME.getName()), version); | |
844 |
1
1. filesVerTwo : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setIndex → NO_COVERAGE |
nameFile.setIndex(index + ".1"); |
845 | requirePropertiesInFile.add(nameFile); | |
846 | BaseProperty srcFile = | |
847 | MetadataCIP25Utils.srcFile(fileMap.get(MetadataField.SRC.getName()), version); | |
848 |
1
1. filesVerTwo : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setIndex → NO_COVERAGE |
srcFile.setIndex(index + ".2"); |
849 | requirePropertiesInFile.add(srcFile); | |
850 | BaseProperty mediaTypeFile = | |
851 | MetadataCIP25Utils.mediaTypeFile( | |
852 | fileMap.get(MetadataField.MEDIA_TYPE.getName()), version); | |
853 |
1
1. filesVerTwo : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setIndex → NO_COVERAGE |
mediaTypeFile.setIndex(index + ".3"); |
854 | requirePropertiesInFile.add(mediaTypeFile); | |
855 | Object song = fileMap.get(MetadataField.SONG.getName()); | |
856 | BaseProperty songProp = | |
857 | BaseProperty.builder() | |
858 | .valid(false) | |
859 | .index(index + ".4") | |
860 | .property(MetadataField.SONG.getName()) | |
861 | .build(); | |
862 | String indexInSong = songProp.getIndex(); | |
863 |
2
1. filesVerTwo : negated conditional → NO_COVERAGE 2. filesVerTwo : negated conditional → NO_COVERAGE |
if (Objects.nonNull(song) && song instanceof HashMap<?, ?> songMap) { |
864 | List<BaseProperty> requirePropertiesInSong = new ArrayList<>(); | |
865 | int subArtistOne = | |
866 | artists( | |
867 | songMap.get(MetadataField.ARTISTS.getName()), | |
868 | requirePropertiesInSong, | |
869 | indexInSong + ".1", | |
870 | version); | |
871 | requirePropertiesInSong.add( | |
872 | trackNumber( | |
873 | songMap.get(MetadataField.TRACK_NUMBER.getName()), | |
874 | indexInSong + ".2", | |
875 | version)); | |
876 | requirePropertiesInSong.add( | |
877 | songTitle( | |
878 | songMap.get(MetadataField.SONG_TITLE.getName()), indexInSong + ".3", version)); | |
879 | requirePropertiesInSong.add( | |
880 | songDuration( | |
881 | songMap.get(MetadataField.SONG_DURATION.getName()), | |
882 | indexInSong + ".4", | |
883 | version)); | |
884 | requirePropertiesInSong.add( | |
885 | genres(songMap.get(MetadataField.GENRES.getName()), indexInSong + ".5", version)); | |
886 | requirePropertiesInSong.add( | |
887 | copyright( | |
888 | songMap.get(MetadataField.COPYRIGHT.getName()), indexInSong + ".6", version)); | |
889 | int subArtistTwo = | |
890 | contributingArtists( | |
891 | songMap.get(MetadataField.CONTRIBUTING_ARTISTS.getName()), | |
892 | requirePropertiesInSong, | |
893 | indexInSong + ".7", | |
894 | version); | |
895 | int subArtistThree = | |
896 | featuredArtist( | |
897 | songMap.get(MetadataField.FEATURED_ARTIST.getName()), | |
898 | requirePropertiesInSong, | |
899 | indexInSong + ".8", | |
900 | version); | |
901 |
2
1. filesVerTwo : Replaced integer addition with subtraction → NO_COVERAGE 2. filesVerTwo : Replaced integer addition with subtraction → NO_COVERAGE |
int subArtist = subArtistOne + subArtistTwo + subArtistThree; |
902 |
1
1. filesVerTwo : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::basePropertiesPartOne → NO_COVERAGE |
basePropertiesPartOne( |
903 | songMap, requirePropertiesInSong, indexInSong, version, subArtist); | |
904 |
1
1. filesVerTwo : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::basePropertiesPartTwo → NO_COVERAGE |
basePropertiesPartTwo( |
905 | songMap, requirePropertiesInSong, indexInSong, version, subArtist); | |
906 |
1
1. filesVerTwo : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::basePropertiesPartThree → NO_COVERAGE |
basePropertiesPartThree( |
907 | songMap, requirePropertiesInSong, indexInSong, version, subArtist); | |
908 |
1
1. filesVerTwo : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
songProp.setValid( |
909 | requirePropertiesInSong.stream() | |
910 |
2
1. lambda$filesVerTwo$3 : replaced boolean return with false for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$filesVerTwo$3 → NO_COVERAGE 2. lambda$filesVerTwo$3 : replaced boolean return with true for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$filesVerTwo$3 → NO_COVERAGE |
.allMatch(baseProperty -> baseProperty.getValid().equals(true))); |
911 | requirePropertiesInFile.add(songProp); | |
912 |
1
1. filesVerTwo : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
filesProperty.setValid( |
913 | requirePropertiesInFile.stream() | |
914 |
2
1. lambda$filesVerTwo$4 : replaced boolean return with false for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$filesVerTwo$4 → NO_COVERAGE 2. lambda$filesVerTwo$4 : replaced boolean return with true for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$filesVerTwo$4 → NO_COVERAGE |
.allMatch(baseProperty -> baseProperty.getValid().equals(true))); |
915 | requirePropertiesInFile.addAll(requirePropertiesInSong); | |
916 | } else { | |
917 | List<BaseProperty> requirePropertiesInSong = new ArrayList<>(); | |
918 |
1
1. filesVerTwo : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::defaultSong → NO_COVERAGE |
defaultSong(version, requirePropertiesInSong, indexInSong); |
919 | requirePropertiesInFile.add(songProp); | |
920 | requirePropertiesInFile.addAll(requirePropertiesInSong); | |
921 |
1
1. filesVerTwo : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
filesProperty.setValid(false); |
922 | } | |
923 |
1
1. filesVerTwo : Changed increment from 1 to -1 → NO_COVERAGE |
indexInFile++; |
924 | } | |
925 | } | |
926 |
1
1. filesVerTwo : negated conditional → NO_COVERAGE |
if (version == 0) { |
927 |
1
1. filesVerTwo : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
filesProperty.setValid(null); |
928 |
1
1. filesVerTwo : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
filesProperty.setFormat(null); |
929 | } | |
930 | requireProperties.add(filesProperty); | |
931 | requireProperties.addAll(requirePropertiesInFile); | |
932 | } else { | |
933 | requireProperties.add(filesProperty); | |
934 |
1
1. filesVerTwo : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::defaultFiles → NO_COVERAGE |
defaultFiles(version, requireProperties, filesProperty.getIndex(), false); |
935 | BaseProperty songProp = | |
936 | BaseProperty.builder() | |
937 | .valid(false) | |
938 | .index(filesProperty.getIndex() + ".1.4") | |
939 | .property(MetadataField.SONG.getName()) | |
940 | .build(); | |
941 | List<BaseProperty> requirePropertiesInSong = new ArrayList<>(); | |
942 | String indexInSong = songProp.getIndex(); | |
943 |
1
1. filesVerTwo : removed call to org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::defaultSong → NO_COVERAGE |
defaultSong(version, requirePropertiesInSong, indexInSong); |
944 | requireProperties.add(songProp); | |
945 | requireProperties.addAll(requirePropertiesInSong); | |
946 | } | |
947 | } | |
948 | ||
949 | private static void defaultFiles( | |
950 | int version, List<BaseProperty> requireProperties, String indexOfFile, boolean isSong) { | |
951 | String index = indexOfFile + ".1"; | |
952 | BaseProperty nameFile = MetadataCIP25Utils.nameFile(null, version); | |
953 |
1
1. defaultFiles : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setIndex → NO_COVERAGE |
nameFile.setIndex(index + ".1"); |
954 | requireProperties.add(nameFile); | |
955 | BaseProperty srcFile = MetadataCIP25Utils.srcFile(null, version); | |
956 |
1
1. defaultFiles : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setIndex → NO_COVERAGE |
srcFile.setIndex(index + ".2"); |
957 | requireProperties.add(srcFile); | |
958 | BaseProperty mediaTypeFile = MetadataCIP25Utils.mediaTypeFile(null, version); | |
959 |
1
1. defaultFiles : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setIndex → NO_COVERAGE |
mediaTypeFile.setIndex(index + ".3"); |
960 | requireProperties.add(mediaTypeFile); | |
961 |
1
1. defaultFiles : negated conditional → NO_COVERAGE |
if (isSong) { |
962 | artists(null, requireProperties, index + ".4", version); | |
963 | requireProperties.add(trackNumber(null, index + ".5", version)); | |
964 | requireProperties.add(songTitle(null, index + ".6", version)); | |
965 | requireProperties.add(songDuration(null, index + ".7", version)); | |
966 | requireProperties.add(genres(null, index + ".8", version)); | |
967 | requireProperties.add(copyright(null, index + ".9", version)); | |
968 | } | |
969 | } | |
970 | ||
971 | private static void defaultSong( | |
972 | int version, List<BaseProperty> requirePropertiesInSong, String indexInSong) { | |
973 | artists(null, requirePropertiesInSong, indexInSong + ".1", version); | |
974 | requirePropertiesInSong.add(trackNumber(null, indexInSong + ".2", version)); | |
975 | requirePropertiesInSong.add(songTitle(null, indexInSong + ".3", version)); | |
976 | requirePropertiesInSong.add(songDuration(null, indexInSong + ".4", version)); | |
977 | requirePropertiesInSong.add(genres(null, indexInSong + ".5", version)); | |
978 | requirePropertiesInSong.add(copyright(null, indexInSong + ".6", version)); | |
979 | } | |
980 | ||
981 | private static BaseProperty links(Object links, String parentIndex, String index, int version) { | |
982 | FormatFieldType valueFormat = MetadataFieldUtils.getFormatTypeByObject(links); | |
983 | BaseProperty baseProperty = | |
984 | BaseProperty.builder() | |
985 | .value(links) | |
986 | .format(FormatFieldType.MAP_STRING_STRING.getValue()) | |
987 | .property(MetadataField.LINKS.getName()) | |
988 |
1
1. links : negated conditional → NO_COVERAGE |
.index(Objects.isNull(parentIndex) ? index : parentIndex + "." + index) |
989 | .valid(valueFormat.equals(FormatFieldType.MAP_STRING_STRING)) | |
990 | .valueFormat(valueFormat.getValue()) | |
991 | .build(); | |
992 | ||
993 |
1
1. links : negated conditional → NO_COVERAGE |
if (version == 0) { |
994 |
1
1. links : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
baseProperty.setValid(null); |
995 |
1
1. links : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
baseProperty.setFormat(null); |
996 |
1
1. links : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValueFormat → NO_COVERAGE |
baseProperty.setValueFormat(null); |
997 | } | |
998 |
1
1. links : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::links → NO_COVERAGE |
return baseProperty; |
999 | } | |
1000 | ||
1001 | private static BaseProperty metadataBool( | |
1002 | Object val, String property, String parentIndex, String index, int version) { | |
1003 | FormatFieldType valueFormat = MetadataFieldUtils.getFormatTypeByObject(val); | |
1004 | BaseProperty baseProperty = | |
1005 | BaseProperty.builder() | |
1006 | .value(val) | |
1007 | .format(FormatFieldType.BOOLEAN.getValue()) | |
1008 | .property(property) | |
1009 |
1
1. metadataBool : negated conditional → NO_COVERAGE |
.index(Objects.isNull(parentIndex) ? index : parentIndex + "." + index) |
1010 | .valid(valueFormat.equals(FormatFieldType.BOOLEAN)) | |
1011 | .valueFormat(valueFormat.getValue()) | |
1012 | .build(); | |
1013 |
1
1. metadataBool : negated conditional → NO_COVERAGE |
if (version == 0) { |
1014 |
1
1. metadataBool : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
baseProperty.setValid(null); |
1015 |
1
1. metadataBool : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
baseProperty.setFormat(null); |
1016 |
1
1. metadataBool : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValueFormat → NO_COVERAGE |
baseProperty.setValueFormat(null); |
1017 | } | |
1018 |
1
1. metadataBool : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::metadataBool → NO_COVERAGE |
return baseProperty; |
1019 | } | |
1020 | ||
1021 | private static BaseProperty metadataInt( | |
1022 | Object val, String property, String parentIndex, String index, int version) { | |
1023 | FormatFieldType valueFormat = MetadataFieldUtils.getFormatTypeByObject(val); | |
1024 | BaseProperty baseProperty = | |
1025 | BaseProperty.builder() | |
1026 | .value(val) | |
1027 | .format(FormatFieldType.INTEGER.getValue()) | |
1028 | .property(property) | |
1029 |
1
1. metadataInt : negated conditional → NO_COVERAGE |
.index(Objects.isNull(parentIndex) ? index : parentIndex + "." + index) |
1030 | .valid(valueFormat.equals(FormatFieldType.INTEGER)) | |
1031 | .valueFormat(valueFormat.getValue()) | |
1032 | .build(); | |
1033 |
1
1. metadataInt : negated conditional → NO_COVERAGE |
if (version == 0) { |
1034 |
1
1. metadataInt : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
baseProperty.setValid(null); |
1035 |
1
1. metadataInt : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
baseProperty.setFormat(null); |
1036 |
1
1. metadataInt : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValueFormat → NO_COVERAGE |
baseProperty.setValueFormat(null); |
1037 | } | |
1038 |
1
1. metadataInt : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::metadataInt → NO_COVERAGE |
return baseProperty; |
1039 | } | |
1040 | ||
1041 | private static BaseProperty metadataString( | |
1042 | Object val, String property, String parentIndex, String index, int version) { | |
1043 | FormatFieldType valueFormat = MetadataFieldUtils.getFormatTypeByObject(val); | |
1044 | boolean isValid = | |
1045 |
1
1. metadataString : negated conditional → NO_COVERAGE |
FormatFieldType.STRING.equals(valueFormat) |
1046 |
1
1. metadataString : negated conditional → NO_COVERAGE |
|| FormatFieldType.STRING.equals(valueFormat.getParentType()); |
1047 | BaseProperty baseProperty = | |
1048 | BaseProperty.builder() | |
1049 | .value(val) | |
1050 | .format(FormatFieldType.STRING.getValue()) | |
1051 | .property(property) | |
1052 |
1
1. metadataString : negated conditional → NO_COVERAGE |
.index(Objects.isNull(parentIndex) ? index : parentIndex + "." + index) |
1053 | .valid(isValid) | |
1054 |
1
1. metadataString : negated conditional → NO_COVERAGE |
.valueFormat(isValid ? FormatFieldType.STRING.getValue() : valueFormat.getValue()) |
1055 | .build(); | |
1056 |
1
1. metadataString : negated conditional → NO_COVERAGE |
if (version == 0) { |
1057 |
1
1. metadataString : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
baseProperty.setValid(null); |
1058 |
1
1. metadataString : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
baseProperty.setFormat(null); |
1059 |
1
1. metadataString : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValueFormat → NO_COVERAGE |
baseProperty.setValueFormat(null); |
1060 | } | |
1061 |
1
1. metadataString : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::metadataString → NO_COVERAGE |
return baseProperty; |
1062 | } | |
1063 | ||
1064 | private static BaseProperty metadataURL( | |
1065 | Object val, String property, String parentIndex, String index, int version) { | |
1066 | FormatFieldType valueFormat = MetadataFieldUtils.getFormatTypeByObject(val); | |
1067 | boolean isValid = valueFormat.equals(FormatFieldType.URI); | |
1068 | BaseProperty baseProperty = | |
1069 | BaseProperty.builder() | |
1070 | .value(val) | |
1071 | .format(FormatFieldType.URL.getValue()) | |
1072 | .property(property) | |
1073 |
1
1. metadataURL : negated conditional → NO_COVERAGE |
.index(Objects.isNull(parentIndex) ? index : parentIndex + "." + index) |
1074 | .valid(isValid) | |
1075 |
1
1. metadataURL : negated conditional → NO_COVERAGE |
.valueFormat(isValid ? FormatFieldType.URL.getValue() : valueFormat.getValue()) |
1076 | .build(); | |
1077 |
1
1. metadataURL : negated conditional → NO_COVERAGE |
if (version == 0) { |
1078 |
1
1. metadataURL : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
baseProperty.setValid(null); |
1079 |
1
1. metadataURL : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
baseProperty.setFormat(null); |
1080 |
1
1. metadataURL : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValueFormat → NO_COVERAGE |
baseProperty.setValueFormat(null); |
1081 | } | |
1082 |
1
1. metadataURL : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::metadataURL → NO_COVERAGE |
return baseProperty; |
1083 | } | |
1084 | ||
1085 | private static BaseProperty metadataArrayString( | |
1086 | Object val, String property, String parentIndex, String index, int version) { | |
1087 | FormatFieldType valueFormat = MetadataFieldUtils.getFormatTypeByObject(val); | |
1088 | BaseProperty baseProperty = | |
1089 | BaseProperty.builder() | |
1090 | .value(val) | |
1091 | .format(FormatFieldType.ARRAY_STRING.getValue()) | |
1092 | .property(property) | |
1093 |
1
1. metadataArrayString : negated conditional → NO_COVERAGE |
.index(Objects.isNull(parentIndex) ? index : parentIndex + "." + index) |
1094 | .valid(valueFormat.equals(FormatFieldType.ARRAY_STRING)) | |
1095 | .valueFormat(valueFormat.getValue()) | |
1096 | .build(); | |
1097 |
1
1. metadataArrayString : negated conditional → NO_COVERAGE |
if (version == 0) { |
1098 |
1
1. metadataArrayString : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
baseProperty.setValid(null); |
1099 |
1
1. metadataArrayString : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
baseProperty.setFormat(null); |
1100 |
1
1. metadataArrayString : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValueFormat → NO_COVERAGE |
baseProperty.setValueFormat(null); |
1101 | } | |
1102 |
1
1. metadataArrayString : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::metadataArrayString → NO_COVERAGE |
return baseProperty; |
1103 | } | |
1104 | ||
1105 | private static BaseProperty metadataArrayOrString( | |
1106 | Object val, String property, String parentIndex, String index, int version) { | |
1107 | FormatFieldType valueFormat = MetadataFieldUtils.getFormatTypeByObject(val); | |
1108 | BaseProperty baseProperty = | |
1109 | BaseProperty.builder() | |
1110 | .value(val) | |
1111 | .format(FormatFieldType.STRING_OR_ARRAY_STRING.getValue()) | |
1112 | .property(property) | |
1113 |
1
1. metadataArrayOrString : negated conditional → NO_COVERAGE |
.index(Objects.isNull(parentIndex) ? index : parentIndex + "." + index) |
1114 | .valid( | |
1115 |
1
1. metadataArrayOrString : negated conditional → NO_COVERAGE |
FormatFieldType.STRING.equals(valueFormat) |
1116 |
1
1. metadataArrayOrString : negated conditional → NO_COVERAGE |
|| valueFormat.equals(FormatFieldType.ARRAY_STRING)) |
1117 | .valueFormat(valueFormat.getValue()) | |
1118 | .build(); | |
1119 |
1
1. metadataArrayOrString : negated conditional → NO_COVERAGE |
if (version == 0) { |
1120 |
1
1. metadataArrayOrString : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
baseProperty.setValid(null); |
1121 |
1
1. metadataArrayOrString : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
baseProperty.setFormat(null); |
1122 |
1
1. metadataArrayOrString : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValueFormat → NO_COVERAGE |
baseProperty.setValueFormat(null); |
1123 | } | |
1124 |
1
1. metadataArrayOrString : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::metadataArrayOrString → NO_COVERAGE |
return baseProperty; |
1125 | } | |
1126 | ||
1127 | private static int artists( | |
1128 | Object artists, List<BaseProperty> requireProperties, String ind, int version) { | |
1129 | BaseProperty artistsProperty = | |
1130 | BaseProperty.builder() | |
1131 | .valid(false) | |
1132 | .property(MetadataField.ARTISTS.getName()) | |
1133 | .index(ind) | |
1134 | .format(FormatFieldType.ARRAY_ARTIST.getValue()) | |
1135 | .build(); | |
1136 | int subArtist = 0; | |
1137 |
2
1. artists : negated conditional → NO_COVERAGE 2. artists : negated conditional → NO_COVERAGE |
if (Objects.nonNull(artists) |
1138 | && artists instanceof ArrayList<?> artistList | |
1139 |
1
1. artists : negated conditional → NO_COVERAGE |
&& !artistList.isEmpty()) { |
1140 | List<BaseProperty> requirePropertiesInArtist = new ArrayList<>(); | |
1141 | int indexInArtist = 1; | |
1142 | for (Object artist : artistList) { | |
1143 |
1
1. artists : negated conditional → NO_COVERAGE |
if (artist instanceof HashMap<?, ?> artistMap) { |
1144 | String index = ind + "." + indexInArtist; | |
1145 | BaseProperty nameArtist = | |
1146 | metadataString( | |
1147 | artistMap.get(MetadataField.NAME.getName()), | |
1148 | MetadataField.NAME.getName(), | |
1149 | index, | |
1150 | "1", | |
1151 | version); | |
1152 | requirePropertiesInArtist.add(nameArtist); | |
1153 |
1
1. artists : Changed increment from 1 to -1 → NO_COVERAGE |
subArtist++; |
1154 | Object image = artistMap.get(MetadataField.IMAGE.getName()); | |
1155 |
1
1. artists : negated conditional → NO_COVERAGE |
if (Objects.nonNull(image)) { |
1156 | BaseProperty imageArtist = | |
1157 | metadataArrayOrString(image, MetadataField.IMAGE.getName(), index, "2", version); | |
1158 | requirePropertiesInArtist.add(imageArtist); | |
1159 |
1
1. artists : Changed increment from 1 to -1 → NO_COVERAGE |
subArtist++; |
1160 | } | |
1161 |
1
1. artists : Changed increment from 1 to -1 → NO_COVERAGE |
indexInArtist++; |
1162 | } | |
1163 | } | |
1164 |
1
1. artists : negated conditional → NO_COVERAGE |
if (version == 0) { |
1165 |
1
1. artists : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
artistsProperty.setValid(null); |
1166 |
1
1. artists : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
artistsProperty.setFormat(null); |
1167 | } else { | |
1168 |
1
1. artists : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
artistsProperty.setValid( |
1169 |
1
1. artists : negated conditional → NO_COVERAGE |
!requirePropertiesInArtist.isEmpty() |
1170 | && requirePropertiesInArtist.stream() | |
1171 |
3
1. lambda$artists$5 : replaced boolean return with true for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$artists$5 → NO_COVERAGE 2. lambda$artists$5 : replaced boolean return with false for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$artists$5 → NO_COVERAGE 3. artists : negated conditional → NO_COVERAGE |
.allMatch(baseProperty -> baseProperty.getValid().equals(true))); |
1172 | } | |
1173 | requireProperties.add(artistsProperty); | |
1174 | requireProperties.addAll(requirePropertiesInArtist); | |
1175 | } else { | |
1176 | requireProperties.add(artistsProperty); | |
1177 | BaseProperty nameArtist = | |
1178 | metadataString(null, MetadataField.NAME.getName(), ind + ".1", "1", version); | |
1179 | requireProperties.add(nameArtist); | |
1180 |
1
1. artists : Changed increment from 1 to -1 → NO_COVERAGE |
subArtist++; |
1181 | } | |
1182 |
1
1. artists : replaced int return with 0 for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::artists → NO_COVERAGE |
return subArtist; |
1183 | } | |
1184 | ||
1185 | private static int contributingArtists( | |
1186 | Object contributingArtists, List<BaseProperty> baseProperties, String ind, int version) { | |
1187 | int subArtist = 0; | |
1188 |
2
1. contributingArtists : negated conditional → NO_COVERAGE 2. contributingArtists : negated conditional → NO_COVERAGE |
if (Objects.nonNull(contributingArtists) |
1189 | && contributingArtists instanceof ArrayList<?> artistList | |
1190 |
1
1. contributingArtists : negated conditional → NO_COVERAGE |
&& !artistList.isEmpty()) { |
1191 | BaseProperty artistsProperty = | |
1192 | BaseProperty.builder() | |
1193 | .valid(false) | |
1194 | .property(MetadataField.CONTRIBUTING_ARTISTS.getName()) | |
1195 | .format(FormatFieldType.ARRAY.getValue()) | |
1196 | .index(ind) | |
1197 | .build(); | |
1198 | List<Boolean> validArtists = new ArrayList<>(); | |
1199 | int indexInArtist = 1; | |
1200 | for (Object artist : artistList) { | |
1201 |
1
1. contributingArtists : negated conditional → NO_COVERAGE |
if (artist instanceof HashMap<?, ?> artistMap) { |
1202 | String index = ind + "." + indexInArtist; | |
1203 | BaseProperty nameArtist = | |
1204 | metadataString( | |
1205 | artistMap.get(MetadataField.NAME.getName()), | |
1206 | MetadataField.NAME.getName(), | |
1207 | index, | |
1208 | "1", | |
1209 | version); | |
1210 | validArtists.add(nameArtist.getValid()); | |
1211 | baseProperties.add(nameArtist); | |
1212 |
1
1. contributingArtists : Changed increment from 1 to -1 → NO_COVERAGE |
subArtist++; |
1213 | Object image = artistMap.get(MetadataField.IMAGE.getName()); | |
1214 |
1
1. contributingArtists : negated conditional → NO_COVERAGE |
if (Objects.nonNull(image)) { |
1215 | BaseProperty imageArtist = | |
1216 | metadataArrayOrString(image, MetadataField.IMAGE.getName(), index, "2", version); | |
1217 | validArtists.add(imageArtist.getValid()); | |
1218 | baseProperties.add(imageArtist); | |
1219 |
1
1. contributingArtists : Changed increment from 1 to -1 → NO_COVERAGE |
subArtist++; |
1220 | } | |
1221 |
1
1. contributingArtists : Changed increment from 1 to -1 → NO_COVERAGE |
indexInArtist++; |
1222 | } | |
1223 | } | |
1224 |
1
1. contributingArtists : negated conditional → NO_COVERAGE |
if (version == 0) { |
1225 |
1
1. contributingArtists : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
artistsProperty.setValid(null); |
1226 |
1
1. contributingArtists : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
artistsProperty.setFormat(null); |
1227 | } else { | |
1228 |
1
1. contributingArtists : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
artistsProperty.setValid( |
1229 |
4
1. lambda$contributingArtists$6 : replaced boolean return with true for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$contributingArtists$6 → NO_COVERAGE 2. contributingArtists : negated conditional → NO_COVERAGE 3. contributingArtists : negated conditional → NO_COVERAGE 4. lambda$contributingArtists$6 : replaced boolean return with false for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$contributingArtists$6 → NO_COVERAGE |
!validArtists.isEmpty() && validArtists.stream().allMatch(valid -> valid.equals(true))); |
1230 | } | |
1231 | baseProperties.add(artistsProperty); | |
1232 | } | |
1233 |
1
1. contributingArtists : replaced int return with 0 for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::contributingArtists → NO_COVERAGE |
return subArtist; |
1234 | } | |
1235 | ||
1236 | private static int featuredArtist( | |
1237 | Object featuredArtist, List<BaseProperty> baseProperties, String ind, int version) { | |
1238 | int subArtist = 0; | |
1239 |
2
1. featuredArtist : negated conditional → NO_COVERAGE 2. featuredArtist : negated conditional → NO_COVERAGE |
if (Objects.nonNull(featuredArtist) && featuredArtist instanceof HashMap<?, ?> artistMap) { |
1240 | BaseProperty artistsProperty = | |
1241 | BaseProperty.builder() | |
1242 | .valid(false) | |
1243 | .property(MetadataField.FEATURED_ARTIST.getName()) | |
1244 | .format(FormatFieldType.ARTIST.getValue()) | |
1245 | .index(ind) | |
1246 | .build(); | |
1247 | List<Boolean> validArtists = new ArrayList<>(); | |
1248 | BaseProperty nameArtist = | |
1249 | metadataString( | |
1250 | artistMap.get(MetadataField.NAME.getName()), | |
1251 | MetadataField.NAME.getName(), | |
1252 | ind, | |
1253 | "1", | |
1254 | version); | |
1255 | validArtists.add(nameArtist.getValid()); | |
1256 | baseProperties.add(nameArtist); | |
1257 |
1
1. featuredArtist : Changed increment from 1 to -1 → NO_COVERAGE |
subArtist++; |
1258 | Object image = artistMap.get(MetadataField.IMAGE.getName()); | |
1259 |
1
1. featuredArtist : negated conditional → NO_COVERAGE |
if (Objects.nonNull(image)) { |
1260 | BaseProperty imageArtist = | |
1261 | metadataArrayOrString(image, MetadataField.IMAGE.getName(), ind, "2", version); | |
1262 | validArtists.add(imageArtist.getValid()); | |
1263 | baseProperties.add(imageArtist); | |
1264 |
1
1. featuredArtist : Changed increment from 1 to -1 → NO_COVERAGE |
subArtist++; |
1265 | } | |
1266 |
1
1. featuredArtist : negated conditional → NO_COVERAGE |
if (version == 0) { |
1267 |
1
1. featuredArtist : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
artistsProperty.setValid(null); |
1268 |
1
1. featuredArtist : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
artistsProperty.setFormat(null); |
1269 | } else { | |
1270 |
3
1. lambda$featuredArtist$7 : replaced boolean return with false for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$featuredArtist$7 → NO_COVERAGE 2. lambda$featuredArtist$7 : replaced boolean return with true for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$featuredArtist$7 → NO_COVERAGE 3. featuredArtist : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
artistsProperty.setValid(validArtists.stream().allMatch(valid -> valid.equals(true))); |
1271 | } | |
1272 | baseProperties.add(artistsProperty); | |
1273 | } | |
1274 |
1
1. featuredArtist : replaced int return with 0 for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::featuredArtist → NO_COVERAGE |
return subArtist; |
1275 | } | |
1276 | ||
1277 | private static BaseProperty copyright(Object copyright, String index, int version) { | |
1278 | FormatFieldType valueFormat = MetadataFieldUtils.getFormatTypeByObject(copyright); | |
1279 | boolean isValid = | |
1280 |
1
1. copyright : negated conditional → NO_COVERAGE |
FormatFieldType.STRING.equals(valueFormat) |
1281 |
1
1. copyright : negated conditional → NO_COVERAGE |
|| FormatFieldType.STRING.equals(valueFormat.getParentType()); |
1282 | BaseProperty baseProperty = | |
1283 | BaseProperty.builder() | |
1284 | .value(copyright) | |
1285 | .format(FormatFieldType.STRING.getValue()) | |
1286 | .property(MetadataField.COPYRIGHT.getName()) | |
1287 | .index(index) | |
1288 | .valid(isValid) | |
1289 |
1
1. copyright : negated conditional → NO_COVERAGE |
.valueFormat(isValid ? FormatFieldType.STRING.getValue() : valueFormat.getValue()) |
1290 | .build(); | |
1291 |
1
1. copyright : negated conditional → NO_COVERAGE |
if (version == 0) { |
1292 |
1
1. copyright : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
baseProperty.setValid(null); |
1293 |
1
1. copyright : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
baseProperty.setFormat(null); |
1294 |
1
1. copyright : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValueFormat → NO_COVERAGE |
baseProperty.setValueFormat(null); |
1295 | } | |
1296 |
1
1. copyright : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::copyright → NO_COVERAGE |
return baseProperty; |
1297 | } | |
1298 | ||
1299 | private static BaseProperty genres(Object genres, String index, int version) { | |
1300 | FormatFieldType valueFormat = MetadataFieldUtils.getFormatTypeByObject(genres); | |
1301 | BaseProperty baseProperty = | |
1302 | BaseProperty.builder() | |
1303 | .value(genres) | |
1304 | .format(FormatFieldType.ARRAY_STRING.getValue()) | |
1305 | .property(MetadataField.GENRES.getName()) | |
1306 | .index(index) | |
1307 | .valid( | |
1308 |
2
1. genres : negated conditional → NO_COVERAGE 2. genres : negated conditional → NO_COVERAGE |
valueFormat.equals(FormatFieldType.ARRAY_STRING) |
1309 | && genres instanceof ArrayList<?> genresArr | |
1310 |
2
1. genres : negated conditional → NO_COVERAGE 2. genres : changed conditional boundary → NO_COVERAGE |
&& genresArr.size() <= 3) |
1311 | .valueFormat(valueFormat.getValue()) | |
1312 | .build(); | |
1313 |
1
1. genres : negated conditional → NO_COVERAGE |
if (version == 0) { |
1314 |
1
1. genres : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
baseProperty.setValid(null); |
1315 |
1
1. genres : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
baseProperty.setFormat(null); |
1316 |
1
1. genres : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValueFormat → NO_COVERAGE |
baseProperty.setValueFormat(null); |
1317 | } | |
1318 |
1
1. genres : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::genres → NO_COVERAGE |
return baseProperty; |
1319 | } | |
1320 | ||
1321 | private static BaseProperty songDuration(Object songDuration, String index, int version) { | |
1322 | FormatFieldType valueFormat = MetadataFieldUtils.getFormatTypeByObject(songDuration); | |
1323 | BaseProperty baseProperty = | |
1324 | BaseProperty.builder() | |
1325 | .value(songDuration) | |
1326 | .format(FormatFieldType.STRING_ISO8601_DURATION_FORMAT.getValue()) | |
1327 | .property(MetadataField.SONG_DURATION.getName()) | |
1328 | .index(index) | |
1329 | .valid(valueFormat.equals(FormatFieldType.STRING_ISO8601_DURATION_FORMAT)) | |
1330 | .valueFormat(valueFormat.getValue()) | |
1331 | .build(); | |
1332 |
1
1. songDuration : negated conditional → NO_COVERAGE |
if (version == 0) { |
1333 |
1
1. songDuration : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
baseProperty.setValid(null); |
1334 |
1
1. songDuration : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
baseProperty.setFormat(null); |
1335 |
1
1. songDuration : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValueFormat → NO_COVERAGE |
baseProperty.setValueFormat(null); |
1336 | } | |
1337 |
1
1. songDuration : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::songDuration → NO_COVERAGE |
return baseProperty; |
1338 | } | |
1339 | ||
1340 | private static BaseProperty songTitle(Object songTitle, String index, int version) { | |
1341 | FormatFieldType valueFormat = MetadataFieldUtils.getFormatTypeByObject(songTitle); | |
1342 | BaseProperty baseProperty = | |
1343 | BaseProperty.builder() | |
1344 | .value(songTitle) | |
1345 | .format(FormatFieldType.STRING_OR_ARRAY_STRING.getValue()) | |
1346 | .property(MetadataField.SONG_TITLE.getName()) | |
1347 | .index(index) | |
1348 | .valid( | |
1349 |
1
1. songTitle : negated conditional → NO_COVERAGE |
FormatFieldType.STRING.equals(valueFormat) |
1350 |
1
1. songTitle : negated conditional → NO_COVERAGE |
|| FormatFieldType.STRING.equals(valueFormat.getParentType()) |
1351 |
1
1. songTitle : negated conditional → NO_COVERAGE |
|| valueFormat.equals(FormatFieldType.ARRAY_STRING)) |
1352 | .valueFormat(valueFormat.getValue()) | |
1353 | .build(); | |
1354 |
1
1. songTitle : negated conditional → NO_COVERAGE |
if (version == 0) { |
1355 |
1
1. songTitle : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
baseProperty.setValid(null); |
1356 |
1
1. songTitle : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
baseProperty.setFormat(null); |
1357 |
1
1. songTitle : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValueFormat → NO_COVERAGE |
baseProperty.setValueFormat(null); |
1358 | } | |
1359 |
1
1. songTitle : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::songTitle → NO_COVERAGE |
return baseProperty; |
1360 | } | |
1361 | ||
1362 | private static BaseProperty trackNumber(Object trackNumber, String index, int version) { | |
1363 | FormatFieldType valueFormat = MetadataFieldUtils.getFormatTypeByObject(trackNumber); | |
1364 | BaseProperty baseProperty = | |
1365 | BaseProperty.builder() | |
1366 | .value(trackNumber) | |
1367 | .format(FormatFieldType.INTEGER.getValue()) | |
1368 | .property(MetadataField.TRACK_NUMBER.getName()) | |
1369 | .index(index) | |
1370 | .valid(valueFormat.equals(FormatFieldType.INTEGER)) | |
1371 | .valueFormat(valueFormat.getValue()) | |
1372 | .build(); | |
1373 |
1
1. trackNumber : negated conditional → NO_COVERAGE |
if (version == 0) { |
1374 |
1
1. trackNumber : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
baseProperty.setValid(null); |
1375 |
1
1. trackNumber : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
baseProperty.setFormat(null); |
1376 |
1
1. trackNumber : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValueFormat → NO_COVERAGE |
baseProperty.setValueFormat(null); |
1377 | } | |
1378 |
1
1. trackNumber : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::trackNumber → NO_COVERAGE |
return baseProperty; |
1379 | } | |
1380 | ||
1381 | private static BaseProperty albumTitleMetadataCIP60( | |
1382 | Object albumTitle, String index, int version) { | |
1383 | FormatFieldType valueFormat = MetadataFieldUtils.getFormatTypeByObject(albumTitle); | |
1384 | boolean isValid = | |
1385 |
1
1. albumTitleMetadataCIP60 : negated conditional → NO_COVERAGE |
FormatFieldType.STRING.equals(valueFormat) |
1386 |
1
1. albumTitleMetadataCIP60 : negated conditional → NO_COVERAGE |
|| FormatFieldType.STRING.equals(valueFormat.getParentType()); |
1387 | BaseProperty baseProperty = | |
1388 | BaseProperty.builder() | |
1389 | .value(albumTitle) | |
1390 | .format(FormatFieldType.STRING.getValue()) | |
1391 | .property(MetadataField.ALBUM_TITLE.getName()) | |
1392 | .index(index) | |
1393 | .valid(isValid) | |
1394 |
1
1. albumTitleMetadataCIP60 : negated conditional → NO_COVERAGE |
.valueFormat(isValid ? FormatFieldType.STRING.getValue() : valueFormat.getValue()) |
1395 | .build(); | |
1396 |
1
1. albumTitleMetadataCIP60 : negated conditional → NO_COVERAGE |
if (version == 0) { |
1397 |
1
1. albumTitleMetadataCIP60 : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → NO_COVERAGE |
baseProperty.setValid(null); |
1398 |
1
1. albumTitleMetadataCIP60 : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → NO_COVERAGE |
baseProperty.setFormat(null); |
1399 |
1
1. albumTitleMetadataCIP60 : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValueFormat → NO_COVERAGE |
baseProperty.setValueFormat(null); |
1400 | } | |
1401 |
1
1. albumTitleMetadataCIP60 : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::albumTitleMetadataCIP60 → NO_COVERAGE |
return baseProperty; |
1402 | } | |
1403 | ||
1404 | private static BaseProperty releaseType(Object releaseType, int version) { | |
1405 | FormatFieldType valueFormat = MetadataFieldUtils.getFormatTypeByObject(releaseType); | |
1406 | BaseProperty baseProperty = | |
1407 | BaseProperty.builder() | |
1408 | .value(releaseType) | |
1409 | .format(FormatFieldType.STRING.getValue()) | |
1410 | .property(MetadataField.RELEASE_TYPE.getName()) | |
1411 | .index("6") | |
1412 | .valid( | |
1413 |
1
1. releaseType : negated conditional → SURVIVED |
FormatFieldType.STRING.equals(valueFormat) |
1414 |
1
1. releaseType : negated conditional → NO_COVERAGE |
&& List.of("Single", "Multiple").contains(releaseType.toString())) |
1415 | .valueFormat(valueFormat.getValue()) | |
1416 | .build(); | |
1417 |
1
1. releaseType : negated conditional → SURVIVED |
if (version == 0) { |
1418 |
1
1. releaseType : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValid → SURVIVED |
baseProperty.setValid(null); |
1419 |
1
1. releaseType : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setFormat → SURVIVED |
baseProperty.setFormat(null); |
1420 |
1
1. releaseType : removed call to org/cardanofoundation/explorer/api/model/metadatastandard/BaseProperty::setValueFormat → SURVIVED |
baseProperty.setValueFormat(null); |
1421 | } | |
1422 |
1
1. releaseType : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::releaseType → SURVIVED |
return baseProperty; |
1423 | } | |
1424 | ||
1425 | private static BaseProperty musicMetadataVersion(int musicVersion, Object originMusicVersion) { | |
1426 |
2
1. musicMetadataVersion : negated conditional → SURVIVED 2. musicMetadataVersion : negated conditional → SURVIVED |
boolean isValid = musicVersion == 1 || musicVersion == 2; |
1427 |
1
1. musicMetadataVersion : replaced return value with null for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::musicMetadataVersion → SURVIVED |
return BaseProperty.builder() |
1428 | .value(originMusicVersion) | |
1429 | .format(FormatFieldType.VERSION_1_OR_2.getValue()) | |
1430 | .property(MetadataField.MUSIC_METADATA_VERSION.getName()) | |
1431 | .index("5") | |
1432 | .valid(isValid) | |
1433 | .valueFormat( | |
1434 |
1
1. musicMetadataVersion : negated conditional → SURVIVED |
isValid |
1435 | ? String.valueOf(musicVersion) | |
1436 | : FormatFieldType.NEITHER_VERSION_1_OR_2.getValue()) | |
1437 | .build(); | |
1438 | } | |
1439 | ||
1440 | private static Boolean valid(Map<Object, TokenCIP> tokenMap) { | |
1441 | List<Boolean> fields = new ArrayList<>(); | |
1442 | for (Map.Entry<Object, TokenCIP> tokenEntry : tokenMap.entrySet()) { | |
1443 | fields.add( | |
1444 | tokenEntry.getValue().getOptionalProperties().stream() | |
1445 | .map(BaseProperty::getValid) | |
1446 |
2
1. lambda$valid$8 : replaced boolean return with false for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$valid$8 → NO_COVERAGE 2. lambda$valid$8 : replaced boolean return with true for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$valid$8 → NO_COVERAGE |
.allMatch(isValid -> isValid.equals(true))); |
1447 | fields.add( | |
1448 | tokenEntry.getValue().getRequireProperties().stream() | |
1449 | .map(BaseProperty::getValid) | |
1450 |
2
1. lambda$valid$9 : replaced boolean return with false for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$valid$9 → NO_COVERAGE 2. lambda$valid$9 : replaced boolean return with true for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$valid$9 → NO_COVERAGE |
.allMatch(isValid -> isValid.equals(true))); |
1451 | } | |
1452 |
5
1. valid : negated conditional → NO_COVERAGE 2. valid : negated conditional → NO_COVERAGE 3. lambda$valid$10 : replaced boolean return with false for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$valid$10 → NO_COVERAGE 4. lambda$valid$10 : replaced boolean return with true for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::lambda$valid$10 → NO_COVERAGE 5. valid : replaced Boolean return with True for org/cardanofoundation/explorer/api/util/MetadataCIP60Utils::valid → NO_COVERAGE |
return !fields.isEmpty() && fields.stream().allMatch(field -> field.equals(true)); |
1453 | } | |
1454 | } | |
Mutations | ||
30 |
1.1 |
|
38 |
1.1 |
|
46 |
1.1 |
|
67 |
1.1 |
|
70 |
1.1 |
|
73 |
1.1 |
|
76 |
1.1 |
|
78 |
1.1 |
|
85 |
1.1 |
|
86 |
1.1 |
|
87 |
1.1 |
|
89 |
1.1 |
|
91 |
1.1 |
|
94 |
1.1 |
|
100 |
1.1 |
|
104 |
1.1 |
|
105 |
1.1 |
|
111 |
1.1 |
|
112 |
1.1 |
|
121 |
1.1 |
|
122 |
1.1 |
|
123 |
1.1 |
|
128 |
1.1 |
|
130 |
1.1 |
|
131 |
1.1 |
|
132 |
1.1 |
|
134 |
1.1 |
|
146 |
1.1 2.2 |
|
166 |
1.1 |
|
170 |
1.1 |
|
172 |
1.1 |
|
178 |
1.1 |
|
184 |
1.1 |
|
186 |
1.1 |
|
187 |
1.1 |
|
188 |
1.1 |
|
189 |
1.1 |
|
191 |
1.1 |
|
199 |
1.1 |
|
200 |
1.1 |
|
212 |
1.1 2.2 |
|
229 |
1.1 |
|
237 |
1.1 |
|
240 |
1.1 |
|
248 |
1.1 |
|
251 |
1.1 |
|
259 |
1.1 |
|
262 |
1.1 |
|
270 |
1.1 |
|
273 |
1.1 |
|
281 |
1.1 |
|
284 |
1.1 |
|
292 |
1.1 |
|
295 |
1.1 |
|
299 |
1.1 |
|
302 |
1.1 |
|
310 |
1.1 |
|
313 |
1.1 |
|
321 |
1.1 |
|
324 |
1.1 |
|
328 |
1.1 |
|
331 |
1.1 |
|
334 |
1.1 |
|
336 |
1.1 2.2 |
|
353 |
1.1 2.2 |
|
355 |
1.1 |
|
363 |
1.1 |
|
366 |
1.1 |
|
370 |
1.1 |
|
373 |
1.1 |
|
377 |
1.1 |
|
380 |
1.1 |
|
384 |
1.1 |
|
387 |
1.1 |
|
391 |
1.1 |
|
394 |
1.1 |
|
398 |
1.1 |
|
401 |
1.1 |
|
409 |
1.1 |
|
412 |
1.1 |
|
420 |
1.1 |
|
423 |
1.1 |
|
431 |
1.1 |
|
434 |
1.1 |
|
451 |
1.1 2.2 |
|
453 |
1.1 |
|
461 |
1.1 |
|
464 |
1.1 |
|
472 |
1.1 |
|
475 |
1.1 |
|
483 |
1.1 |
|
486 |
1.1 |
|
494 |
1.1 |
|
497 |
1.1 |
|
505 |
1.1 |
|
508 |
1.1 |
|
516 |
1.1 |
|
519 |
1.1 |
|
527 |
1.1 |
|
530 |
1.1 |
|
538 |
1.1 |
|
541 |
1.1 |
|
549 |
1.1 |
|
552 |
1.1 |
|
570 |
1.1 2.2 |
|
571 |
1.1 |
|
575 |
1.1 |
|
578 |
1.1 |
|
586 |
1.1 |
|
589 |
1.1 |
|
593 |
1.1 |
|
596 |
1.1 |
|
600 |
1.1 |
|
603 |
1.1 |
|
607 |
1.1 |
|
610 |
1.1 |
|
618 |
1.1 |
|
621 |
1.1 |
|
629 |
1.1 |
|
632 |
1.1 |
|
640 |
1.1 |
|
643 |
1.1 |
|
651 |
1.1 |
|
654 |
1.1 |
|
675 |
1.1 2.2 3.3 |
|
678 |
1.1 |
|
682 |
1.1 |
|
686 |
1.1 |
|
691 |
1.1 |
|
693 |
1.1 |
|
696 |
1.1 |
|
697 |
1.1 |
|
698 |
1.1 |
|
700 |
1.1 |
|
702 |
1.1 2.2 |
|
708 |
1.1 |
|
721 |
1.1 2.2 3.3 |
|
724 |
1.1 |
|
728 |
1.1 |
|
732 |
1.1 |
|
736 |
1.1 |
|
738 |
1.1 |
|
754 |
1.1 2.2 3.3 |
|
758 |
1.1 |
|
763 |
1.1 |
|
767 |
1.1 |
|
772 |
1.1 |
|
804 |
1.1 2.2 |
|
805 |
1.1 |
|
806 |
1.1 |
|
807 |
1.1 |
|
809 |
1.1 |
|
812 |
1.1 |
|
813 |
1.1 |
|
814 |
1.1 |
|
816 |
1.1 |
|
818 |
1.1 2.2 |
|
824 |
1.1 |
|
837 |
1.1 2.2 3.3 |
|
840 |
1.1 |
|
844 |
1.1 |
|
848 |
1.1 |
|
853 |
1.1 |
|
863 |
1.1 2.2 |
|
901 |
1.1 2.2 |
|
902 |
1.1 |
|
904 |
1.1 |
|
906 |
1.1 |
|
908 |
1.1 |
|
910 |
1.1 2.2 |
|
912 |
1.1 |
|
914 |
1.1 2.2 |
|
918 |
1.1 |
|
921 |
1.1 |
|
923 |
1.1 |
|
926 |
1.1 |
|
927 |
1.1 |
|
928 |
1.1 |
|
934 |
1.1 |
|
943 |
1.1 |
|
953 |
1.1 |
|
956 |
1.1 |
|
959 |
1.1 |
|
961 |
1.1 |
|
988 |
1.1 |
|
993 |
1.1 |
|
994 |
1.1 |
|
995 |
1.1 |
|
996 |
1.1 |
|
998 |
1.1 |
|
1009 |
1.1 |
|
1013 |
1.1 |
|
1014 |
1.1 |
|
1015 |
1.1 |
|
1016 |
1.1 |
|
1018 |
1.1 |
|
1029 |
1.1 |
|
1033 |
1.1 |
|
1034 |
1.1 |
|
1035 |
1.1 |
|
1036 |
1.1 |
|
1038 |
1.1 |
|
1045 |
1.1 |
|
1046 |
1.1 |
|
1052 |
1.1 |
|
1054 |
1.1 |
|
1056 |
1.1 |
|
1057 |
1.1 |
|
1058 |
1.1 |
|
1059 |
1.1 |
|
1061 |
1.1 |
|
1073 |
1.1 |
|
1075 |
1.1 |
|
1077 |
1.1 |
|
1078 |
1.1 |
|
1079 |
1.1 |
|
1080 |
1.1 |
|
1082 |
1.1 |
|
1093 |
1.1 |
|
1097 |
1.1 |
|
1098 |
1.1 |
|
1099 |
1.1 |
|
1100 |
1.1 |
|
1102 |
1.1 |
|
1113 |
1.1 |
|
1115 |
1.1 |
|
1116 |
1.1 |
|
1119 |
1.1 |
|
1120 |
1.1 |
|
1121 |
1.1 |
|
1122 |
1.1 |
|
1124 |
1.1 |
|
1137 |
1.1 2.2 |
|
1139 |
1.1 |
|
1143 |
1.1 |
|
1153 |
1.1 |
|
1155 |
1.1 |
|
1159 |
1.1 |
|
1161 |
1.1 |
|
1164 |
1.1 |
|
1165 |
1.1 |
|
1166 |
1.1 |
|
1168 |
1.1 |
|
1169 |
1.1 |
|
1171 |
1.1 2.2 3.3 |
|
1180 |
1.1 |
|
1182 |
1.1 |
|
1188 |
1.1 2.2 |
|
1190 |
1.1 |
|
1201 |
1.1 |
|
1212 |
1.1 |
|
1214 |
1.1 |
|
1219 |
1.1 |
|
1221 |
1.1 |
|
1224 |
1.1 |
|
1225 |
1.1 |
|
1226 |
1.1 |
|
1228 |
1.1 |
|
1229 |
1.1 2.2 3.3 4.4 |
|
1233 |
1.1 |
|
1239 |
1.1 2.2 |
|
1257 |
1.1 |
|
1259 |
1.1 |
|
1264 |
1.1 |
|
1266 |
1.1 |
|
1267 |
1.1 |
|
1268 |
1.1 |
|
1270 |
1.1 2.2 3.3 |
|
1274 |
1.1 |
|
1280 |
1.1 |
|
1281 |
1.1 |
|
1289 |
1.1 |
|
1291 |
1.1 |
|
1292 |
1.1 |
|
1293 |
1.1 |
|
1294 |
1.1 |
|
1296 |
1.1 |
|
1308 |
1.1 2.2 |
|
1310 |
1.1 2.2 |
|
1313 |
1.1 |
|
1314 |
1.1 |
|
1315 |
1.1 |
|
1316 |
1.1 |
|
1318 |
1.1 |
|
1332 |
1.1 |
|
1333 |
1.1 |
|
1334 |
1.1 |
|
1335 |
1.1 |
|
1337 |
1.1 |
|
1349 |
1.1 |
|
1350 |
1.1 |
|
1351 |
1.1 |
|
1354 |
1.1 |
|
1355 |
1.1 |
|
1356 |
1.1 |
|
1357 |
1.1 |
|
1359 |
1.1 |
|
1373 |
1.1 |
|
1374 |
1.1 |
|
1375 |
1.1 |
|
1376 |
1.1 |
|
1378 |
1.1 |
|
1385 |
1.1 |
|
1386 |
1.1 |
|
1394 |
1.1 |
|
1396 |
1.1 |
|
1397 |
1.1 |
|
1398 |
1.1 |
|
1399 |
1.1 |
|
1401 |
1.1 |
|
1413 |
1.1 |
|
1414 |
1.1 |
|
1417 |
1.1 |
|
1418 |
1.1 |
|
1419 |
1.1 |
|
1420 |
1.1 |
|
1422 |
1.1 |
|
1426 |
1.1 2.2 |
|
1427 |
1.1 |
|
1434 |
1.1 |
|
1446 |
1.1 2.2 |
|
1450 |
1.1 2.2 |
|
1452 |
1.1 2.2 3.3 4.4 5.5 |