use of org.karnak.backend.data.entity.DestinationEntity in project karnak by OsiriX-Foundation.
the class WarningRemoveProjectUsed method setText.
public void setText(ProjectEntity projectEntity) {
removeAll();
Div divTitle = new Div();
divTitle.setText(String.format("The project %s can't be remove", projectEntity.getName()));
divTitle.getStyle().set("font-size", "large").set("font-weight", "bolder").set("padding-bottom", "10px").set("color", "red");
Div divContent = new Div();
Div divIntro = new Div();
divIntro.setText("The project is used in the following destinations");
divIntro.getStyle().set("padding-bottom", "10px");
divContent.add(divIntro);
if (projectEntity.getDestinationEntities() != null) {
for (DestinationEntity destinationEntity : projectEntity.getDestinationEntities()) {
Div divDestination = new Div();
divDestination.setText(String.format("Type: %s, Description: %s, ForwardNode: %s", destinationEntity.getDestinationType(), destinationEntity.getDescription(), destinationEntity.getForwardNodeEntity().getFwdAeTitle()));
divDestination.getStyle().set("padding-left", "20px").set("padding-bottom", "5px");
divContent.add(divDestination);
}
}
Button cancelButton = new Button("Cancel", event -> {
close();
});
cancelButton.getStyle().set("margin-left", "75%");
add(divTitle, divContent, cancelButton);
}
use of org.karnak.backend.data.entity.DestinationEntity in project karnak by OsiriX-Foundation.
the class ForwardNodeRepoTest method testInvalidDestinationDicom_AETitle_mandatory.
@Test
void testInvalidDestinationDicom_AETitle_mandatory() {
ForwardNodeEntity forwardNodeEntity = ForwardNodeEntity.ofEmpty();
forwardNodeEntity.setFwdDescription("description");
forwardNodeEntity.setFwdAeTitle("fwdAeTitle");
DestinationEntity destinationEntity = DestinationEntity.ofDicom("description", null, "hostname", 123, null);
forwardNodeEntity.addDestination(destinationEntity);
String expectedMessage = "AETitle is mandatory";
Exception exception = assertThrows(ConstraintViolationException.class, () -> {
entityManager.persistAndFlush(forwardNodeEntity);
});
String actualMessage = exception.getMessage();
assertTrue(actualMessage.contains(expectedMessage));
}
use of org.karnak.backend.data.entity.DestinationEntity in project karnak by OsiriX-Foundation.
the class ForwardNodeRepoTest method testWithDestinationDicom.
// @Test
void testWithDestinationDicom() {
ForwardNodeEntity forwardNodeEntity = ForwardNodeEntity.ofEmpty();
forwardNodeEntity.setFwdDescription("description");
forwardNodeEntity.setFwdAeTitle("fwdAeTitle");
DestinationEntity destinationEntity = DestinationEntity.ofDicom("description", "aeTitle", "hostname", 123, null);
forwardNodeEntity.addDestination(destinationEntity);
entityManager.persistAndFlush(forwardNodeEntity);
Iterable<ForwardNodeEntity> all = repository.findAll();
//
assertThat(all).hasSize(//
1).first().satisfies(forwardNodeConsumer);
//
assertThat(all).hasSize(//
1).flatExtracting(//
ForwardNodeEntity::getSourceNodes).hasSize(0);
//
assertThat(all).hasSize(//
1).flatExtracting(//
ForwardNodeEntity::getDestinationEntities).hasSize(//
1).first().satisfies(destinationDicomConsumer);
}
use of org.karnak.backend.data.entity.DestinationEntity in project karnak by OsiriX-Foundation.
the class ForwardNodeRepoTest method testWithSourceNodeAndDestinationDicom.
// @Test
void testWithSourceNodeAndDestinationDicom() {
ForwardNodeEntity forwardNodeEntity = ForwardNodeEntity.ofEmpty();
forwardNodeEntity.setFwdDescription("description");
forwardNodeEntity.setFwdAeTitle("fwdAeTitle");
DicomSourceNodeEntity sourceNode = DicomSourceNodeEntity.ofEmpty();
sourceNode.setDescription("description");
sourceNode.setAeTitle("aeTitle");
sourceNode.setHostname("hostname");
sourceNode.setCheckHostname(Boolean.TRUE);
forwardNodeEntity.addSourceNode(sourceNode);
DestinationEntity destinationEntity = DestinationEntity.ofDicom("description", "aeTitle", "hostname", 123, null);
forwardNodeEntity.addDestination(destinationEntity);
entityManager.persistAndFlush(forwardNodeEntity);
Iterable<ForwardNodeEntity> all = repository.findAll();
//
assertThat(all).hasSize(//
1).first().satisfies(forwardNodeConsumer);
//
assertThat(all).hasSize(//
1).flatExtracting(//
ForwardNodeEntity::getSourceNodes).hasSize(//
1).first().satisfies(sourceNodeConsumer);
//
assertThat(all).hasSize(//
1).flatExtracting(//
ForwardNodeEntity::getDestinationEntities).hasSize(//
1).first().satisfies(destinationDicomConsumer);
}
use of org.karnak.backend.data.entity.DestinationEntity in project karnak by OsiriX-Foundation.
the class ForwardNodeRepoTest method testWithDestinationStow.
// @Test
void testWithDestinationStow() {
ForwardNodeEntity forwardNodeEntity = ForwardNodeEntity.ofEmpty();
forwardNodeEntity.setFwdDescription("description");
forwardNodeEntity.setFwdAeTitle("fwdAeTitle");
DestinationEntity destinationEntity = DestinationEntity.ofStow("description", "url", "urlCredentials", "headers");
forwardNodeEntity.addDestination(destinationEntity);
entityManager.persistAndFlush(forwardNodeEntity);
Iterable<ForwardNodeEntity> all = repository.findAll();
//
assertThat(all).hasSize(//
1).first().satisfies(forwardNodeConsumer);
//
assertThat(all).hasSize(//
1).flatExtracting(//
ForwardNodeEntity::getSourceNodes).hasSize(0);
//
assertThat(all).hasSize(//
1).flatExtracting(//
ForwardNodeEntity::getDestinationEntities).hasSize(//
1).first().satisfies(destinationStowConsumer);
}
Aggregations