use of org.karnak.backend.data.entity.ProfileElementEntity in project karnak by OsiriX-Foundation.
the class ProfileElementRepoTest method shouldFindAllRecords.
/**
* Test find all.
*/
@Test
void shouldFindAllRecords() {
// Create an entity to save
// Profile
ProfileEntity profileEntity = new ProfileEntity();
profileEntity.setName("name");
profileEntity = profileRepo.saveAndFlush(profileEntity);
// ProfileElement
ProfileElementEntity entity = new ProfileElementEntity();
entity.setName("Name");
entity.setProfileEntity(profileEntity);
// Save the entity
LOGGER.info("Saving entity with name [{}]", entity.getName());
repository.saveAndFlush(entity);
// Find all
List<ProfileElementEntity> all = repository.findAll();
// Test find all
assertNotNull(all);
assertTrue(all.size() > 0);
assertEquals(1, all.size());
LOGGER.info("Number of entities found [{}]", all.size());
}
use of org.karnak.backend.data.entity.ProfileElementEntity in project karnak by OsiriX-Foundation.
the class ProfileErrorView method setView.
public void setView(ArrayList<ProfileError> profileErrors) {
removeAll();
add(new H2("Errors occured in profile elements"));
for (ProfileError profileError : profileErrors) {
ProfileElementEntity profileElementEntity = profileError.getProfileElement();
Div profileName = setProfileName((profileElementEntity.getPosition() + 1) + ". " + profileElementEntity.getName());
add(profileName);
if (profileError.getError() != null) {
profileName.add(setErrorIcon());
add(setProfileError("Error : " + profileError.getError()));
} else {
profileName.add(setSuccessIcon());
}
setProfileShowHide(profileElementEntity);
}
}
use of org.karnak.backend.data.entity.ProfileElementEntity in project karnak by OsiriX-Foundation.
the class ArgumentRepoTest method shouldFindAllRecords.
/**
* Test find all.
*/
@Test
void shouldFindAllRecords() {
// Create an entity to save
// Profile
ProfileEntity profileEntity = new ProfileEntity();
profileEntity.setName("name");
profileEntity = profileRepo.saveAndFlush(profileEntity);
// Profile element
ProfileElementEntity profileElementEntity = new ProfileElementEntity();
profileElementEntity.setName("name");
profileElementEntity.setProfileEntity(profileEntity);
profileElementEntity = profileElementRepo.saveAndFlush(profileElementEntity);
// Argument
ArgumentEntity entity = new ArgumentEntity();
entity.setKey("Key");
entity.setProfileElementEntity(profileElementEntity);
// Save the entity
LOGGER.info("Saving entity with Key [{}]", entity.getKey());
repository.saveAndFlush(entity);
// Find all
List<ArgumentEntity> all = repository.findAll();
// Test find all
assertNotNull(all);
assertTrue(all.size() > 0);
assertEquals(1, all.size());
LOGGER.info("Number of entities found [{}]", all.size());
}
use of org.karnak.backend.data.entity.ProfileElementEntity in project karnak by OsiriX-Foundation.
the class AttributesByDefaultTest method should_set_deIdentification_method_code_sequence.
@Test
void should_set_deIdentification_method_code_sequence() {
// Init data
Attributes attributes = new Attributes();
ProjectEntity projectEntity = new ProjectEntity();
ProfileEntity profileEntity = new ProfileEntity();
Set<ProfileElementEntity> profileElementEntities = new HashSet<>();
ProfileElementEntity profileElementEntityBasic = new ProfileElementEntity();
profileElementEntityBasic.setCodename("basic.dicom.profile");
profileElementEntityBasic.setName("nameBasic");
ProfileElementEntity profileElementEntityCleanPixelData = new ProfileElementEntity();
profileElementEntityCleanPixelData.setCodename("clean.pixel.data");
profileElementEntityCleanPixelData.setName("nameCleanPixel");
profileElementEntityBasic.setPosition(1);
profileElementEntityCleanPixelData.setPosition(2);
profileElementEntityBasic.setAction("ReplaceNull");
profileElementEntityCleanPixelData.setAction("ReplaceNull");
profileElementEntities.add(profileElementEntityBasic);
profileElementEntities.add(profileElementEntityCleanPixelData);
profileEntity.setProfileElementEntities(profileElementEntities);
projectEntity.setProfileEntity(profileEntity);
// Call method
AttributesByDefault.setDeidentificationMethodCodeSequence(attributes, projectEntity);
// Test results
assertNotNull(attributes.getValue(Tag.DeidentificationMethodCodeSequence));
Sequence sequence = (Sequence) attributes.getValue(Tag.DeidentificationMethodCodeSequence);
assertEquals("113100", sequence.get(0).getValue(Tag.CodeValue));
assertEquals("DCM", sequence.get(0).getValue(Tag.CodingSchemeDesignator));
assertEquals(ProfileItemType.getCodeMeaning("basic.dicom.profile"), sequence.get(0).getValue(Tag.CodeMeaning));
assertEquals("113101", sequence.get(1).getValue(Tag.CodeValue));
assertEquals("DCM", sequence.get(1).getValue(Tag.CodingSchemeDesignator));
assertEquals(ProfileItemType.getCodeMeaning("clean.pixel.data"), sequence.get(1).getValue(Tag.CodeMeaning));
}
use of org.karnak.backend.data.entity.ProfileElementEntity in project karnak by OsiriX-Foundation.
the class ProfileTest method should_evaluate_condition_clean_pixel_case_exclude_station_name.
@Test
void should_evaluate_condition_clean_pixel_case_exclude_station_name() {
// Init data
ProfileEntity profileEntity = new ProfileEntity();
Attributes attributes = new Attributes();
attributes.setString(Tag.StationName, VR.SH, "ICT256");
Set<ProfileElementEntity> profileElementEntities = new HashSet<>();
ProfileElementEntity profileElementEntityCleanPixelData = new ProfileElementEntity();
profileElementEntityCleanPixelData.setCodename("clean.pixel.data");
profileElementEntityCleanPixelData.setName("nameCleanPixel");
profileElementEntityCleanPixelData.setAction("ReplaceNull");
profileElementEntityCleanPixelData.setCondition("!tagValueContains(#Tag.StationName,'ICT256')");
profileElementEntities.add(profileElementEntityCleanPixelData);
profileEntity.setProfileElementEntities(profileElementEntities);
Profile profile = new Profile(profileEntity);
// Evaluate condition
boolean evaluation = profile.evaluateConditionCleanPixelData(attributes);
// Test results
assertFalse(evaluation);
}
Aggregations