Beispiel #1
0
 /**
  * Creates a SourceRef object from a Source object using the provided URI for the SourceRef
  * pointing to the full Source resource. Needs to be kept up to date with any changes to the
  * schema, which is bogus.
  *
  * @param source The Source to build the SourceRef from.
  * @param uri The URI where the Source is located.
  */
 public SourceRef(Source source, String uri) {
   this(
       source.getName(),
       source.getOwner(),
       source.isPublic(),
       source.isVirtual(),
       source.getCoordinates(),
       source.getLocation(),
       source.getDescription(),
       uri);
 }
Beispiel #2
0
  /**
   * Determines if the subset of information in a SourceRef is equal to particular Source object.
   * Note that only the final segment of the href field of the SourceRef is compared to the Source
   * object, as the Source object does not contain its own URI. Thus if the SourceRef was from a
   * different server than the Source object, this test would return true even though the SourceRef
   * points to a different copy of this Source object.
   *
   * @param source The Source to be compared.
   * @return True if all the fields in the SourceRef correspond to the same fields in the Source
   */
  public boolean equalsSource(Source source) {
    String hrefSourceName = this.getHref().substring(this.getHref().lastIndexOf('/') + 1);

    return (this.getName().equals(source.getName())
        && (this.getOwner().equals(source.getOwner()))
        && (this.isPublic() == source.isPublic())
        && (this.isVirtual() == source.isVirtual())
        && (this.getCoordinates().equals(source.getCoordinates()))
        && (this.getLocation().equals(source.getLocation()))
        && (this.getDescription().equals(source.getDescription()))
        && (source.getName().equals(hrefSourceName)));
  }