Class PlantUmlDiagramEngine
java.lang.Object
io.jmix.datatools.datamodel.engine.plantuml.impl.PlantUmlDiagramEngine
- All Implemented Interfaces:
DiagramEngine
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected final booleanprotected final intprotected final DatatoolsPropertiesprotected final Stringprotected final PlantUmlEncoderprotected static final Stringprotected final Stringprotected final org.springframework.web.client.RestClientprotected final Stringprotected final String -
Constructor Summary
ConstructorsConstructorDescriptionPlantUmlDiagramEngine(DatatoolsProperties datatoolsProperties, Metadata metadata, CoreProperties coreProperties) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.web.client.RestClientconfigureClient(String baseUrl) constructEntityDescription(String entityName, String dataStoreName, List<AttributeModel> attributeModelList) Constructs a description of an entity in the format required by the selected diagramming library.constructRelationDescription(String currentEntityType, String refEntityType, RelationType relationType, String dataStoreName) Constructs a string representation of a relationship between two entities in a specific format for use with a diagramming library.protected Stringprotected Stringprotected PlantUmlEncoderprotected Stringprotected Stringprotected Stringprotected Stringbyte[]generateDiagram(String entitiesDescription, String relationsDescriptions) Generates a diagram in a binary format based on the provided descriptions of entities and their relationships.protected intgetDataStoresCount(Metadata metadata) booleanIndicates whether diagram generation is permitted under the current configuration.booleanChecks the availability of the remote diagramming service.protected byte[]receiveDiagramFile(String diagramDescription) protected booleanresolveAvailable(CoreProperties coreProperties)
-
Field Details
-
PUBLIC_PLANTUML_SERVER
- See Also:
-
datatoolsProperties
-
plantUmlEncoder
-
template
-
entityTemplate
-
attributeTemplate
-
relationTemplate
-
urlTemplate
-
restClient
protected final org.springframework.web.client.RestClient restClient -
dataStoresCount
protected final int dataStoresCount -
available
protected final boolean available
-
-
Constructor Details
-
PlantUmlDiagramEngine
public PlantUmlDiagramEngine(DatatoolsProperties datatoolsProperties, Metadata metadata, CoreProperties coreProperties)
-
-
Method Details
-
resolveAvailable
-
getDataStoresCount
-
createBaseURL
-
createEncoder
-
createTemplate
-
createURLTemplate
-
createEntityTemplate
-
createAttributeTemplate
-
createRelationTemplate
-
configureClient
-
receiveDiagramFile
-
constructEntityDescription
public String constructEntityDescription(String entityName, String dataStoreName, List<AttributeModel> attributeModelList) Description copied from interface:DiagramEngineConstructs a description of an entity in the format required by the selected diagramming library.- Specified by:
constructEntityDescriptionin interfaceDiagramEngine- Parameters:
entityName- the name of the entity to be describeddataStoreName- the name of the data store where the entity residesattributeModelList- a list of attributes that define the structure of the entity- Returns:
- a string representing the description of the entity in the required format
-
constructRelationDescription
public String constructRelationDescription(String currentEntityType, String refEntityType, RelationType relationType, String dataStoreName) Description copied from interface:DiagramEngineConstructs a string representation of a relationship between two entities in a specific format for use with a diagramming library.- Specified by:
constructRelationDescriptionin interfaceDiagramEngine- Parameters:
currentEntityType- the type of the current entity involved in the relationshiprefEntityType- the type of the referenced entity involved in the relationshiprelationType- the type of the relationship (e.g., MANY_TO_ONE, ONE_TO_MANY)dataStoreName- the name of the data store where the entities reside- Returns:
- a string describing the relationship between the specified entities in the required format
-
pingService
public boolean pingService()Description copied from interface:DiagramEngineChecks the availability of the remote diagramming service.- Specified by:
pingServicein interfaceDiagramEngine- Returns:
trueif the service is accessible, otherwisefalse.
-
isAvailable
public boolean isAvailable()Description copied from interface:DiagramEngineIndicates whether diagram generation is permitted under the current configuration. UnlikeDiagramEngine.pingService(), which checks network reachability, this reflects configuration and security policy. For example, generating diagrams via the public PlantUML server may be disabled when no private server is configured.- Specified by:
isAvailablein interfaceDiagramEngine- Returns:
trueif diagram generation is allowed, otherwisefalse.
-
generateDiagram
Description copied from interface:DiagramEngineGenerates a diagram in a binary format based on the provided descriptions of entities and their relationships.- Specified by:
generateDiagramin interfaceDiagramEngine- Parameters:
entitiesDescription- a string containing the descriptions of entities to be included in the diagramrelationsDescriptions- a string containing the descriptions of relationships between entities- Returns:
- a byte array representing the generated diagram
-