Exemplo n.º 1
0
  @Override
  public boolean softEquals(Object obj) {
    if (this == obj) {
      return true;
    }
    if (obj == null) {
      return false;
    }
    if (obj instanceof RecordRvtImpl) {
      return softEquals(((RecordRvtImpl) obj).getRecord());
    }
    if (obj instanceof IdRecordImpl) {
      return softEquals(((IdRecordImpl) obj).getRecord());
    }
    if (getClass() != obj.getClass()) {
      return false;
    }
    RecordImpl other = (RecordImpl) obj;

    if (fields == null) {
      if (other.fields != null) {
        return false;
      }
    } else if (!fields.equals(other.fields)) {
      return false;
    }

    if (fieldsToDelete == null) {
      if (other.fieldsToDelete != null) {
        return false;
      }
    } else if (!fieldsToDelete.equals(other.fieldsToDelete)) {
      return false;
    }

    if (id == null) {
      if (other.id != null) {
        return false;
      }
    } else if (!id.equals(other.id)) {
      return false;
    }

    QName nonVersionedRT1 = getRecordTypeName(Scope.NON_VERSIONED);
    QName nonVersionedRT2 = other.getRecordTypeName(Scope.NON_VERSIONED);

    if (nonVersionedRT1 != null
        && nonVersionedRT2 != null
        && !nonVersionedRT1.equals(nonVersionedRT2)) {
      return false;
    }

    return true;
  }
Exemplo n.º 2
0
  private QName resolveNamespace(String name) throws RecordException {
    if (defaultNamespace != null) {
      return new QName(defaultNamespace, name);
    }

    QName recordTypeName = getRecordTypeName();
    if (recordTypeName != null) {
      return new QName(recordTypeName.getNamespace(), name);
    }

    throw new RecordException(
        "Namespace could not be resolved for name '"
            + name
            + "' since no default namespace was given and no record type is set.");
  }
Exemplo n.º 3
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((name == null) ? 0 : name.hashCode());
   result = prime * result + ((version == null) ? 0 : version.hashCode());
   return result;
 }