-
Notifications
You must be signed in to change notification settings - Fork 75
Add support for new company attributes #183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,9 @@ public static Company update(Company company) throws InvalidException, Authoriza | |
| entity.setSessionCount(company.getSessionCount()); | ||
| entity.setMonthlySpend(company.getMonthlySpend()); | ||
| entity.setRemoteCreatedAt(company.getRemoteCreatedAt()); | ||
| entity.setIndustry(company.getIndustry()); | ||
| entity.setSize(company.getSize()); | ||
| entity.setWebsite(company.getWebsite()); | ||
| if(company.getCustomAttributes() != null) { | ||
| entity.getCustomAttributes().putAll(company.getCustomAttributes()); | ||
| } | ||
|
|
@@ -177,6 +180,9 @@ public String toString() { | |
| @JsonProperty("remote_created_at") | ||
| private long remoteCreatedAt; | ||
|
|
||
| @JsonProperty("last_request_at") | ||
| private long lastRequestAt; | ||
|
|
||
| @JsonProperty("created_at") | ||
| private long createdAt; | ||
|
|
||
|
|
@@ -189,6 +195,15 @@ public String toString() { | |
| @JsonProperty("user_count") | ||
| private Integer userCount; | ||
|
|
||
| @JsonProperty("size") | ||
| private int size; | ||
|
|
||
| @JsonProperty("website") | ||
| private String website; | ||
|
|
||
| @JsonProperty("industry") | ||
| private String industry; | ||
|
|
||
| @JsonIgnoreProperties(ignoreUnknown = false) | ||
| @JsonProperty("custom_attributes") | ||
| private Map<String, CustomAttribute> customAttributes = Maps.newHashMap(); | ||
|
|
@@ -232,6 +247,33 @@ public Company setName(String name) { | |
| return this; | ||
| } | ||
|
|
||
| public int getSize() { | ||
| return size; | ||
| } | ||
|
|
||
| public Company setSize(int size) { | ||
| this.size = size; | ||
| return this; | ||
| } | ||
|
|
||
| public String getWebsite() { | ||
| return website; | ||
| } | ||
|
|
||
| public Company setWebsite(String website) { | ||
| this.website = website; | ||
| return this; | ||
| } | ||
|
|
||
| public String getIndustry() { | ||
| return industry; | ||
| } | ||
|
|
||
| public Company setIndustry(String industry) { | ||
| this.industry = industry; | ||
| return this; | ||
| } | ||
|
|
||
| public long getCreatedAt() { | ||
| return createdAt; | ||
| } | ||
|
|
@@ -262,6 +304,15 @@ public Company setRemoteCreatedAt(long remoteCreatedAt) { | |
| return this; | ||
| } | ||
|
|
||
| public long getLastRequestAt() { | ||
| return lastRequestAt; | ||
| } | ||
|
|
||
| public Company setLastRequestAt(long lastRequestAt) { | ||
| this.lastRequestAt = lastRequestAt; | ||
| return this; | ||
| } | ||
|
|
||
| public Map<String, CustomAttribute> getCustomAttributes() { | ||
| return customAttributes; | ||
| } | ||
|
|
@@ -322,6 +373,7 @@ public boolean equals(Object o) { | |
| if (remoteCreatedAt != company.remoteCreatedAt) return false; | ||
| if (sessionCount != company.sessionCount) return false; | ||
| if (updatedAt != company.updatedAt) return false; | ||
| if (lastRequestAt != company.lastRequestAt) return false; | ||
| if (companyID != null ? !companyID.equals(company.companyID) : company.companyID != null) return false; | ||
| if (customAttributes != null ? !customAttributes.equals(company.customAttributes) : company.customAttributes != null) | ||
| return false; | ||
|
|
@@ -336,6 +388,9 @@ public boolean equals(Object o) { | |
| if (untag != null ? !untag.equals(company.untag) : company.untag != null) return false; | ||
| //noinspection RedundantIfStatement | ||
| if (userCount != null ? !userCount.equals(company.userCount) : company.userCount != null) return false; | ||
| if (size != company.size) return false; | ||
| if (website != null ? !website.equals(company.website) : company.website != null) return false; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is quite complicated to read, you want to make sure that the current website and company website aren't equal, right? Is there any way you could export the equals checks to a separate method that returns the boolean?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I can see that it is essentially checking for the possibly inequality between the 2 objects. I was following the standard format that exists for string checking and it is utilised in several places. Could definitely use a refactor though 👍 Do you see any issues with I can try implement that as it seems built but seems to require Java 1.7
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's definitely a lot easier to read. What version of Java is this on? Why isn't it up higher? That would definitely be nice, but I can understand that you're following the format. As well though, maintainability and readability are definitely important 😄 This definitely isn't a breaking change though.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't think we have specified a version of Java we support but created this issue #214 to track the possibility of simplifying this
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry Tim, I missed this. I think you're definitely right we need to look into simplifying it. |
||
| if (industry != null ? !industry.equals(company.industry) : company.industry != null) return false; | ||
|
|
||
| return true; | ||
| } | ||
|
|
@@ -351,12 +406,16 @@ public int hashCode() { | |
| result = 31 * result + (int) (remoteCreatedAt ^ (remoteCreatedAt >>> 32)); | ||
| result = 31 * result + (int) (createdAt ^ (createdAt >>> 32)); | ||
| result = 31 * result + (int) (updatedAt ^ (updatedAt >>> 32)); | ||
| result = 31 * result + (int) (lastRequestAt ^ (lastRequestAt >>> 32)); | ||
| result = 31 * result + (plan != null ? plan.hashCode() : 0); | ||
| result = 31 * result + (userCount != null ? userCount.hashCode() : 0); | ||
| result = 31 * result + (customAttributes != null ? customAttributes.hashCode() : 0); | ||
| result = 31 * result + (segmentCollection != null ? segmentCollection.hashCode() : 0); | ||
| result = 31 * result + (tagCollection != null ? tagCollection.hashCode() : 0); | ||
| result = 31 * result + (untag != null ? untag.hashCode() : 0); | ||
| result = 31 * result + size; | ||
| result = 31 * result + (website != null ? website.hashCode() : 0); | ||
| result = 31 * result + (industry != null ? industry.hashCode() : 0); | ||
| return result; | ||
| } | ||
|
|
||
|
|
@@ -370,11 +429,15 @@ public String toString() { | |
| ", monthlySpend=" + monthlySpend + | ||
| ", remoteCreatedAt=" + remoteCreatedAt + | ||
| ", createdAt=" + createdAt + | ||
| ", lastRequestAt=" + lastRequestAt + | ||
| ", updatedAt=" + updatedAt + | ||
| ", plan=" + plan + | ||
| ", customAttributes=" + customAttributes + | ||
| ", segmentCollection=" + segmentCollection + | ||
| ", tagCollection=" + tagCollection + | ||
| ", size=" + size + | ||
| ", website='" + website + '\'' + | ||
| ", industry='" + industry + '\'' + | ||
| "} " + super.toString(); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.