User:Mineo/SearchWS: Difference between revisions

From MusicBrainz Wiki
Jump to navigationJump to search
(Created page with "* http://search.musicbrainz.org/ws/2/release/?query=release:Schneider&fmt=xml ** http://musicbrainz.org/ws/2/release/?query=release:Schneider&fmt=xml * http://search.musicbrai...")
 
No edit summary
Line 1: Line 1:
=Examples=

* http://search.musicbrainz.org/ws/2/release/?query=release:Schneider&fmt=xml
* http://search.musicbrainz.org/ws/2/release/?query=release:Schneider&fmt=xml
** http://musicbrainz.org/ws/2/release/?query=release:Schneider&fmt=xml
** http://musicbrainz.org/ws/2/release/?query=release:Schneider&fmt=xml
Line 5: Line 7:
* http://search.musicbrainz.org/ws/2/release/?query=release:Schneider&fmt=jsonnew
* http://search.musicbrainz.org/ws/2/release/?query=release:Schneider&fmt=jsonnew
** this is the same as http://musicbrainz.org/ws/2/release/?query=release:Schneider&fmt=json
** this is the same as http://musicbrainz.org/ws/2/release/?query=release:Schneider&fmt=json

=How this works=

* http://bugs.musicbrainz.org/browser/search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/mmd2/ResultsWriter.java#L171 checks if the desired format is jsonnew
* if so, use the context created by http://bugs.musicbrainz.org/browser/search_server/trunk/servlet/src/main/java/org/musicbrainz/search/servlet/mmd2/ResultsWriter.java#L94
* that accesses http://bugs.musicbrainz.org/browser/search_server/trunk/servlet/src/main/resources/oxml.xml
* that xml file is responsible for renaming fields conforming to [[Development/JSON_Web_Service]]
* http://www.eclipse.org/eclipselink/documentation/2.4/moxy/runtime003.htm#CACEDHHB has an example for renaming fields

=Renamings=
ack "element.*name" servlet/src/main/resources/oxml.xml -C2

