Class DtoConverters
- java.lang.Object
- 
- com.netflix.genie.common.internal.dtos.v4.converters.DtoConverters
 
- 
 public final class DtoConverters extends java.lang.ObjectUtility class to help converting between V3 and V4 DTOs during migration period.- Since:
- 4.0.0
 
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringGENIE_ID_PREFIXThe Genie 3 prefix for resource ID added to the set of tags by the system.static java.lang.StringGENIE_NAME_PREFIXThe Genie 3 prefix for resource names added to the set of tags by the system.
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static ClusterCriteriatoClusterCriteria(Criterion criterion)Convert the givencriterionto a V3ClusterCriteriaobject.static ApplicationtoV3Application(Application v4Application)Convert a V4 Application DTO to a V3 application DTO.static ApplicationStatustoV3ApplicationStatus(ApplicationStatus v4Status)Convert a V4ApplicationStatusto a V3ApplicationStatus.static ClustertoV3Cluster(Cluster v4Cluster)static ClusterStatustoV3ClusterStatus(ClusterStatus v4Status)Convert a V4ClusterStatusto a V3ClusterStatus.static CommandtoV3Command(Command v4Command)static CommandStatustoV3CommandStatus(CommandStatus v4Status)Convert a V4CommandStatusto a V3CommandStatus.static com.google.common.collect.ImmutableSet<java.lang.String>toV3CriterionTags(Criterion criterion)Convert a given V4criterionto the equivalent representation in V3 set of tags.static JobRequesttoV3JobRequest(JobRequest v4JobRequest)Helper method to convert a v4 JobRequest to a v3 job request.static JobStatustoV3JobStatus(JobStatus v4Status)static com.google.common.collect.ImmutableSet<java.lang.String>toV3Tags(java.lang.String id, java.lang.String name, java.util.Set<java.lang.String> tags)Convert the V4 values supplied to how the tags would have looked in Genie V3.static ApplicationtoV4Application(Application v3Application)Convert a V3 Application DTO to a V4 Application DTO.static ApplicationRequesttoV4ApplicationRequest(Application v3Application)Convert a V3Applicationto a corresponding V4ApplicationRequest.static ApplicationStatustoV4ApplicationStatus(ApplicationStatus v3Status)Convert a V3ApplicationStatusto a V4ApplicationStatus.static ApplicationStatustoV4ApplicationStatus(java.lang.String status)Attempt to convert an Application status string into a known enumeration value fromApplicationStatus.static ClustertoV4Cluster(Cluster v3Cluster)static ClusterRequesttoV4ClusterRequest(Cluster v3Cluster)Convert aClusterto a V4ClusterRequest.static ClusterStatustoV4ClusterStatus(ClusterStatus v3Status)Convert a V3ClusterStatusto a V4ClusterStatus.static ClusterStatustoV4ClusterStatus(java.lang.String status)Attempt to convert a Cluster status string into a known enumeration value fromClusterStatus.static CommandtoV4Command(Command v3Command)static CommandRequesttoV4CommandRequest(Command v3Command)Convert a V3Commandto a V4CommandRequest.static CommandStatustoV4CommandStatus(CommandStatus v3Status)Convert a V3CommandStatusto a V4CommandStatus.static CommandStatustoV4CommandStatus(java.lang.String status)Attempt to convert a Command status string into a known enumeration value fromCommandStatus.static CriteriontoV4Criterion(ClusterCriteria criteria)Convert a V3 Cluster Criteria to a V4 Criterion.static CriteriontoV4Criterion(java.util.Set<java.lang.String> tags)Convert a set of V3 criterion tags to a V4 criterion object.static JobRequesttoV4JobRequest(JobRequest v3JobRequest)Convert a V3 Job Request to a V4 Job Request.static JobStatustoV4JobStatus(JobStatus v3Status)static JobStatustoV4JobStatus(java.lang.String status)Attempt to convert a Job status string into a known enumeration value fromJobStatus.
 
- 
- 
- 
Field Detail- 
GENIE_ID_PREFIXpublic static final java.lang.String GENIE_ID_PREFIX The Genie 3 prefix for resource ID added to the set of tags by the system.- See Also:
- Constant Field Values
 
 - 
GENIE_NAME_PREFIXpublic static final java.lang.String GENIE_NAME_PREFIX The Genie 3 prefix for resource names added to the set of tags by the system.- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
toV4ApplicationRequestpublic static ApplicationRequest toV4ApplicationRequest(Application v3Application) throws java.lang.IllegalArgumentException Convert a V3Applicationto a corresponding V4ApplicationRequest.- Parameters:
- v3Application- The application to convert
- Returns:
- An immutable ApplicationRequestinstance
- Throws:
- java.lang.IllegalArgumentException- If any field is invalid during the conversion
 
 - 
toV4Applicationpublic static Application toV4Application(Application v3Application) throws java.lang.IllegalArgumentException Convert a V3 Application DTO to a V4 Application DTO.- Parameters:
- v3Application- The V3 application to convert
- Returns:
- The V4 application representation of the data in the V3 DTO
- Throws:
- java.lang.IllegalArgumentException- On invalid argument to one of the fields
 
 - 
