/** * * Find all objects in the ooTreeListX that's between startTime and endTime inclusive, and have * branch.getID() if branch is not null We don't have any optimization for time, but we could make * the treeset use custom comparator. */ public List<ObjyCommitInfo> getCommitInfo(CDOBranch branch, long startTime, long endTime) { ooTreeSetX treeSet = getTreeSet(); ObjyCommitInfo ooCommitInfo = null; List<ObjyCommitInfo> results = new ArrayList<ObjyCommitInfo>(); boolean getIt = false; @SuppressWarnings("unchecked") Iterator<ObjyCommitInfo> itr = treeSet.iterator(); while (itr.hasNext()) { ooCommitInfo = itr.next(); getIt = true; // assume it's what we need, then we filter below. long timeStamp = ooCommitInfo.getTimeStamp(); long branchId = ooCommitInfo.getBranchId(); if (branch != null && branch.getID() != branchId) { getIt = false; } if (getIt && startTime != CDOBranchPoint.UNSPECIFIED_DATE && timeStamp < startTime) { getIt = false; } if (getIt && endTime != CDOBranchPoint.UNSPECIFIED_DATE && timeStamp > endTime) { getIt = false; } if (getIt) { results.add(ooCommitInfo); } } return results; }
public void addCommitInfo(CDOBranchPoint branchPoint, long pointer) { if (TRACER.isEnabled()) { TRACER.format("addCommitInfo: {0}, {1}", branchPoint, pointer); // $NON-NLS-1$ } try { if (addCommitInfoStatement == null) { String sql = index.commitInfos.sqlAddCommitInfo(); addCommitInfoStatement = connection.prepareStatement(sql); } int column = 0; long timeStamp = branchPoint.getTimeStamp(); addCommitInfoStatement.setLong(++column, timeStamp); if (supportingBranches) { CDOBranch branch = branchPoint.getBranch(); int branchID = branch.getID(); addCommitInfoStatement.setInt(++column, branchID); } addCommitInfoStatement.setLong(++column, pointer); execute(addCommitInfoStatement); } catch (SQLException ex) { throw new DBException(ex); } }
@Override protected void writeCommitInfo( CDOBranch branch, long timeStamp, long previousTimeStamp, String userID, String comment, OMMonitor monitor) { DB4OCommitInfo commitInfo = new DB4OCommitInfo(branch.getID(), timeStamp, previousTimeStamp, userID, comment); writeObject(commitInfo, monitor); }
@Override public String toString() { return MessageFormat.format("{0}:{1}", id, branch.getID()); // $NON-NLS-1$ }