<java-type name="IpiList">
<java-attributes>
<xml-element java-attribute="ipi" name="ipis"/>
</java-attributes>
</java-type>
<java-type name="LabelList">
<java-attributes>
<xml-element java-attribute="label" name="labels"/>
</java-attributes>
</java-type>
--
<java-type name="TagList">
<java-attributes>
<xml-element java-attribute="tag" name="tags"/>
</java-attributes>
</java-type>
<java-type name="AliasList">
<java-attributes>
<xml-element java-attribute="alias" name="aliases"/>
</java-attributes>
</java-type>
--
<java-type name="IswcList">
<java-attributes>
<xml-element java-attribute="iswc" name="iswcs"/>
</java-attributes>
</java-type>
<java-type name="UrlList">
<java-attributes>
<xml-element java-attribute="url" name="urls"/>
</java-attributes>
</java-type>
--
<java-type name="PuidList">
<java-attributes>
<xml-element java-attribute="puid" name="puids"/>
</java-attributes>
</java-type>
<java-type name="AreaList">
<java-attributes>
<xml-element java-attribute="area" name="areas"/>
</java-attributes>
</java-type>
<java-type name="PlaceList">
<java-attributes>
<xml-element java-attribute="place" name="places"/>
</java-attributes>
</java-type>
<java-type name="InstrumentList">
<java-attributes>
<xml-element java-attribute="instrument" name="instruments"/>
</java-attributes>
</java-type>
<java-type name="EditorList">
<java-attributes>
<xml-element java-attribute="editor" name="editors"/>
</java-attributes>
</java-type>
<java-type name="ReleaseList">
<java-attributes>
<xml-element java-attribute="release" name="releases"/>
</java-attributes>
</java-type>
<java-type name="ReleaseGroupList">
<java-attributes>
<xml-element java-attribute="releaseGroup" name="release-groups"/>
</java-attributes>
</java-type>
<java-type name="MediumList">
<java-attributes>
<xml-element java-attribute="medium" name="media"/>
</java-attributes>
</java-type>
<java-type name="IsrcList">
<java-attributes>
<xml-element java-attribute="isrc" name="isrcs"/>
</java-attributes>
</java-type>
<java-type name="SecondaryTypeList">
<java-attributes>
<xml-element java-attribute="secondaryType" name="secondary-types"/>
</java-attributes>
</java-type>
<java-type name="IsrcList">
<java-attributes>
<xml-element java-attribute="isrc" name="isrcs"/>
</java-attributes>
</java-type>
<java-type name="ArtistCredit">
<java-attributes>
<xml-element java-attribute="nameCredit" name="artist-credit"/>
</java-attributes>
</java-type>
--
<java-type name="FreedbDiscList">
<java-attributes>
<xml-element java-attribute="freedbDisc" name="freedb-discs"/>
</java-attributes>
</java-type>
--
<java-type name="LabelInfoList">
<java-attributes>
<xml-element java-attribute="labelInfo" name="label-info"/>
</java-attributes>
</java-type>
--
<java-type name="AnnotationList">
<java-attributes>
<xml-element java-attribute="annotation" name="annotations"/>
</java-attributes>
</java-type>
<java-type name="CdstubList">
<java-attributes>
<xml-element java-attribute="cdstub" name="cdstubs"/>
</java-attributes>
</java-type>
--
<java-type name="Medium$TrackList">
<java-attributes>
<xml-element java-attribute="count" name="track-count"/>
</java-attributes>
</java-type>
<java-type name="Medium$TrackList">
<java-attributes>
<xml-element java-attribute="offset" name="track-offset"/>
</java-attributes>
</java-type>
<java-type name="DiscList">
<java-attributes>
<xml-element java-attribute="count" name="disc-count"/>
</java-attributes>
</java-type>
<java-type name="DiscList">
<java-attributes>
<xml-element java-attribute="offset" name="disc-offset"/>
</java-attributes>
</java-type>
--
<java-type name="Relation$AttributeList">
<java-attributes>
<xml-element java-attribute="attribute" name="attributes"/>
</java-attributes>
</java-type>
--
<java-attributes>
<xml-transient java-attribute="targetType"/>
<xml-element java-attribute="relation" name="relations"/>
</java-attributes>
</java-type>
<java-type name="ReleaseEventList">
<java-attributes>
<xml-element java-attribute="releaseEvent" name="release-events"/>
</java-attributes>
</java-type>
<java-type name="Iso31661CodeList">
<java-attributes>
<xml-element java-attribute="iso31661Code" name="iso-3166-1-codes"/>
</java-attributes>
</java-type>
<java-type name="Iso31662CodeList">
<java-attributes>
<xml-element java-attribute="iso31662Code" name="iso-3166-2-codes"/>
</java-attributes>
</java-type>
<java-type name="Iso31663CodeList">
<java-attributes>
<xml-element java-attribute="iso31663Code" name="iso-3166-3-codes"/>
</java-attributes>
</java-type>
--
<xml-type prop-order=""/>
<java-attributes>
<xml-element java-attribute="content" name="name"/>
<xml-element java-attribute="beginDate" name="begin-date" nillable="true"/>
<xml-element java-attribute="endDate" name="end-date" nillable="true"/>
<xml-element java-attribute="locale" name="locale" nillable="true"/>
<xml-element java-attribute="type" name="type" nillable="true"/>
<xml-element java-attribute="primary" nillable="true">
<xml-java-type-adapter value="org.musicbrainz.search.servlet.moxy.BooleanStringAdapter"/>

Revision as of 23:39, 15 July 2014

Examples

How this works