toV3Applicationpublic static Application toV3Application(Application v4Application) throws java.lang.IllegalArgumentException Convert a V4 Application DTO to a V3 application DTO.- Parameters:
- v4Application- The V4 application to convert
- Returns:
- The V3 application representation of the data in the V4 DTO
- Throws:
- java.lang.IllegalArgumentException- On invalid argument for one of the fields
 
 - 
toV4ClusterRequestpublic static ClusterRequest toV4ClusterRequest(Cluster v3Cluster) Convert aClusterto a V4ClusterRequest.- Parameters:
- v3Cluster- The V3 cluster instance to convert
- Returns:
- An immutable ClusterRequestinstance
- Throws:
- java.lang.IllegalArgumentException- On any invalid field during conversion
 
 - 
toV4Clusterpublic static Cluster toV4Cluster(Cluster v3Cluster) throws java.lang.IllegalArgumentException - Parameters:
- v3Cluster- The cluster to convert
- Returns:
- The V4 representation of the cluster
- Throws:
- java.lang.IllegalArgumentException- On any invalid field during conversion
 
 - 
toV3Clusterpublic static Cluster toV3Cluster(Cluster v4Cluster) throws java.lang.IllegalArgumentException - Parameters:
- v4Cluster- The cluster to convert
- Returns:
- The v3 cluster
- Throws:
- java.lang.IllegalArgumentException- On any invalid field during conversion
 
 - 
toV4CommandRequestpublic static CommandRequest toV4CommandRequest(Command v3Command) throws java.lang.IllegalArgumentException Convert a V3Commandto a V4CommandRequest.- Parameters:
- v3Command- The V3 command to convert
- Returns:
- An immutable CommandRequestinstance
- Throws:
- java.lang.IllegalArgumentException- On any invalid field during conversion
 
 - 
toV4Commandpublic static Command toV4Command(Command v3Command) throws java.lang.IllegalArgumentException - Parameters:
- v3Command- The V3 Command to convert
- Returns:
- The V4 representation of the supplied command
- Throws:
- java.lang.IllegalArgumentException- On any invalid field during conversion
 
 - 
toV3Commandpublic static Command toV3Command(Command v4Command) throws java.lang.IllegalArgumentException - Parameters:
- v4Command- The V4 command to convert
- Returns:
- An immutable V3 Command instance
- Throws:
- java.lang.IllegalArgumentException- On any invalid field during conversion
 
 - 
toV4JobRequestpublic static JobRequest toV4JobRequest(JobRequest v3JobRequest) throws GeniePreconditionException Convert a V3 Job Request to a V4 Job Request.- Parameters:
- v3JobRequest- The v3 request to convert
- Returns:
- The V4 version of the information contained in the V3 request
- Throws:
- GeniePreconditionException- When the criteria is invalid
 
 - 
toV3JobRequestpublic static JobRequest toV3JobRequest(JobRequest v4JobRequest) Helper method to convert a v4 JobRequest to a v3 job request.- Parameters:
- v4JobRequest- The v4 job request instance
- Returns:
- The v3 job request instance
 
 - 
toV3Tagspublic static com.google.common.collect.ImmutableSet<java.lang.String> toV3Tags(java.lang.String id, java.lang.String name, java.util.Set<java.lang.String> tags)Convert the V4 values supplied to how the tags would have looked in Genie V3.- Parameters:
- id- The id of the resource
- name- The name of the resource
- tags- The tags on the resource
- Returns:
- The set of tags as they would have been in Genie 3
 
 - 
toV3CriterionTagspublic static com.google.common.collect.ImmutableSet<java.lang.String> toV3CriterionTags(Criterion criterion) Convert a given V4criterionto the equivalent representation in V3 set of tags.- Parameters:
- criterion- The- Criterionto convert
- Returns:
- A set of String's representing the criterion tags as they would have looked in V3
 
 - 
toClusterCriteriapublic static ClusterCriteria toClusterCriteria(Criterion criterion) Convert the givencriterionto a V3ClusterCriteriaobject.- Parameters:
- criterion- The- Criterionto convert
- Returns:
- The V3 criteria object
 
 - 
toV4Criterionpublic static Criterion toV4Criterion(ClusterCriteria criteria) throws GeniePreconditionException Convert a V3 Cluster Criteria to a V4 Criterion.- Parameters:
- criteria- The criteria to convert
- Returns:
- The criterion
- Throws:
- GeniePreconditionException- If the criteria converts to an invalid criterion
 
 - 
toV4Criterionpublic static Criterion toV4Criterion(java.util.Set<java.lang.String> tags) throws GeniePreconditionException Convert a set of V3 criterion tags to a V4 criterion object.- Parameters:
- tags- The tags to convert
- Returns:
- The V4 criterion
- Throws:
- GeniePreconditionException- If the tags convert to an invalid criterion
 
 - 
