Class EntityV4DtoConverters
- java.lang.Object
-
- com.netflix.genie.web.data.services.impl.jpa.converters.EntityV4DtoConverters
-
public final class EntityV4DtoConverters extends java.lang.Object
Utility methods for converting from DTO to entities and vice versa.- Since:
- 4.0.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Criterion
toCriterionDto(CriterionEntity criterionEntity)
Convert a givenCriterionEntity
to the equivalentCriterion
DTO representation.static FinishedJob
toFinishedJobDto(FinishedJobProjection finishedJobProjection)
Convert a givenFinishedJobProjection
to the equivalentFinishedJob
DTO representation.static JobSpecification
toJobSpecificationDto(JobSpecificationProjection jobSpecificationProjection)
Convert the values contained in theJobSpecificationProjection
to an immutableJobSpecification
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(JobRequestProjection jobRequestProjection)
Convert a job request entity to a DTO.
-
-
-
Method Detail
-
toV4ApplicationDto
public static Application toV4ApplicationDto(ApplicationEntity applicationEntity) throws java.lang.IllegalArgumentException
Convert an application entity to a DTO for external exposure.- Parameters:
applicationEntity
- The entity to convert- Returns:
- The immutable DTO representation of the entity data
- Throws:
java.lang.IllegalArgumentException
- On invalid field
-
toV4ClusterDto
public static Cluster toV4ClusterDto(ClusterEntity clusterEntity) throws java.lang.IllegalArgumentException
Convert a cluster entity to a DTO for external exposure.- Parameters:
clusterEntity
- The entity to convert- Returns:
- The immutable DTO representation of the entity data
- Throws:
java.lang.IllegalArgumentException
- On any invalid field value
-
toV4CommandDto
public static Command toV4CommandDto(CommandEntity commandEntity) throws java.lang.IllegalArgumentException
Convert a command entity to a DTO for external exposure.- Parameters:
commandEntity
- The entity to convert- Returns:
- The immutable DTO representation of the entity data
- Throws:
java.lang.IllegalArgumentException
- On any invalid field value
-
toV4JobRequestDto
public static JobRequest toV4JobRequestDto(JobRequestProjection jobRequestProjection)
Convert a job request entity to a DTO.- Parameters:
jobRequestProjection
- The projection of theJobRequestProjection
to convert- Returns:
- The original job request DTO
- Throws:
GenieRuntimeException
- When criterion can't be properly converted
-
toCriterionDto
public static Criterion toCriterionDto(CriterionEntity criterionEntity)
Convert a givenCriterionEntity
to the equivalentCriterion
DTO representation.- Parameters:
criterionEntity
- The entity to convert- Returns:
- The DTO representation
-
toFinishedJobDto
public static FinishedJob toFinishedJobDto(FinishedJobProjection finishedJobProjection) throws java.lang.IllegalArgumentException
Convert a givenFinishedJobProjection
to the equivalentFinishedJob
DTO representation.- Parameters:
finishedJobProjection
- the entity projection- Returns:
- the DTO representation
- Throws:
java.lang.IllegalArgumentException
- On any invalid field
-
toJobSpecificationDto
public static JobSpecification toJobSpecificationDto(JobSpecificationProjection jobSpecificationProjection)
Convert the values contained in theJobSpecificationProjection
to an immutableJobSpecification
DTO.- Parameters:
jobSpecificationProjection
- The entity values to convert- Returns:
- An immutable Job Specification instance
- Throws:
GenieClusterNotFoundException
- 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
-
-