Global extends DefaultTagable { public void init(Tagable tagable) { clear(); tags.put(TagD.get(Tag.StudyInstanceUID), UIDUtils.createUID()); if (tagable != null) { tagable.getTagEntrySetIterator().forEachRemaining(i -> { TagW tag = i.getKey(); if (tag != null) { tags.put(tag, i.getValue()); } }); } allowFullEdition = getTagValue(TagD.get(Tag.PatientID)) == null || getTagValue(TagD.get(Tag.PatientName)) == null; } Global(); void init(Tagable tagable); void updateAllButPatient(Tagable tagable); boolean containsSameTagValues(Tagable tagable, Integer dicomGroupNumber); @Override String toString(); boolean isAllowFullEdition(); static final Integer patientDicomGroupNumber; }
@Test public void testInitWithEmptyTagable() throws Exception { global = new Global(); global.init(tagable); assertThat(global.containTagKey(TagD.get(Tag.StudyInstanceUID))).isTrue(); assertThat(global.getTagValue(TagD.get(Tag.StudyInstanceUID))).isNotNull(); }
@Test public void testInit() throws Exception { global = new Global(); DefaultTagable tags = new DefaultTagable(); tags.setTag(GlobalTag.patientId.tagW, GlobalTag.patientId.value); tags.setTag(GlobalTag.patientName.tagW, GlobalTag.patientName.value); tags.setTag(GlobalTag.issuerOfPatientId.tagW, GlobalTag.issuerOfPatientId.value); tags.setTag(GlobalTag.patientBirthDate.tagW, GlobalTag.patientBirthDate.value); tags.setTag(GlobalTag.patientSex.tagW, GlobalTag.patientSex.value); tags.setTag(GlobalTag.studyDate.tagW, GlobalTag.studyDate.value); tags.setTag(GlobalTag.modality.tagW, GlobalTag.modality.value); global.init(tags); assertThat(global.getTagEntrySet()).hasSize(8); }