This commit is contained in:
Fabio Sinibaldi 2019-01-09 16:34:22 +00:00
parent 1eb4ba6a00
commit 0624deba6b
2 changed files with 25 additions and 5 deletions

View File

@ -4,9 +4,11 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import org.gcube.application.perform.service.engine.model.DBField;
import org.gcube.application.perform.service.engine.model.DBField.ImportRoutine;
import org.gcube.application.perform.service.engine.model.anagraphic.Batch;
import org.gcube.application.perform.service.engine.model.anagraphic.Farm;
import org.gcube.application.perform.service.engine.model.importer.ImportRoutineDescriptor;
import org.gcube.application.perform.service.engine.model.importer.ImportStatus;
public class Queries {
@ -61,8 +63,26 @@ public class Queries {
}
public static ImportRoutineDescriptor rowToDescriptor(ResultSet rs) {
throw new RuntimeException("IMPLEMENT THIS SHIT");
public static ImportRoutineDescriptor rowToDescriptor(ResultSet rs) throws SQLException {
ImportRoutineDescriptor toReturn=new ImportRoutineDescriptor();
toReturn.setBatch_type(rs.getString(ImportRoutine.BATCH_TYPE));
toReturn.setCaller(rs.getString(ImportRoutine.CALLER));
toReturn.setComputationId(rs.getString(ImportRoutine.COMPUTATION_ID));
toReturn.setComputationOperator(rs.getString(ImportRoutine.COMPUTATION_OPID));
toReturn.setComputationOperatorName(rs.getString(ImportRoutine.COMPUTATION_OPNAME));
toReturn.setComputationRequest(rs.getString(ImportRoutine.COMPUTATION_REQ));
toReturn.setComputationUrl(rs.getString(ImportRoutine.COMPUTATION_URL));
toReturn.setEndTime(rs.getTimestamp(ImportRoutine.END).toInstant());
toReturn.setFarmId(rs.getLong(ImportRoutine.FARM_ID));
toReturn.setId(rs.getLong(ImportRoutine.ID));
toReturn.setLock(rs.getString(ImportRoutine.LOCK));
toReturn.setSourceUrl(rs.getString(ImportRoutine.SOURCE_URL));
toReturn.setSourceVersion(rs.getString(ImportRoutine.SOURCE_VERSION));
toReturn.setStartTime(rs.getTimestamp(ImportRoutine.START).toInstant());
toReturn.setStatus(ImportStatus.valueOf(rs.getString(ImportRoutine.STATUS)));
return toReturn;
}
}

View File

@ -21,13 +21,13 @@ public class ImportRoutineDescriptor {
private Long farmId;
private String batch_type;
private String sourceUrl;
private Integer sourceVersion;
private String sourceVersion;
private Instant startTime;
private Instant endTime;
private String status;
private String executionID;
private ImportStatus status;
private String lock;
private String caller;
private String computationId;