toV4ApplicationStatuspublic static ApplicationStatus toV4ApplicationStatus(ApplicationStatus v3Status) throws java.lang.IllegalArgumentException Convert a V3ApplicationStatusto a V4ApplicationStatus.- Parameters:
- v3Status- The V3 status to convert
- Returns:
- The V4 status the V3 status maps to
- Throws:
- java.lang.IllegalArgumentException- if the V3 status has no current V4 mapping
 
 - 
toV4ApplicationStatuspublic static ApplicationStatus toV4ApplicationStatus(java.lang.String status) throws java.lang.IllegalArgumentException Attempt to convert an Application status string into a known enumeration value fromApplicationStatus.- Parameters:
- status- The status string. Not null or empty.
- Returns:
- An ApplicationStatusinstance
- Throws:
- java.lang.IllegalArgumentException- If the string couldn't be converted
 
 - 
toV3ApplicationStatuspublic static ApplicationStatus toV3ApplicationStatus(ApplicationStatus v4Status) throws java.lang.IllegalArgumentException Convert a V4ApplicationStatusto a V3ApplicationStatus.- Parameters:
- v4Status- The V4 status to convert
- Returns:
- The V3 status the V4 status maps to
- Throws:
- java.lang.IllegalArgumentException- If the V4 status has no current V3 mapping
 
 - 
toV4CommandStatuspublic static CommandStatus toV4CommandStatus(CommandStatus v3Status) throws java.lang.IllegalArgumentException Convert a V3CommandStatusto a V4CommandStatus.- Parameters:
- v3Status- The V3 status to convert
- Returns:
- The V4 status the V3 status maps to
- Throws:
- java.lang.IllegalArgumentException- if the V3 status has no current V4 mapping
 
 - 
toV4CommandStatuspublic static CommandStatus toV4CommandStatus(java.lang.String status) throws java.lang.IllegalArgumentException Attempt to convert a Command status string into a known enumeration value fromCommandStatus.- Parameters:
- status- The status string. Not null or empty.
- Returns:
- An CommandStatusinstance
- Throws:
- java.lang.IllegalArgumentException- If the string couldn't be converted
 
 - 
toV3CommandStatuspublic static CommandStatus toV3CommandStatus(CommandStatus v4Status) throws java.lang.IllegalArgumentException Convert a V4CommandStatusto a V3CommandStatus.- Parameters:
- v4Status- The V4 status to convert
- Returns:
- The V3 status the V4 status maps to
- Throws:
- java.lang.IllegalArgumentException- If the V4 status has no current V3 mapping
 
 - 
toV4ClusterStatuspublic static ClusterStatus toV4ClusterStatus(ClusterStatus v3Status) throws java.lang.IllegalArgumentException Convert a V3ClusterStatusto a V4ClusterStatus.- Parameters:
- v3Status- The V3 status to convert
- Returns:
- The V4 status the V3 status maps to
- Throws:
- java.lang.IllegalArgumentException- if the V3 status has no current V4 mapping
 
 - 
toV4ClusterStatuspublic static ClusterStatus toV4ClusterStatus(java.lang.String status) throws java.lang.IllegalArgumentException Attempt to convert a Cluster status string into a known enumeration value fromClusterStatus.- Parameters:
- status- The status string. Not null or empty.
- Returns:
- An ClusterStatusinstance
- Throws:
- java.lang.IllegalArgumentException- If the string couldn't be converted
 
 - 
toV3ClusterStatuspublic static ClusterStatus toV3ClusterStatus(ClusterStatus v4Status) throws java.lang.IllegalArgumentException Convert a V4ClusterStatusto a V3ClusterStatus.- Parameters:
- v4Status- The V4 status to convert
- Returns:
- The V3 status the V4 status maps to
- Throws:
- java.lang.IllegalArgumentException- If the V4 status has no current V3 mapping
 
 - 
toV4JobStatuspublic static JobStatus toV4JobStatus(JobStatus v3Status) throws java.lang.IllegalArgumentException - Parameters:
- v3Status- The V3 status to convert
- Returns:
- The V4 status the V3 status maps to
- Throws:
- java.lang.IllegalArgumentException- if the V3 status has no current V4 mapping
 
 - 
toV3JobStatuspublic static JobStatus toV3JobStatus(JobStatus v4Status) throws java.lang.IllegalArgumentException - Parameters:
- v4Status- The V4 status to convert
- Returns:
- The V3 status the V4 status maps to
- Throws:
- java.lang.IllegalArgumentException- If the V4 status has no current V3 mapping
 
 - 
toV4JobStatuspublic static JobStatus toV4JobStatus(java.lang.String status) throws java.lang.IllegalArgumentException Attempt to convert a Job status string into a known enumeration value fromJobStatus.- Parameters:
- status- The status string. Not null or empty.
- Returns:
- A JobStatusinstance
- Throws:
- java.lang.IllegalArgumentException- If the string couldn't be converted
 
 
- 
 
-