예제 #1
0
파일: Commit.java 프로젝트: ZupIT/javers
  @Override
  public boolean equals(Object o) {
    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    Commit other = (Commit) o;

    return this.getId().equals(other.getId());
  }
예제 #2
0
  public boolean isPersisted(Commit commit) {
    SelectQuery selectQuery =
        polyJDBC
            .query()
            .select("count(*)")
            .from(COMMIT_TABLE_NAME)
            .where(COMMIT_COMMIT_ID + " = :id")
            .withArgument("id", commit.getId().valueAsNumber());

    return PolyUtil.queryForOptionalLong(selectQuery, polyJDBC).get() > 0;
  }
예제 #3
0
  @Override
  public void persist(Commit commit) {
    if (commitRepository.isPersisted(commit)) {
      throw new JaversException(
          JaversExceptionCode.CANT_SAVE_ALREADY_PERSISTED_COMMIT, commit.getId());
    }

    long commitPk =
        commitRepository.save(
            commit.getAuthor(), commit.getProperties(), commit.getCommitDate(), commit.getId());
    cdoSnapshotRepository.save(commitPk, commit.getSnapshots());
  }