return eventInfo;
}
boolean addDicomDirRecords(Association as, Attributes ds, Attributes fmi,
File f) throws IOException {
DicomDirWriter ddWriter = getDicomDirWriter();
RecordFactory recFact = getRecordFactory();
String pid = ds.getString(Tag.PatientID, null);
String styuid = ds.getString(Tag.StudyInstanceUID, null);
String seruid = ds.getString(Tag.SeriesInstanceUID, null);
String iuid = fmi.getString(Tag.MediaStorageSOPInstanceUID, null);
if (pid == null)
ds.setString(Tag.PatientID, VR.LO, pid = styuid);
Attributes patRec = ddWriter.findPatientRecord(pid);
if (patRec == null) {
patRec = recFact.createRecord(RecordType.PATIENT, null,
ds, null, null);
ddWriter.addRootDirectoryRecord(patRec);
}
Attributes studyRec = ddWriter.findStudyRecord(patRec, styuid);
if (studyRec == null) {
studyRec = recFact.createRecord(RecordType.STUDY, null,
ds, null, null);
ddWriter.addLowerDirectoryRecord(patRec, studyRec);
}
Attributes seriesRec = ddWriter.findSeriesRecord(studyRec, seruid);
if (seriesRec == null) {
seriesRec = recFact.createRecord(RecordType.SERIES, null,
ds, null, null);
ddWriter.addLowerDirectoryRecord(studyRec, seriesRec);
}
Attributes instRec =
ddWriter.findLowerInstanceRecord(seriesRec, false, iuid);
if (instRec != null)
return false;
instRec = recFact.createRecord(ds, fmi, ddWriter.toFileIDs(f));
ddWriter.addLowerDirectoryRecord(seriesRec, instRec);
ddWriter.commit();
return true;
}