use of bio.fkaiser.fit3d.web.model.ExchangeDefinition in project fit3d by fkaiserbio.
the class JobConverter method toFit3DJob.
@SuppressWarnings("unchecked")
public static Fit3DJob toFit3DJob(Document jobDocument) {
Document parametersObject = (Document) jobDocument.get("parameters");
List<ExchangeDefinition> exchangeDefinitions = ((List<String>) parametersObject.get("exchangeDefinitions")).stream().map(ExchangeDefinition::fromString).collect(Collectors.toList());
Fit3DJobParameters parameters = new Fit3DJobParameters();
parameters.setAtomFilterType(AtomFilterType.valueOf((String) parametersObject.get("atomFilterType")));
parameters.setPdbTargetList((boolean) parametersObject.get("pdbTargetList"));
parameters.setChainTargetList((boolean) parametersObject.get("chainTargetList"));
parameters.setTargetListPath(Paths.get((String) parametersObject.get("targetListPath")));
parameters.setMotifPath(Paths.get((String) parametersObject.get("motifPath")));
parameters.setStatisticalModelType(StatisticalModelType.valueOf((String) parametersObject.get("statisticalModel")));
parameters.setRmsdLimit((double) parametersObject.get("rmsdLimit"));
parameters.setExchangeDefinitions(exchangeDefinitions);
Fit3DJob fit3dJob = new Fit3DJob();
fit3dJob.setTimeStamp(LocalDateTime.parse((String) jobDocument.get("timeStamp")));
fit3dJob.setSessionIdentifier((UUID.fromString((String) jobDocument.get("sessionIdentifier"))));
fit3dJob.setIpAddress((String) jobDocument.get("ipAddress"));
fit3dJob.setJobIdentifier(UUID.fromString((String) jobDocument.get("jobIdentifier")));
fit3dJob.setJobPath(Paths.get((String) jobDocument.get("jobPath")));
fit3dJob.setDescription((String) jobDocument.get("description"));
fit3dJob.setEmail((String) jobDocument.get("email"));
fit3dJob.setEnqueued((boolean) jobDocument.get("enqueued"));
fit3dJob.setRunning((boolean) jobDocument.get("running"));
fit3dJob.setFinished((boolean) jobDocument.get("finished"));
fit3dJob.setFailed((boolean) jobDocument.get("failed"));
fit3dJob.setSendMail((boolean) jobDocument.get("sendMail"));
fit3dJob.setErrorMessage((String) jobDocument.get("errorMessage"));
fit3dJob.setParameters(parameters);
return fit3dJob;
}
Aggregations