use of org.platformlayer.jobs.model.JobExecutionData in project platformlayer by platformlayer.
the class JdbcJobRepository method listExecutions.
// @Override
// @JdbcTransaction
// public void recordJob(PlatformLayerKey jobId, PlatformLayerKey itemKey, JobState jobState, JobLog jobLog)
// throws RepositoryException {
// DbHelper db = new DbHelper();
// try {
// String data;
//
// // TODO: More compact encoding?? XML InfoSet? GZIP?
// try {
// data = JaxbHelper.toXml(jobLog, false);
// } catch (JAXBException e) {
// throw new RepositoryException("Error serializing job log", e);
// }
//
// int updateCount = db.insertJobLog(itemKey.getServiceType(), itemKey.getItemType(), itemKey.getProject(),
// itemKey.getItemId(), jobState, data);
//
// if (updateCount != 1) {
// throw new IllegalStateException("Unexpected number of rows inserted");
// }
// } catch (SQLException e) {
// throw new RepositoryException("Error saving job log", e);
// } finally {
// db.close();
// }
// }
@Override
@JdbcTransaction
public List<JobExecutionData> listExecutions(PlatformLayerKey jobKey) throws RepositoryException {
DbHelper db = new DbHelper();
try {
ProjectId projectId = jobKey.getProject();
String jobId = jobKey.getItemIdString();
List<JobExecutionEntity> executions = db.queries.listExecutions(db.mapToValue(projectId), jobId);
List<JobExecutionData> ret = Lists.newArrayList();
for (JobExecutionEntity execution : executions) {
ret.add(mapFromEntity(execution, jobKey));
}
sort(ret);
return ret;
} catch (SQLException e) {
throw new RepositoryException("Error listing job executions", e);
} finally {
db.close();
}
}
use of org.platformlayer.jobs.model.JobExecutionData in project platformlayer by platformlayer.
the class JdbcJobRepository method mapFromEntity.
private JobExecutionData mapFromEntity(JobExecutionEntity execution, PlatformLayerKey jobKey) {
JobExecutionData data = new JobExecutionData();
data.executionId = execution.executionId;
data.endedAt = execution.endedAt;
data.startedAt = execution.startedAt;
data.state = execution.state;
data.executionId = execution.executionId;
data.jobKey = jobKey;
data.logCookie = execution.logCookie;
return data;
}
Aggregations