View Javadoc
1   package org.oxerr.viagogo.model.request.catalog;
2   
3   import java.util.Locale;
4   
5   import org.apache.commons.lang3.builder.EqualsBuilder;
6   import org.apache.commons.lang3.builder.HashCodeBuilder;
7   import org.oxerr.viagogo.model.Link;
8   import org.oxerr.viagogo.model.request.PagedRequest;
9   
10  import io.openapitools.jackson.dataformat.hal.HALLink;
11  
12  public class EventRequest extends PagedRequest {
13  
14  	private static final long serialVersionUID = 2023021301L;
15  
16  	public enum Sort implements PagedRequest.Sort {
17  
18  		RESOURCE_VERSION;
19  
20  		@Override
21  		public String getCode() {
22  			return this.name().toLowerCase(Locale.US);
23  		}
24  
25  	}
26  
27  	private Long minResourceVersion;
28  
29  	private String countryCode;
30  
31  	private Double latitude;
32  
33  	private Double longitude;
34  
35  	private Integer maxDistanceInMeters;
36  
37  	private Integer genreId;
38  
39  	public static EventRequest from(HALLink halLink) {
40  		return new EventRequest(new Link(halLink));
41  	}
42  
43  	public EventRequest() {
44  	}
45  
46  	public EventRequest(Link link) {
47  		super(link);
48  
49  		this.setMinResourceVersion(link.getFirstAsLong("min_resource_version"));
50  		this.setCountryCode(link.getFirstAsString("country_code"));
51  		this.setLatitude(link.getFirstAsDouble("latitude"));
52  		this.setLongitude(link.getFirstAsDouble("longitude"));
53  		this.setMaxDistanceInMeters(link.getFirstAsInteger("max_distance_in_meters"));
54  		this.setGenreId(link.getFirstAsInteger("genre_id"));
55  	}
56  
57  	public Long getMinResourceVersion() {
58  		return minResourceVersion;
59  	}
60  
61  	public void setMinResourceVersion(Long minResourceVersion) {
62  		this.minResourceVersion = minResourceVersion;
63  	}
64  
65  	public String getCountryCode() {
66  		return countryCode;
67  	}
68  
69  	public void setCountryCode(String countryCode) {
70  		this.countryCode = countryCode;
71  	}
72  
73  	public Double getLatitude() {
74  		return latitude;
75  	}
76  
77  	public void setLatitude(Double latitude) {
78  		this.latitude = latitude;
79  	}
80  
81  	public Double getLongitude() {
82  		return longitude;
83  	}
84  
85  	public void setLongitude(Double longitude) {
86  		this.longitude = longitude;
87  	}
88  
89  	public Integer getMaxDistanceInMeters() {
90  		return maxDistanceInMeters;
91  	}
92  
93  	public void setMaxDistanceInMeters(Integer maxDistanceInMeters) {
94  		this.maxDistanceInMeters = maxDistanceInMeters;
95  	}
96  
97  	public Integer getGenreId() {
98  		return genreId;
99  	}
100 
101 	public void setGenreId(Integer genreId) {
102 		this.genreId = genreId;
103 	}
104 
105 	@Override
106 	public int hashCode() {
107 		return HashCodeBuilder.reflectionHashCode(this);
108 	}
109 
110 	@Override
111 	public boolean equals(Object obj) {
112 		if (this == obj) {
113 			return true;
114 		}
115 		if (!(obj instanceof EventRequest)) {
116 			return false;
117 		}
118 		EventRequest rhs = (EventRequest) obj;
119 		return EqualsBuilder.reflectionEquals(this, rhs);
120 	}
121 
122 }