Exemplo n.º 1
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());
  }
Exemplo n.º 2
0
  @Override
  public boolean equals(Object o) {
    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    Commit other = (Commit) o;

    return this.getId().equals(other.getId());
  }
Exemplo n.º 3
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;
  }