Class EntityV4DtoConverters

java.lang.Object
com.netflix.genie.web.data.services.impl.jpa.converters.EntityV4DtoConverters

public final class EntityV4DtoConverters extends Object
Utility methods for converting from DTO to entities and vice versa.
Since:
4.0.0
  • Method Details

    • toV4ApplicationDto

      public static com.netflix.genie.common.internal.dtos.Application toV4ApplicationDto(ApplicationEntity applicationEntity) throws 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:
      IllegalArgumentException - On invalid field
    • toV4ClusterDto

      public static com.netflix.genie.common.internal.dtos.Cluster toV4ClusterDto(ClusterEntity clusterEntity) throws 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:
      IllegalArgumentException - On any invalid field value
    • toV4CommandDto

      public static com.netflix.genie.common.internal.dtos.Command toV4CommandDto(CommandEntity commandEntity) throws 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:
      IllegalArgumentException - On any invalid field value
    • toV4JobRequestDto

      public static com.netflix.genie.common.internal.dtos.JobRequest toV4JobRequestDto(JobRequestProjection jobRequestProjection)
      Convert a job request entity to a DTO.
      Parameters:
      jobRequestProjection - The projection of the JobRequestProjection to convert
      Returns:
      The original job request DTO
      Throws:
      com.netflix.genie.common.internal.exceptions.unchecked.GenieRuntimeException - When criterion can't be properly converted
    • toCriterionDto

      public static com.netflix.genie.common.internal.dtos.Criterion toCriterionDto(CriterionEntity criterionEntity)
      Convert a given CriterionEntity to the equivalent Criterion DTO representation.
      Parameters:
      criterionEntity - The entity to convert
      Returns:
      The DTO representation
    • toFinishedJobDto

      public static com.netflix.genie.common.internal.dtos.FinishedJob toFinishedJobDto(FinishedJobProjection finishedJobProjection) throws IllegalArgumentException
      Convert a given FinishedJobProjection to the equivalent FinishedJob DTO representation.
      Parameters:
      finishedJobProjection - the entity projection
      Returns:
      the DTO representation
      Throws:
      IllegalArgumentException - On any invalid field
    • toJobSpecificationDto

      public static com.netflix.genie.common.internal.dtos.JobSpecification toJobSpecificationDto(JobSpecificationProjection jobSpecificationProjection)
      Convert the values contained in the JobSpecificationProjection to an immutable JobSpecification DTO.
      Parameters:
      jobSpecificationProjection - The entity values to convert
      Returns:
      An immutable Job Specification instance
      Throws:
      com.netflix.genie.common.internal.exceptions.unchecked.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 persistence
      com.netflix.genie.common.internal.exceptions.unchecked.GenieCommandNotFoundException - 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 persistence
      com.netflix.genie.common.internal.exceptions.unchecked.GenieRuntimeException - 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