private PreparedStatement getStatement(Connection connection, String query, Job job) throws SQLException { PutFileRequest request = (PutFileRequest) job; TRetentionPolicy retentionPolicy = request.getRetentionPolicy(); TAccessLatency accessLatency = request.getAccessLatency(); return getPreparedStatement( connection, query, request.getNextJobId(), request.getCreationTime(), request.getLifetime(), request.getState().getStateId(), request.getErrorMessage(), request.getSchedulerId(), request.getSchedulerTimeStamp(), 0, // num of retries request.getLastStateTransitionTime(), request.getRequestId(), request.getStatusCodeString(), request.getSurlString(), request.getTurlString(), request.getFileId(), null, // parentFileId (unused) request.getSpaceReservationId(), request.getSize(), (retentionPolicy != null ? retentionPolicy.getValue() : null), (accessLatency != null ? accessLatency.getValue() : null), request.getId()); }
@Override public PreparedStatement getCreateStatement(Connection connection, Job job) throws SQLException { if (job == null || !(job instanceof PutFileRequest)) { throw new IllegalArgumentException("fr is not PutFileRequest"); } PutFileRequest request = (PutFileRequest) job; TRetentionPolicy retentionPolicy = request.getRetentionPolicy(); TAccessLatency accessLatency = request.getAccessLatency(); return getPreparedStatement( connection, INSERT_SQL, request.getId(), request.getNextJobId(), request.getCreationTime(), request.getLifetime(), request.getState().getStateId(), request.getErrorMessage(), request.getSchedulerId(), request.getSchedulerTimeStamp(), 0, // num of retries request.getLastStateTransitionTime(), request.getRequestId(), request.getStatusCodeString(), request.getSurlString(), request.getTurlString(), request.getFileId(), null, // parentFileId (unused) request.getSpaceReservationId(), request.getSize(), (retentionPolicy != null ? retentionPolicy.getValue() : null), (accessLatency != null ? accessLatency.getValue() : null)); }