public final class EntityDtoConverters
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
setJsonField(com.fasterxml.jackson.databind.JsonNode json,
java.util.function.Consumer<java.lang.String> consumer)
Given a JSON node convert it to a string representation and hand it to the consumer.
|
static Criterion |
toCriterionDto(CriterionEntity criterionEntity)
Convert a given
CriterionEntity to the equivalent Criterion DTO representation. |
static FinishedJob |
toFinishedJobDto(FinishedJobProjection finishedJobProjection)
Convert a given
FinishedJobProjection to the equivalent FinishedJob DTO representation. |
static JobSpecification |
toJobSpecificationDto(JobSpecificationProjection jobSpecificationProjection)
Convert the values contained in the
JobSpecificationProjection to an immutable JobSpecification
DTO. |
static Application |
toV4ApplicationDto(ApplicationEntity applicationEntity)
Convert an application entity to a DTO for external exposure.
|
static Cluster |
toV4ClusterDto(ClusterEntity clusterEntity)
Convert a cluster entity to a DTO for external exposure.
|
static Command |
toV4CommandDto(CommandEntity commandEntity)
Convert a command entity to a DTO for external exposure.
|
static JobRequest |
toV4JobRequestDto(V4JobRequestProjection jobRequestProjection)
Convert a job request entity to a DTO.
|
public static Application toV4ApplicationDto(ApplicationEntity applicationEntity)
applicationEntity
- The entity to convertpublic static Cluster toV4ClusterDto(ClusterEntity clusterEntity)
clusterEntity
- The entity to convertpublic static Command toV4CommandDto(CommandEntity commandEntity)
commandEntity
- The entity to convertpublic static JobRequest toV4JobRequestDto(V4JobRequestProjection jobRequestProjection)
jobRequestProjection
- The projection of the JobEntity
to
convertGenieRuntimeException
- When criterion can't be properly convertedpublic static Criterion toCriterionDto(CriterionEntity criterionEntity)
CriterionEntity
to the equivalent Criterion
DTO representation.criterionEntity
- The entity to convertpublic static FinishedJob toFinishedJobDto(FinishedJobProjection finishedJobProjection)
FinishedJobProjection
to the equivalent FinishedJob
DTO representation.finishedJobProjection
- the entity projectionpublic static void setJsonField(@Nullable com.fasterxml.jackson.databind.JsonNode json, java.util.function.Consumer<java.lang.String> consumer)
json
- The JSON node to convert. If null null will be passed to the consumerconsumer
- The consumer function to call with the string representationpublic static JobSpecification toJobSpecificationDto(JobSpecificationProjection jobSpecificationProjection)
JobSpecificationProjection
to an immutable JobSpecification
DTO.jobSpecificationProjection
- The entity values to convertGenieClusterNotFoundException
- When the cluster isn't found in the database which it should be at this
point given the input to the db was valid at the time of persistenceGenieCommandNotFoundException
- When the command isn't found in the database which it should be at this
point given the input to the db was valid at the time of persistenceGenieRuntimeException
- All input should be valid at this point so if we can't create a job spec
dto something has become corrupted in the db