Renamings

   ack "element.*name" servlet/src/main/resources/oxml.xml -C2
           <java-type name="IpiList">
               <java-attributes>
                   <xml-element java-attribute="ipi" name="ipis"/>
               </java-attributes>
           </java-type>
           <java-type name="LabelList">
               <java-attributes>
                   <xml-element java-attribute="label" name="labels"/>
               </java-attributes>
           </java-type>
   --
           <java-type name="TagList">
               <java-attributes>
                   <xml-element java-attribute="tag" name="tags"/>
               </java-attributes>
           </java-type>
           <java-type name="AliasList">
               <java-attributes>
                   <xml-element java-attribute="alias" name="aliases"/>
               </java-attributes>
           </java-type>
   --
           <java-type name="IswcList">
               <java-attributes>
                   <xml-element java-attribute="iswc" name="iswcs"/>
               </java-attributes>
           </java-type>
           <java-type name="UrlList">
               <java-attributes>
                   <xml-element java-attribute="url" name="urls"/>
               </java-attributes>
           </java-type>
   --
           <java-type name="PuidList">
               <java-attributes>
                   <xml-element java-attribute="puid" name="puids"/>
               </java-attributes>
           </java-type>
           <java-type name="AreaList">
               <java-attributes>
                   <xml-element java-attribute="area" name="areas"/>
               </java-attributes>
           </java-type>
           <java-type name="PlaceList">
               <java-attributes>
                   <xml-element java-attribute="place" name="places"/>
               </java-attributes>
           </java-type>
           <java-type name="InstrumentList">
               <java-attributes>
                   <xml-element java-attribute="instrument" name="instruments"/>
               </java-attributes>
           </java-type>
           <java-type name="EditorList">
               <java-attributes>
                   <xml-element java-attribute="editor" name="editors"/>
               </java-attributes>
           </java-type>
           <java-type name="ReleaseList">
               <java-attributes>
                   <xml-element java-attribute="release" name="releases"/>
               </java-attributes>
           </java-type>
           <java-type name="ReleaseGroupList">
               <java-attributes>
                   <xml-element java-attribute="releaseGroup" name="release-groups"/>
               </java-attributes>
           </java-type>
           <java-type name="MediumList">
               <java-attributes>
                   <xml-element java-attribute="medium" name="media"/>
               </java-attributes>
           </java-type>
           <java-type name="IsrcList">
               <java-attributes>
                   <xml-element java-attribute="isrc" name="isrcs"/>
               </java-attributes>
           </java-type>
           <java-type name="SecondaryTypeList">
               <java-attributes>
                   <xml-element java-attribute="secondaryType" name="secondary-types"/>
               </java-attributes>
           </java-type>
           <java-type name="IsrcList">
               <java-attributes>
                   <xml-element java-attribute="isrc" name="isrcs"/>
               </java-attributes>
           </java-type>
           <java-type name="ArtistCredit">
               <java-attributes>
                   <xml-element java-attribute="nameCredit" name="artist-credit"/>
               </java-attributes>
           </java-type>
   --
           <java-type name="FreedbDiscList">
               <java-attributes>
                   <xml-element java-attribute="freedbDisc" name="freedb-discs"/>
               </java-attributes>
           </java-type>
   --
           <java-type name="LabelInfoList">
               <java-attributes>
                   <xml-element java-attribute="labelInfo" name="label-info"/>
               </java-attributes>
           </java-type>
   --
           <java-type name="AnnotationList">
               <java-attributes>
                   <xml-element java-attribute="annotation" name="annotations"/>
               </java-attributes>
           </java-type>
           <java-type name="CdstubList">
               <java-attributes>
                   <xml-element java-attribute="cdstub" name="cdstubs"/>
               </java-attributes>
           </java-type>
   --
           <java-type name="Medium$TrackList">
               <java-attributes>
                   <xml-element java-attribute="count" name="track-count"/>
               </java-attributes>
           </java-type>
           <java-type name="Medium$TrackList">
               <java-attributes>
                   <xml-element java-attribute="offset" name="track-offset"/>
               </java-attributes>
           </java-type>
           <java-type name="DiscList">
               <java-attributes>
                   <xml-element java-attribute="count" name="disc-count"/>
               </java-attributes>
           </java-type>
           <java-type name="DiscList">
               <java-attributes>
                   <xml-element java-attribute="offset" name="disc-offset"/>
               </java-attributes>
           </java-type>
   --
           <java-type name="Relation$AttributeList">
               <java-attributes>
                   <xml-element java-attribute="attribute" name="attributes"/>
               </java-attributes>
           </java-type>
   --
               <java-attributes>
                   <xml-transient java-attribute="targetType"/>
                   <xml-element java-attribute="relation" name="relations"/>
               </java-attributes>
           </java-type>
           <java-type name="ReleaseEventList">
               <java-attributes>
                   <xml-element java-attribute="releaseEvent" name="release-events"/>
               </java-attributes>
           </java-type>
           <java-type name="Iso31661CodeList">
               <java-attributes>
                   <xml-element java-attribute="iso31661Code" name="iso-3166-1-codes"/>
               </java-attributes>
           </java-type>
           <java-type name="Iso31662CodeList">
               <java-attributes>
                   <xml-element java-attribute="iso31662Code" name="iso-3166-2-codes"/>
               </java-attributes>
           </java-type>
           <java-type name="Iso31663CodeList">
               <java-attributes>
                   <xml-element java-attribute="iso31663Code" name="iso-3166-3-codes"/>
               </java-attributes>
           </java-type>
   --
               <xml-type prop-order=""/>
               <java-attributes>
                   <xml-element java-attribute="content" name="name"/>
                   <xml-element java-attribute="beginDate" name="begin-date" nillable="true"/>
                   <xml-element java-attribute="endDate" name="end-date" nillable="true"/>
                   <xml-element java-attribute="locale" name="locale" nillable="true"/>
                   <xml-element java-attribute="type" name="type" nillable="true"/>
                   <xml-element java-attribute="primary" nillable="true">
                       <xml-java-type-adapter value="org.musicbrainz.search.servlet.moxy.BooleanStringAdapter"/>