Skip to content

Commit

Permalink
Issue #2155 - Start implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
  • Loading branch information
tbieste committed Jun 15, 2021
1 parent 0676ad4 commit b8c5aed
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public ReindexResourceDAO(Connection connection, IDatabaseTranslator translator,
* Getter for the translator currently held by this DAO
* @return
*/
@Override
protected IDatabaseTranslator getTranslator() {
return this.translator;
}
Expand Down Expand Up @@ -169,7 +170,8 @@ protected ResourceIndexRecord getNextResource(SecureRandom random, Instant reind
}
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
result = new ResourceIndexRecord(rs.getLong(1), rs.getInt(2), rs.getString(3), rs.getLong(4));
// TODO: Update this when PARAMETERS_HASH column exists in the DB table
result = new ResourceIndexRecord(rs.getLong(1), rs.getInt(2), rs.getString(3), rs.getLong(4), null);
}
} catch (SQLException x) {
logger.log(Level.SEVERE, select, x);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ public class ResourceIndexRecord {
// Deletion flag for the resource. Set when we read the resource
private boolean deleted;

public ResourceIndexRecord(long logicalResourceId, int resourceTypeId, String logicalId, long transactionId) {
// SHA-256 hash of the search parameters
private String parametersHash;

public ResourceIndexRecord(long logicalResourceId, int resourceTypeId, String logicalId, long transactionId, String parametersHash) {
this.logicalResourceId = logicalResourceId;
this.resourceTypeId = resourceTypeId;
this.logicalId = logicalId;
this.transactionId = transactionId;
this.parametersHash = parametersHash;
}

/**
Expand Down Expand Up @@ -92,4 +96,18 @@ public boolean isDeleted() {
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}

/**
* @return the parametersHash
*/
public String getParametersHash() {
return parametersHash;
}

/**
* @param parametersHash the parametersHash to set
*/
public void setParametersHash(String parametersHash) {
this.parametersHash = parametersHash;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public abstract class ExtractedParameterValue {
// The bass resource name
private String base;

// SHA-256 hash of the search parameter
private String hash;

/**
* Protected constructor
*/
Expand Down Expand Up @@ -93,4 +96,18 @@ public String getName() {
public void setName(String name) {
this.name = name;
}

/**
* @return the hash
*/
public String getHash() {
return hash;
}

/**
* @param hash the hash to set
*/
public void setHash(String hash) {
this.hash = hash;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ public ResourceIndexRecord getNextResource(SecureRandom random, Instant reindexT
stmt.execute();
ResultSet rs = stmt.getResultSet();
if (rs.next()) {
result = new ResourceIndexRecord(rs.getLong(1), rs.getInt(2), rs.getString(3), rs.getLong(4));
// TODO: Update this when PARAMETERS_HASH column exists in the DB table
result = new ResourceIndexRecord(rs.getLong(1), rs.getInt(2), rs.getString(3), rs.getLong(4), null);
}
} catch (SQLException x) {
logger.log(Level.SEVERE, update, x);
Expand Down

0 comments on commit b8c5aed

Please sign in to comment.