Skip to content

Instantly share code, notes, and snippets.

@itrion
Last active November 29, 2016 18:19
Show Gist options
  • Save itrion/d690067766ef5d393efeb771e0c0a5ae to your computer and use it in GitHub Desktop.
Save itrion/d690067766ef5d393efeb771e0c0a5ae to your computer and use it in GitHub Desktop.
factory.getConverterFactory().registerConverter(new PassThroughConverter(LocalDate.class));
factory.getConverterFactory().registerConverter(new PassThroughConverter(DateTime.class));
factory
.classMap(WalkIn.class, WalkInDTO.class)
.exclude("fittingRoomQueueTicket")
.field("showroom", "showroomId")
.field(
Property.Builder.propertyFor(Boolean.class, "attended")
.type(Boolean.class)
.getter("isAttended()"),
Property.Builder.propertyFor(Boolean.class, "attended")
.type(Boolean.class)
.getter("isAttended()")
)
.field(
Property.Builder.propertyFor(Boolean.class, "done")
.type(Boolean.class)
.getter("isDone()"),
Property.Builder.propertyFor(Boolean.class, "done")
.type(Boolean.class)
.getter("isDone()")
)
.byDefault()
.register();
package com.rtr.godmother.api.models;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.rtr.serializers.DateTimeJsonHelper;
import com.rtr.serializers.LocalDateJsonHelper;
import org.joda.time.DateTime;
import org.joda.time.LocalDate;
public class WalkIn {
private final String id;
private final String email;
private final String firstName;
private final String lastName;
private final String cellPhoneNumber;
private final String source;
private final String showroom;
private final String notes;
private final String visitType;
private final Boolean attended;
private final Boolean done;
private final String eventType;
private final String stylistUserName;
@JsonSerialize(using = LocalDateJsonHelper.CustomLocalDateSerializer.class)
@JsonDeserialize(using = LocalDateJsonHelper.CustomLocalDateDeserializer.class)
private final LocalDate eventDate;
@JsonSerialize(using = DateTimeJsonHelper.CustomDateTimeSerializer.class)
@JsonDeserialize(using = DateTimeJsonHelper.CustomDateTimeDeserializer.class)
private final DateTime updatedAt;
@JsonSerialize(using = DateTimeJsonHelper.CustomDateTimeSerializer.class)
@JsonDeserialize(using = DateTimeJsonHelper.CustomDateTimeDeserializer.class)
private final DateTime createdAt;
@JsonCreator
public WalkIn(@JsonProperty("id") String id,
@JsonProperty("email") String email,
@JsonProperty("firstName") String firstName,
@JsonProperty("lastName") String lastName,
@JsonProperty("cellPhoneNumber") String cellPhoneNumber,
@JsonProperty("source") String source,
@JsonProperty("showroom") String showroom,
@JsonProperty("visitType") String visitType,
@JsonProperty("eventDate") LocalDate eventDate,
@JsonProperty("eventType") String eventType,
@JsonProperty("notes") String notes,
@JsonProperty("stylistUserName") String stylistUserName,
@JsonProperty("attended") Boolean attended,
@JsonProperty("done") Boolean done,
@JsonProperty("createdAt") DateTime createdAt,
@JsonProperty("updatedAt") DateTime updatedAt) {
this.id = id;
this.email = email;
this.firstName = firstName;
this.lastName = lastName;
this.cellPhoneNumber = cellPhoneNumber;
this.source = source;
this.showroom = showroom;
this.notes = notes;
this.visitType = visitType;
this.attended = attended;
this.done = done;
this.eventType = eventType;
this.stylistUserName = stylistUserName;
this.eventDate = eventDate;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
public String getId() {
return id;
}
public String getEmail() {
return email;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getCellPhoneNumber() {
return cellPhoneNumber;
}
public String getSource() {
return source;
}
public String getShowroom() {
return showroom;
}
public String getNotes() {
return notes;
}
public Boolean isAttended() {
return attended;
}
public Boolean isDone() {
return done;
}
public String getEventType() {
return eventType;
}
public String getStylistUserName() {
return stylistUserName;
}
public LocalDate getEventDate() {
return eventDate;
}
public String getVisitType() {
return visitType;
}
public DateTime getUpdatedAt() {
return updatedAt;
}
public DateTime getCreatedAt() {
return createdAt;
}
}
package com.rtr.booker.api;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.rtr.booker.api.serializers.DateTimeJsonHelper;
import org.joda.time.DateTime;
import org.joda.time.LocalDate;
public class WalkInDTO {
private String id;
private String firstName;
private String lastName;
private String email;
private String cellPhoneNumber;
private String source;
private Long showroomId;
private String visitType;
private LocalDate eventDate;
private String eventType;
private String notes;
private String stylistUserName;
private Boolean attended;
private Boolean done;
private FittingRoomQueueTicketDTO fittingRoomQueueTicket;
@JsonSerialize(using = DateTimeJsonHelper.CustomDateTimeSerializer.class)
@JsonDeserialize(using = DateTimeJsonHelper.CustomDateTimeDeserializer.class)
private DateTime updatedAt;
@JsonSerialize(using = DateTimeJsonHelper.CustomDateTimeSerializer.class)
@JsonDeserialize(using = DateTimeJsonHelper.CustomDateTimeDeserializer.class)
private DateTime createdAt;
@JsonCreator
public WalkInDTO(@JsonProperty("id") String id,
@JsonProperty("firstName") String firstName,
@JsonProperty("lastName") String lastName,
@JsonProperty("email") String email,
@JsonProperty("cellPoneNumber") String cellPhoneNumber,
@JsonProperty("source") String source,
@JsonProperty("showroomId") Long showroomId,
@JsonProperty("visitType") String visitType,
@JsonProperty("eventDate") LocalDate eventDate,
@JsonProperty("eventType") String eventType,
@JsonProperty("notes") String notes,
@JsonProperty("stylistUserName") String stylistUserName,
@JsonProperty("attended") Boolean attended,
@JsonProperty("done") Boolean done,
@JsonProperty("fittingRoomQueueTicket") FittingRoomQueueTicketDTO fittingRoomQueueTicket,
@JsonProperty("createdAt") DateTime createdAt,
@JsonProperty("updatedAt") DateTime updatedAt) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
this.cellPhoneNumber = cellPhoneNumber;
this.source = source;
this.showroomId = showroomId;
this.visitType = visitType;
this.eventDate = eventDate;
this.eventType = eventType;
this.notes = notes;
this.stylistUserName = stylistUserName;
this.attended = attended;
this.done = done;
this.fittingRoomQueueTicket = fittingRoomQueueTicket;
this.createdAt = createdAt;
this.updatedAt = updatedAt;
}
public String getId() {
return id;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getEmail() {
return email;
}
public String getCellPhoneNumber() {
return cellPhoneNumber;
}
public String getSource() {
return source;
}
public Long getShowroomId() {
return showroomId;
}
public String getVisitType() {
return visitType;
}
public LocalDate getEventDate() {
return eventDate;
}
public String getEventType() {
return eventType;
}
public String getNotes() {
return notes;
}
public String getStylistUserName() {
return stylistUserName;
}
public Boolean isAttended() {
return attended;
}
public Boolean isDone() {
return done;
}
public FittingRoomQueueTicketDTO getFittingRoomQueueTicket() {
return fittingRoomQueueTicket;
}
public DateTime getCreatedAt() {
return createdAt;
}
public DateTime getUpdatedAt() {
return updatedAt;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment