Skip to content

Commit c3d37eb

Browse files
committed
MBS-9726: Fix ISRC output
1 parent 018721f commit c3d37eb

3 files changed

Lines changed: 45 additions & 4 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* Copyright (c) 2018 MetaBrainz Foundation
2+
* All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
* 3. Neither the name of the MusicBrainz project nor the names of the
13+
* contributors may be used to endorse or promote products derived from
14+
* this software without specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
22+
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
*/
28+
29+
package org.musicbrainz.search.solrwriter.moxy;
30+
31+
import org.musicbrainz.mmd2.Isrc;
32+
33+
import javax.xml.bind.annotation.adapters.XmlAdapter;
34+
35+
public class StringIsrcAdapter extends NotUnmarshallableXmlAdapter<String, Isrc> {
36+
@Override
37+
public String marshal(Isrc v) throws Exception {
38+
return v.getId();
39+
}
40+
41+
}

mb-solrquerywriter/src/main/resources/oxml.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,9 @@
315315
</java-type>
316316
<java-type name="IsrcList">
317317
<java-attributes>
318-
<xml-element java-attribute="isrc" name="isrcs"/>
318+
<xml-element java-attribute="isrc" name="isrcs">
319+
<xml-java-type-adapter value="org.musicbrainz.search.solrwriter.moxy.StringIsrcAdapter"/>
320+
</xml-element>
319321
</java-attributes>
320322
</java-type>
321323
<java-type name="SecondaryTypeList">

mb-solrquerywriter/src/test/resources/org/musicbrainz/search/solrwriter/recording-list.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,7 @@
138138
}
139139
],
140140
"isrcs": [
141-
{
142-
"id": "USRE10701410"
143-
}
141+
"USRE10701410"
144142
],
145143
"tags": [
146144
{

0 commit comments

Comments
 (0)