Commit b5f81db2 authored by R.W.Majeed's avatar R.W.Majeed
Browse files

static createInstance will use supplied id and source information

parent b2ad31fc
......@@ -23,18 +23,29 @@ package de.sekmi.histream.impl;
import de.sekmi.histream.Extension;
import de.sekmi.histream.Observation;
import de.sekmi.histream.ext.ExternalSourceType;
import de.sekmi.histream.ext.Patient;
public class SimplePatientExtension implements Extension<PatientImpl>{
private final static Class<?>[] TYPES = new Class<?>[]{Patient.class, PatientImpl.class};
@Override
public Class<?>[] getInstanceTypes() {return TYPES;}
@Override
public PatientImpl createInstance(Object... args) {
// TODO use string patient id as identification
return new PatientImpl();
if( args.length != 2 || !(args[0] instanceof String) || !(args[1] instanceof ExternalSourceType) ){
throw new IllegalArgumentException("need String patid, ExternalSourceType source");
}
PatientImpl p = new PatientImpl();
p.setId((String)args[0]);
ExternalSourceType s = (ExternalSourceType)args[1];
p.setSourceId(s.getSourceId());
p.setSourceTimestamp(s.getSourceTimestamp());
return p;
}
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment