Exemplo n.º 1
0
 /**
  * @param namespace
  * @see
  *     edu.utah.further.mdr.api.domain.asset.Asset#setNamespace(edu.utah.further.mdr.api.domain.asset.Asset)
  */
 @Override
 public void setNamespace(final Asset namespace) {
   this.namespace = (AssetTo) namespace;
   if (namespace != null) {
     this.namespaceId = namespace.getId();
   }
 }
Exemplo n.º 2
0
 /**
  * @param type
  * @see
  *     edu.utah.further.mdr.api.domain.asset.Asset#setType(edu.utah.further.mdr.api.domain.asset.Asset)
  */
 @Override
 public void setType(final Asset type) {
   this.type = (AssetTo) type;
   if (type != null) {
     this.typeId = type.getId();
   }
 }
Exemplo n.º 3
0
  /**
   * @param other
   * @return
   * @see
   *     edu.utah.further.mdr.api.domain.asset.Asset#copyFrom(edu.utah.further.mdr.api.domain.asset.Asset)
   */
  @Override
  public AssetToImpl copyFrom(final Asset other) {
    if (other == null) {
      return this;
    }

    // Deep-copy primitive fields and IDs, but do not deep-copy entity references
    this.id = other.getId();
    final Asset otherNamespace = other.getNamespace();
    if (otherNamespace != null) {
      this.namespaceId = otherNamespace.getId();
    }
    final Asset otherType = other.getType();
    if (otherType != null) {
      this.typeId = otherType.getId();
    }
    this.label = other.getLabel();
    this.description = other.getDescription();
    this.activationInfo = new ActivationInfoToImpl().copyFrom(other.getActivationInfo());

    // Deep-copy collection references (IDs) but do not deep-copy their elements
    // unless it's easy to deep-copy them too. Note: the hibernate entity (other) 's
    // version set must be eagerly fetched so that copying it here, outside the
    // Hibernate session, does not throw a lazy init exception.
    this.versionSet = newSortedSet();
    this.versionIdSet = newSortedSet();
    for (final Version version : other.getVersionSet()) {
      // TODO: add version TOs here in the future
      // addVersion(new VersionEntity().copyFrom(version));
      versionIdSet.add(version.getId());
    }

    return this;
  }