|
| 1 | +/** |
| 2 | + * Copyright 2017, 2018, 2019, 2020 Stephen Powis https://github.com/Crim/pardot-java-client |
| 3 | + * |
| 4 | + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |
| 5 | + * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the |
| 6 | + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit |
| 7 | + * persons to whom the Software is furnished to do so, subject to the following conditions: |
| 8 | + * |
| 9 | + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the |
| 10 | + * Software. |
| 11 | + * |
| 12 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
| 13 | + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| 14 | + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 15 | + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 16 | + */ |
| 17 | + |
| 18 | +package com.darksci.pardot.api.response.visit; |
| 19 | + |
| 20 | +import com.fasterxml.jackson.annotation.JsonFormat; |
| 21 | +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; |
| 22 | +import org.joda.time.LocalDateTime; |
| 23 | + |
| 24 | +import java.util.ArrayList; |
| 25 | +import java.util.List; |
| 26 | + |
| 27 | +/** |
| 28 | + * Represents a Pardot visit. |
| 29 | + */ |
| 30 | +public class Visit { |
| 31 | + private Long id; |
| 32 | + private Long visitorId; |
| 33 | + private Long prospectId; |
| 34 | + private Integer visitorPageViewCount; |
| 35 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 36 | + private LocalDateTime firstVisitorPageViewAt; |
| 37 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 38 | + private LocalDateTime lastVisitorPageViewAt; |
| 39 | + private Integer durationInSeconds; |
| 40 | + private String campaignParameter; |
| 41 | + private String mediumParameter; |
| 42 | + private String sourceParameter; |
| 43 | + private String contentParameter; |
| 44 | + private String termParameter; |
| 45 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 46 | + private LocalDateTime createdAt; |
| 47 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 48 | + private LocalDateTime updatedAt; |
| 49 | + |
| 50 | + @JacksonXmlElementWrapper(localName = "visitor_page_views") |
| 51 | + private List<VisitorPageView> visitorPageViews; |
| 52 | + |
| 53 | + public Long getId() { return id; } |
| 54 | + |
| 55 | + public Long getVisitorId() { return visitorId; } |
| 56 | + |
| 57 | + public Long getProspectId() { return prospectId; } |
| 58 | + |
| 59 | + public Integer getVisitorPageViewCount() { return visitorPageViewCount; } |
| 60 | + |
| 61 | + public LocalDateTime getFirstVisitorPageViewAt() { return firstVisitorPageViewAt; } |
| 62 | + |
| 63 | + public LocalDateTime getLastVisitorPageViewAt() { return lastVisitorPageViewAt; } |
| 64 | + |
| 65 | + public Integer getDurationInSeconds() { return durationInSeconds; } |
| 66 | + |
| 67 | + public String getCampaignParameter() { return campaignParameter; } |
| 68 | + |
| 69 | + public String getMediumParameter() { return mediumParameter; } |
| 70 | + |
| 71 | + public String getSourceParameter() { return sourceParameter; } |
| 72 | + |
| 73 | + public String getContentParameter() { return contentParameter; } |
| 74 | + |
| 75 | + public String getTermParameter() { return termParameter; } |
| 76 | + |
| 77 | + public LocalDateTime getCreatedAt() { return createdAt; } |
| 78 | + |
| 79 | + public LocalDateTime getUpdatedAt() { return updatedAt; } |
| 80 | + |
| 81 | + /** |
| 82 | + * Visitor Page Views associated to the visit, or empty list if none. |
| 83 | + * |
| 84 | + * @return Associated Visitor Page Views, or empty list if none. |
| 85 | + */ |
| 86 | + public List<VisitorPageView> getVisitorPageViews() { |
| 87 | + if (visitorPageViews == null) { |
| 88 | + return new ArrayList<>(); |
| 89 | + } |
| 90 | + return visitorPageViews; |
| 91 | + } |
| 92 | + |
| 93 | + @Override |
| 94 | + public String toString() { |
| 95 | + return "Visitor{" |
| 96 | + + "id=" + id |
| 97 | + + ", visitorId=" + visitorId |
| 98 | + + ", prospectId=" + prospectId |
| 99 | + + ", visitorPageViewCount=" + visitorPageViewCount |
| 100 | + + ", firstVisitorPageViewAt=" + firstVisitorPageViewAt |
| 101 | + + ", lastVisitorPageViewAt=" + lastVisitorPageViewAt |
| 102 | + + ", durationInSeconds=" + durationInSeconds |
| 103 | + + ", campaignParameter='" + campaignParameter + '\'' |
| 104 | + + ", mediumParameter='" + mediumParameter + '\'' |
| 105 | + + ", sourceParameter='" + sourceParameter + '\'' |
| 106 | + + ", contentParameter='" + contentParameter + '\'' |
| 107 | + + ", termParameter='" + termParameter + '\'' |
| 108 | + + ", createdAt=" + createdAt |
| 109 | + + ", updatedAt=" + updatedAt |
| 110 | + + '}'; |
| 111 | + } |
| 112 | +} |
0 commit comments