1 package org.oxerr.viagogo.model.request.catalog; 2 3 import java.time.LocalDateTime; 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 9 import io.openapitools.jackson.dataformat.hal.HALLink; 10 11 public class SearchEventRequest extends EventRequest { 12 13 private static final long serialVersionUID = 2023021301L; 14 15 private String q; 16 17 private LocalDateTime dateLocal; 18 19 public static SearchEventRequest from(HALLink halLink) { 20 return new SearchEventRequest(new Link(halLink)); 21 } 22 23 public SearchEventRequest() { 24 } 25 26 public SearchEventRequest(Link link) { 27 super(link); 28 29 this.setQ(link.getFirstAsString("q")); 30 this.setDateLocal(link.getFirstAsLocalDateTime("dateLocal")); 31 } 32 33 public SearchEventRequest(String q, LocalDateTime dateLocal) { 34 this.q = q; 35 this.dateLocal = dateLocal; 36 } 37 38 public String getQ() { 39 return q; 40 } 41 42 public void setQ(String q) { 43 this.q = q; 44 } 45 46 public LocalDateTime getDateLocal() { 47 return dateLocal; 48 } 49 50 public void setDateLocal(LocalDateTime dateLocal) { 51 this.dateLocal = dateLocal; 52 } 53 54 @Override 55 public int hashCode() { 56 return HashCodeBuilder.reflectionHashCode(this); 57 } 58 59 @Override 60 public boolean equals(Object obj) { 61 if (this == obj) { 62 return true; 63 } 64 if (!(obj instanceof SearchEventRequest)) { 65 return false; 66 } 67 SearchEventRequest rhs = (SearchEventRequest) obj; 68 return EqualsBuilder.reflectionEquals(this, rhs); 69 } 70 71 }