@JGlobalMap(excluded = {
"contactMethod", "contactMethodId", "readOnly", "links", "statusId", "actionResultId", "outcomeResultId",
"contactPersons", "accountId", "contactById", "createdById", "createdBy", "contactPersonName", "creatingUserId",
"contactByName", "contactPersonId", "opportunityId", "adCampaignId", "productId", "reminder", "taskNote",
"documents", "promotionId", "customerName", "accountId", "invoiceId", "orderId", "status"
})
@ApiModel
@JsonIgnoreProperties(ignoreUnknown = true)
public class Task extends Base implements Serializable {
@JsonView(Views.SummaryView.class)
private int id;
@JsonView(Views.SummaryView.class)
private boolean readOnly;
@JsonView(Views.SummaryView.class)
private ContactMethodCodeType contactMethod;
@JMap("dbContactType")
@JsonView(Views.SummaryView.class)
private Integer contactMethodId;
@JsonView(Views.SummaryView.class)
private Boolean contactCompleteFlag;
@JMap("priorityType")
@JsonView(Views.SummaryView.class)
private TaskPriorityType priorityType;
@JsonView(Views.SummaryView.class)
@NotNull
private String subject;
@JsonView(Views.SummaryView.class)
@NotNull
private Date dateScheduled;
@JsonView(Views.SummaryView.class)
private Date createDate;
@JMap("dbContactResultType")
@JsonView(Views.SummaryView.class)
private Integer statusId;
@JsonView(Views.SummaryView.class)
private TaskStatusCodeType status;
@JMap("dbCustomer")
@JsonView(Views.SummaryView.class)
private Integer accountId;
@JsonView(Views.SummaryView.class)
private String customerName;
@JMap("dbFnTransactions")
@JsonView(Views.SummaryView.class)
private Integer invoiceId;
@JsonView(Views.SummaryView.class)
private Integer orderId;
@JMap("dbAoPromotions")
@JsonView(Views.SummaryView.class)
private Integer promotionId;
@JMap("dbContactPerson")
@JsonView(Views.SummaryView.class)
private Integer contactPersonId;
@JsonView(Views.SummaryView.class)
private String contactPersonName;
@JMap("dbUsrUsersByContactById")
@JsonView(Views.SummaryView.class)
@NotNull
private Integer contactById;
@JsonView(Views.SummaryView.class)
private String contactByName;
@JMap("dbTaskActionResult")
@JsonView(Views.SummaryView.class)
private Integer actionResultId;
@JMap("dbTaskOutcomeResult")
@JsonView(Views.SummaryView.class)
private Integer outcomeResultId;
@JMap("dbTaskEventCplinks")
@JsonView(Views.DetailedView.class)
private List<ContactPerson> contactPersons;
@JMap("dbUsrUsersByCreatingUserId")
@JsonView(Views.DetailedView.class)
private Integer createdById;
@JsonView(Views.DetailedView.class)
private String createdBy;
@JsonView(Views.DetailedView.class)
private Integer creatingUserId;
@JMap("dbCrmopportunity")
@JsonView(Views.SummaryView.class)
private Integer opportunityId;
@JMap("dbCampaign")
@JsonView(Views.SummaryView.class)
private Integer adCampaignId;
@JMap("dbAoProducts")
@JsonView(Views.SummaryView.class)
private Integer productId;
@JMap("reminderDateTime")
@JsonView(Views.SummaryView.class)
private TaskReminderType reminder;
@JMap("dbContactNoteses")
@JsonView(Views.SummaryView.class)
private ContactNotes taskNote;
@JMap("dbContactDocLinks")
@JsonView(Views.DetailedView.class)
private List<ContactDocLink> documents;
and I have declared some mapping conversion methods, getters and setters in 1st class..
The other is my hibernate entity class which has object and set fields lazy fetch.
Now I try to map it using following:
I am calling the method with JSONView SummaryView, so I dont get DetailedView fields, but from my logs and debugging I find those fields are being populated and their conversion methods are being called. Since I am using this DTO class for different views so i want such kind of functionality. So that I dont need to create multiple DTO classes.
I got entity to my resource class. Lets say it is DbContact entity;
Jmapper<Task,DbContact> jmapper = new JMapper<>(Task.class,DbContact.class);
Task result = jmapper.getDestination(entity);
Since I have used JSONView here I dont