예제 #1
0
  public AreaWs2 getComplete(AreaWs2 area) throws MBWS2Exception {
    if (area == null) return null;
    if (area.getId() == null) return area;

    // save some field that come from search, but is missing in
    // lookUp http://tickets.musicbrainz.org/browse/MBS-3982
    setIncoming(area);

    return getComplete(area.getId());
  }
예제 #2
0
  public AreaWs2 lookUp(String id) throws MBWS2Exception {

    AreaIncludesWs2 inc = getIncrementalInc(new AreaIncludesWs2());

    // LookUp is limited by 25 linked entities, to be sure
    // is better perform a Browse (you could also get first 25
    // at lookUp time just hiitting areaInclude.setReleases(true),
    // check if there could be  more releases left and in case perform
    // the Browse... worry about sort order...).

    inc.setArtists(false); // handled via a browse.
    inc.setLabels(false); // handled via a browse.
    inc.setReleases(false); // handled via a browse.
    inc.setPlaces(false); // handled via a browse.

    // the following inc params are meaningless if not inc.isRelease() or
    // inc.isRecordings().

    inc.setMedia(false);
    inc.setDiscids(false);
    inc.setIsrcs(false);
    inc.setPuids(false);

    // Sanity check.
    // if(inc.isArtistCredits()) inc.setReleases(true); // to avoid the artist credits exceptions.

    inc.setArtistCredits(false); // invalid request

    inc.setRecordingLevelRelations(false); // invalid request
    inc.setWorkLevelRelations(false); // invalid request

    if (needsLookUp(inc)) {
      setLookUp(new LookUpWs2(getQueryWs()));

      AreaWs2 transit = null;
      transit = getLookUp().getAreaById(id, inc);

      if (transit == null) return null;

      if (getArea() == null || !getArea().equals(transit)) // area is changed.
      {
        setEntity(transit);
        setIncluded(inc);

        artistBrowse = null;
        labelBrowse = null;
        releaseBrowse = null;
        placeBrowse = null;

      } else {
        updateEntity(getArea(), transit, inc);
        if (inc.isAliases()) {
          getArea().setAliases(transit.getAliases());
          getIncluded().setAliases(true);
        }
      }
    }
    if (inc.isAnnotation()) loadAnnotation(getArea());

    initBrowses();

    return getArea();
  }