Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PERFORMA_REPLICA
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhammad Usman
PERFORMA_REPLICA
Commits
360576bf
Commit
360576bf
authored
Feb 27, 2019
by
Jay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
S21288574 # Client - Incoming Issues (raised by Client) #Remove Intercom et al
parent
9276a42b
Show whitespace changes
Inline
Side-by-side
Showing
98 changed files
with
2 additions
and
8812 deletions
+2
-8812
CloseJobBatch.java
cmsWebApp/src/performa/batch/CloseJobBatch.java
+0
-11
BulkUpdateFP.java
cmsWebApp/src/performa/form/BulkUpdateFP.java
+0
-14
ChangeApplicationStatusFP.java
cmsWebApp/src/performa/form/ChangeApplicationStatusFP.java
+0
-16
CompleteApplicationFP.java
cmsWebApp/src/performa/form/CompleteApplicationFP.java
+0
-12
MakePaymentFP.java
cmsWebApp/src/performa/form/MakePaymentFP.java
+0
-18
SaveCompanyFP.java
cmsWebApp/src/performa/form/SaveCompanyFP.java
+0
-3
SaveJobFP.java
cmsWebApp/src/performa/form/SaveJobFP.java
+0
-14
SaveUserDetailsFP.java
cmsWebApp/src/performa/form/SaveUserDetailsFP.java
+0
-14
SendCompanyUserInvitesFP.java
cmsWebApp/src/performa/form/SendCompanyUserInvitesFP.java
+0
-7
VerifyIdentityFP.java
cmsWebApp/src/performa/form/VerifyIdentityFP.java
+0
-4
Admin.java
cmsWebApp/src/performa/intercom/resources/Admin.java
+0
-157
AdminCollection.java
...bApp/src/performa/intercom/resources/AdminCollection.java
+0
-46
AdminMessage.java
cmsWebApp/src/performa/intercom/resources/AdminMessage.java
+0
-173
AdminMessageResponse.java
...src/performa/intercom/resources/AdminMessageResponse.java
+0
-130
AdminReply.java
cmsWebApp/src/performa/intercom/resources/AdminReply.java
+0
-82
Author.java
cmsWebApp/src/performa/intercom/resources/Author.java
+0
-117
AuthorizationException.java
...c/performa/intercom/resources/AuthorizationException.java
+0
-22
Avatar.java
cmsWebApp/src/performa/intercom/resources/Avatar.java
+0
-60
ClientException.java
...bApp/src/performa/intercom/resources/ClientException.java
+0
-22
Company.java
cmsWebApp/src/performa/intercom/resources/Company.java
+0
-399
CompanyCollection.java
...pp/src/performa/intercom/resources/CompanyCollection.java
+0
-66
CompanyUpdateBuilder.java
...src/performa/intercom/resources/CompanyUpdateBuilder.java
+0
-67
CompanyWithStringPlan.java
...rc/performa/intercom/resources/CompanyWithStringPlan.java
+0
-123
Conditions.java
cmsWebApp/src/performa/intercom/resources/Conditions.java
+0
-26
Contact.java
cmsWebApp/src/performa/intercom/resources/Contact.java
+0
-644
ContactCollection.java
...pp/src/performa/intercom/resources/ContactCollection.java
+0
-48
ContactMessage.java
...ebApp/src/performa/intercom/resources/ContactMessage.java
+0
-21
Conversation.java
cmsWebApp/src/performa/intercom/resources/Conversation.java
+0
-341
ConversationCollection.java
...c/performa/intercom/resources/ConversationCollection.java
+0
-44
ConversationMessage.java
.../src/performa/intercom/resources/ConversationMessage.java
+0
-74
ConversationPart.java
...App/src/performa/intercom/resources/ConversationPart.java
+0
-126
ConversationPartCollection.java
...rforma/intercom/resources/ConversationPartCollection.java
+0
-26
CountItemDeserializer.java
...rc/performa/intercom/resources/CountItemDeserializer.java
+0
-27
CountItemSerializer.java
.../src/performa/intercom/resources/CountItemSerializer.java
+0
-22
Counts.java
cmsWebApp/src/performa/intercom/resources/Counts.java
+0
-340
CustomAttribute.java
...bApp/src/performa/intercom/resources/CustomAttribute.java
+0
-202
CustomAttributeDeserializer.java
...forma/intercom/resources/CustomAttributeDeserializer.java
+0
-53
CustomAttributeSerializer.java
...erforma/intercom/resources/CustomAttributeSerializer.java
+0
-21
DataResource.java
cmsWebApp/src/performa/intercom/resources/DataResource.java
+0
-73
Error.java
cmsWebApp/src/performa/intercom/resources/Error.java
+0
-77
ErrorCollection.java
...bApp/src/performa/intercom/resources/ErrorCollection.java
+0
-33
Event.java
cmsWebApp/src/performa/intercom/resources/Event.java
+0
-228
HttpClient.java
cmsWebApp/src/performa/intercom/resources/HttpClient.java
+0
-277
HttpConnectorSupplier.java
...rc/performa/intercom/resources/HttpConnectorSupplier.java
+0
-16
IOUtils.java
cmsWebApp/src/performa/intercom/resources/IOUtils.java
+0
-47
Intercom.java
cmsWebApp/src/performa/intercom/resources/Intercom.java
+0
-113
IntercomException.java
...pp/src/performa/intercom/resources/IntercomException.java
+0
-48
InvalidException.java
...App/src/performa/intercom/resources/InvalidException.java
+0
-22
Job.java
cmsWebApp/src/performa/intercom/resources/Job.java
+0
-216
JobItem.java
cmsWebApp/src/performa/intercom/resources/JobItem.java
+0
-134
JobItemCollection.java
...pp/src/performa/intercom/resources/JobItemCollection.java
+0
-50
JobItemRequest.java
...ebApp/src/performa/intercom/resources/JobItemRequest.java
+0
-38
JobSupport.java
cmsWebApp/src/performa/intercom/resources/JobSupport.java
+0
-24
JobTask.java
cmsWebApp/src/performa/intercom/resources/JobTask.java
+0
-47
LocationData.java
cmsWebApp/src/performa/intercom/resources/LocationData.java
+0
-136
MapperSupport.java
cmsWebApp/src/performa/intercom/resources/MapperSupport.java
+0
-40
NotFoundException.java
...pp/src/performa/intercom/resources/NotFoundException.java
+0
-22
Note.java
cmsWebApp/src/performa/intercom/resources/Note.java
+0
-133
NoteCollection.java
...ebApp/src/performa/intercom/resources/NoteCollection.java
+0
-43
Notification.java
cmsWebApp/src/performa/intercom/resources/Notification.java
+0
-217
NotificationCollection.java
...c/performa/intercom/resources/NotificationCollection.java
+0
-44
NotificationData.java
...App/src/performa/intercom/resources/NotificationData.java
+0
-63
NotificationError.java
...pp/src/performa/intercom/resources/NotificationError.java
+0
-29
NotificationErrorCollection.java
...forma/intercom/resources/NotificationErrorCollection.java
+0
-43
RateLimitException.java
...p/src/performa/intercom/resources/RateLimitException.java
+0
-60
Replier.java
cmsWebApp/src/performa/intercom/resources/Replier.java
+0
-7
Reply.java
cmsWebApp/src/performa/intercom/resources/Reply.java
+0
-95
RequestResponseCapture.java
...c/performa/intercom/resources/RequestResponseCapture.java
+0
-69
ScrollableCompanyCollection.java
...forma/intercom/resources/ScrollableCompanyCollection.java
+0
-19
ScrollableContactCollection.java
...forma/intercom/resources/ScrollableContactCollection.java
+0
-19
ScrollableTypedDataCollection.java
...rma/intercom/resources/ScrollableTypedDataCollection.java
+0
-33
ScrollableUserCollection.java
...performa/intercom/resources/ScrollableUserCollection.java
+0
-20
Segment.java
cmsWebApp/src/performa/intercom/resources/Segment.java
+0
-113
SegmentCollection.java
...pp/src/performa/intercom/resources/SegmentCollection.java
+0
-51
ServerException.java
...bApp/src/performa/intercom/resources/ServerException.java
+0
-22
SocialProfile.java
cmsWebApp/src/performa/intercom/resources/SocialProfile.java
+0
-90
SocialProfileCollection.java
.../performa/intercom/resources/SocialProfileCollection.java
+0
-62
Subscription.java
cmsWebApp/src/performa/intercom/resources/Subscription.java
+0
-420
SubscriptionCollection.java
...c/performa/intercom/resources/SubscriptionCollection.java
+0
-50
Tag.java
cmsWebApp/src/performa/intercom/resources/Tag.java
+0
-250
TagCollection.java
cmsWebApp/src/performa/intercom/resources/TagCollection.java
+0
-50
TopicDeserializer.java
...pp/src/performa/intercom/resources/TopicDeserializer.java
+0
-25
TopicSerializer.java
...bApp/src/performa/intercom/resources/TopicSerializer.java
+0
-20
TypedData.java
cmsWebApp/src/performa/intercom/resources/TypedData.java
+0
-9
TypedDataCollection.java
.../src/performa/intercom/resources/TypedDataCollection.java
+0
-87
TypedDataCollectionIterator.java
...forma/intercom/resources/TypedDataCollectionIterator.java
+0
-56
TypedMessage.java
cmsWebApp/src/performa/intercom/resources/TypedMessage.java
+0
-116
URIDeserializer.java
...bApp/src/performa/intercom/resources/URIDeserializer.java
+0
-44
UriBuilder.java
cmsWebApp/src/performa/intercom/resources/UriBuilder.java
+0
-106
User.java
cmsWebApp/src/performa/intercom/resources/User.java
+0
-674
UserCollection.java
...ebApp/src/performa/intercom/resources/UserCollection.java
+0
-48
UserMessage.java
cmsWebApp/src/performa/intercom/resources/UserMessage.java
+0
-28
UserReply.java
cmsWebApp/src/performa/intercom/resources/UserReply.java
+0
-69
IntercomUtils.java
cmsWebApp/src/performa/intercom/utils/IntercomUtils.java
+0
-277
Utils.java
cmsWebApp/src/performa/utils/Utils.java
+0
-2
dynamic_content_core.jsp
cmsWebApp/webroot/dynamic_content_core.jsp
+0
-2
htmlheader.jsp
cmsWebApp/webroot/extensions/adminportal/inc/htmlheader.jsp
+1
-13
stdimports.jsp
cmsWebApp/webroot/extensions/performa/inc/stdimports.jsp
+1
-1
No files found.
cmsWebApp/src/performa/batch/CloseJobBatch.java
View file @
360576bf
package
performa
.
batch
;
package
performa
.
batch
;
import
java.util.Set
;
import
oneit.appservices.batch.ORMBatch
;
import
oneit.appservices.batch.ORMBatch
;
import
oneit.logging.*
;
import
oneit.logging.*
;
import
oneit.objstore.ObjectTransaction
;
import
oneit.objstore.ObjectTransaction
;
...
@@ -8,9 +7,7 @@ import oneit.objstore.StorageException;
...
@@ -8,9 +7,7 @@ import oneit.objstore.StorageException;
import
oneit.objstore.rdbms.filters.LessThanFilter
;
import
oneit.objstore.rdbms.filters.LessThanFilter
;
import
oneit.utils.DateDiff
;
import
oneit.utils.DateDiff
;
import
oneit.utils.parsers.FieldException
;
import
oneit.utils.parsers.FieldException
;
import
performa.intercom.utils.IntercomUtils
;
import
performa.orm.Job
;
import
performa.orm.Job
;
import
performa.orm.Company
;
import
performa.orm.types.JobStatus
;
import
performa.orm.types.JobStatus
;
...
@@ -35,12 +32,5 @@ public class CloseJobBatch extends ORMBatch
...
@@ -35,12 +32,5 @@ public class CloseJobBatch extends ORMBatch
LogMgr
.
log
(
CLOSE_JOB_BATCH
,
LogLevel
.
PROCESSING1
,
"Setting Job Status to Closed in job : "
,
job
);
LogMgr
.
log
(
CLOSE_JOB_BATCH
,
LogLevel
.
PROCESSING1
,
"Setting Job Status to Closed in job : "
,
job
);
}
}
// Update closed job details to intercom
Set
<
Company
>
companies
=
Job
.
pipesJob
(
expiringJobs
).
toCreatedBy
().
toCompany
().
uniqueVals
();
for
(
Company
company
:
companies
)
{
IntercomUtils
.
updateCompany
(
company
);
}
}
}
}
}
\ No newline at end of file
cmsWebApp/src/performa/form/BulkUpdateFP.java
View file @
360576bf
...
@@ -10,7 +10,6 @@ import oneit.objstore.StorageException;
...
@@ -10,7 +10,6 @@ import oneit.objstore.StorageException;
import
oneit.objstore.parser.BusinessObjectParser
;
import
oneit.objstore.parser.BusinessObjectParser
;
import
oneit.objstore.rdbms.filters.EqualsFilter
;
import
oneit.objstore.rdbms.filters.EqualsFilter
;
import
oneit.objstore.utils.ObjstoreUtils
;
import
oneit.objstore.utils.ObjstoreUtils
;
import
oneit.security.SecUser
;
import
oneit.servlets.forms.SubmissionDetails
;
import
oneit.servlets.forms.SubmissionDetails
;
import
oneit.servlets.forms.SuccessfulResult
;
import
oneit.servlets.forms.SuccessfulResult
;
import
oneit.servlets.process.ORMProcessState
;
import
oneit.servlets.process.ORMProcessState
;
...
@@ -19,8 +18,6 @@ import oneit.utils.BusinessException;
...
@@ -19,8 +18,6 @@ import oneit.utils.BusinessException;
import
oneit.utils.Debug
;
import
oneit.utils.Debug
;
import
oneit.utils.filter.CollectionFilter
;
import
oneit.utils.filter.CollectionFilter
;
import
oneit.utils.filter.Filter
;
import
oneit.utils.filter.Filter
;
import
performa.intercom.utils.IntercomUtils
;
import
performa.orm.CompanyUser
;
import
performa.orm.Job
;
import
performa.orm.Job
;
import
performa.orm.JobApplication
;
import
performa.orm.JobApplication
;
import
performa.orm.types.ApplicationStatus
;
import
performa.orm.types.ApplicationStatus
;
...
@@ -58,17 +55,6 @@ public class BulkUpdateFP extends SaveFP
...
@@ -58,17 +55,6 @@ public class BulkUpdateFP extends SaveFP
LogMgr
.
log
(
JobApplication
.
LOG
,
LogLevel
.
PROCESSING1
,
"In BulkUpdateFP Job Application Status successfully changed : "
,
application
);
LogMgr
.
log
(
JobApplication
.
LOG
,
LogLevel
.
PROCESSING1
,
"In BulkUpdateFP Job Application Status successfully changed : "
,
application
);
}
}
}
}
// restarting process as custom attributes needs to be updated to intercom
completeProcessRestartAndRestoreAttribs
(
process
,
request
);
SecUser
secUser
=
SecUser
.
getTXUser
(
process
.
getTransaction
());
CompanyUser
companyUser
=
secUser
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
);
// Update company in intercom
if
(
companyUser
.
getCompany
()
!=
null
)
{
IntercomUtils
.
updateCompany
(
companyUser
.
getCompany
());
}
return
super
.
processForm
(
process
,
submission
,
params
);
return
super
.
processForm
(
process
,
submission
,
params
);
}
}
...
...
cmsWebApp/src/performa/form/ChangeApplicationStatusFP.java
View file @
360576bf
...
@@ -5,15 +5,12 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -5,15 +5,12 @@ import javax.servlet.http.HttpServletRequest;
import
oneit.logging.LogLevel
;
import
oneit.logging.LogLevel
;
import
oneit.logging.LogMgr
;
import
oneit.logging.LogMgr
;
import
oneit.objstore.StorageException
;
import
oneit.objstore.StorageException
;
import
oneit.security.SecUser
;
import
oneit.servlets.forms.RedisplayResult
;
import
oneit.servlets.forms.RedisplayResult
;
import
oneit.servlets.forms.SubmissionDetails
;
import
oneit.servlets.forms.SubmissionDetails
;
import
oneit.servlets.forms.SuccessfulResult
;
import
oneit.servlets.forms.SuccessfulResult
;
import
oneit.servlets.process.ORMProcessState
;
import
oneit.servlets.process.ORMProcessState
;
import
oneit.servlets.process.SaveFP
;
import
oneit.servlets.process.SaveFP
;
import
oneit.utils.BusinessException
;
import
oneit.utils.BusinessException
;
import
performa.intercom.utils.IntercomUtils
;
import
performa.orm.CompanyUser
;
import
performa.orm.JobApplication
;
import
performa.orm.JobApplication
;
public
class
ChangeApplicationStatusFP
extends
SaveFP
public
class
ChangeApplicationStatusFP
extends
SaveFP
...
@@ -37,18 +34,6 @@ public class ChangeApplicationStatusFP extends SaveFP
...
@@ -37,18 +34,6 @@ public class ChangeApplicationStatusFP extends SaveFP
LogMgr
.
log
(
JobApplication
.
LOG
,
LogLevel
.
PROCESSING1
,
"In ChangeApplicationStatusFP Job Application Status successfully changed : "
,
jobApplication
);
LogMgr
.
log
(
JobApplication
.
LOG
,
LogLevel
.
PROCESSING1
,
"In ChangeApplicationStatusFP Job Application Status successfully changed : "
,
jobApplication
);
// restarting process as custom attributes needs to be updated to intercom
completeProcessRestartAndRestoreAttribs
(
process
,
request
);
SecUser
secUser
=
SecUser
.
getTXUser
(
process
.
getTransaction
());
CompanyUser
companyUser
=
secUser
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
);
// Update company in intercom
if
(
companyUser
.
getCompany
()
!=
null
)
{
IntercomUtils
.
updateCompany
(
companyUser
.
getCompany
());
}
return
super
.
processForm
(
process
,
submission
,
params
);
return
super
.
processForm
(
process
,
submission
,
params
);
}
}
}
}
\ No newline at end of file
cmsWebApp/src/performa/form/CompleteApplicationFP.java
View file @
360576bf
...
@@ -6,12 +6,10 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -6,12 +6,10 @@ import javax.servlet.http.HttpServletRequest;
import
oneit.logging.*
;
import
oneit.logging.*
;
import
oneit.objstore.*
;
import
oneit.objstore.*
;
import
oneit.objstore.parser.BusinessObjectParser
;
import
oneit.objstore.parser.BusinessObjectParser
;
import
oneit.objstore.services.TransactionTask
;
import
oneit.servlets.forms.*
;
import
oneit.servlets.forms.*
;
import
oneit.servlets.process.*
;
import
oneit.servlets.process.*
;
import
oneit.utils.*
;
import
oneit.utils.*
;
import
oneit.utils.parsers.FieldException
;
import
oneit.utils.parsers.FieldException
;
import
performa.intercom.utils.IntercomUtils
;
import
performa.orm.*
;
import
performa.orm.*
;
import
performa.orm.types.ApplicationStatus
;
import
performa.orm.types.ApplicationStatus
;
import
performa.utils.AnalysisEngine
;
import
performa.utils.AnalysisEngine
;
...
@@ -41,16 +39,6 @@ public class CompleteApplicationFP extends SaveFP
...
@@ -41,16 +39,6 @@ public class CompleteApplicationFP extends SaveFP
{
{
updateJobApplication
(
objTran
,
jobApplication
.
getID
().
longID
());
updateJobApplication
(
objTran
,
jobApplication
.
getID
().
longID
());
}
}
// restarting process as custom attributes needs to be updated to intercom
completeProcessRestartAndRestoreAttribs
(
process
,
request
);
jobApplication
=
(
JobApplication
)
process
.
getAttribute
(
"JobApplication"
);
// Update company in intercom
if
(
jobApplication
!=
null
&&
jobApplication
.
getJob
().
getCreatedBy
()
!=
null
)
{
IntercomUtils
.
updateCompany
(
jobApplication
.
getJob
().
getCreatedBy
().
getCompany
());
}
return
super
.
processForm
(
process
,
submission
,
params
);
return
super
.
processForm
(
process
,
submission
,
params
);
}
}
...
...
cmsWebApp/src/performa/form/MakePaymentFP.java
View file @
360576bf
...
@@ -91,23 +91,6 @@ public class MakePaymentFP extends SaveFP
...
@@ -91,23 +91,6 @@ public class MakePaymentFP extends SaveFP
// StripeUtils.updatePlan(company);
// StripeUtils.updatePlan(company);
}
}
// restarting process as custom attributes needs to be updated to intercom
// Set<String> attribsToRestore = new HashSet<>();
// attribsToRestore.add("Job");
// attribsToRestore.add("Company");
//
// completeProcessRestartAndRestoreAttribs(process, attribsToRestore);
//
// secUser = SecUser.getTXUser(process.getTransaction());
// companyUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
//
// // Update company in intercom
// if(companyUser.getCompany() != null)
// {
// IntercomUtils.updateCompany(companyUser.getCompany());
// }
return
super
.
processForm
(
process
,
submission
,
p
);
return
super
.
processForm
(
process
,
submission
,
p
);
}
}
}
}
\ No newline at end of file
cmsWebApp/src/performa/form/SaveCompanyFP.java
View file @
360576bf
...
@@ -62,9 +62,6 @@ public class SaveCompanyFP extends SaveFP
...
@@ -62,9 +62,6 @@ public class SaveCompanyFP extends SaveFP
}
}
}
}
// // Update company in intercom
// IntercomUtils.updateCompany(company);
return
super
.
processForm
(
process
,
submission
,
params
);
return
super
.
processForm
(
process
,
submission
,
params
);
}
}
...
...
cmsWebApp/src/performa/form/SaveJobFP.java
View file @
360576bf
...
@@ -8,7 +8,6 @@ import oneit.logging.LogLevel;
...
@@ -8,7 +8,6 @@ import oneit.logging.LogLevel;
import
oneit.logging.LogMgr
;
import
oneit.logging.LogMgr
;
import
oneit.objstore.StorageException
;
import
oneit.objstore.StorageException
;
import
oneit.objstore.parser.BusinessObjectParser
;
import
oneit.objstore.parser.BusinessObjectParser
;
import
oneit.security.SecUser
;
import
oneit.servlets.forms.SubmissionDetails
;
import
oneit.servlets.forms.SubmissionDetails
;
import
oneit.servlets.forms.SuccessfulResult
;
import
oneit.servlets.forms.SuccessfulResult
;
import
oneit.servlets.process.ORMProcessState
;
import
oneit.servlets.process.ORMProcessState
;
...
@@ -17,7 +16,6 @@ import oneit.utils.BusinessException;
...
@@ -17,7 +16,6 @@ import oneit.utils.BusinessException;
import
oneit.utils.DateDiff
;
import
oneit.utils.DateDiff
;
import
oneit.utils.MultiException
;
import
oneit.utils.MultiException
;
import
oneit.utils.math.NullArith
;
import
oneit.utils.math.NullArith
;
import
performa.intercom.utils.IntercomUtils
;
import
performa.orm.*
;
import
performa.orm.*
;
import
performa.orm.types.*
;
import
performa.orm.types.*
;
import
performa.utils.StripeUtils
;
import
performa.utils.StripeUtils
;
...
@@ -90,18 +88,6 @@ public class SaveJobFP extends SaveFP
...
@@ -90,18 +88,6 @@ public class SaveJobFP extends SaveFP
job
.
setAssessmentType
(
occupation
.
getAssessmentType
());
job
.
setAssessmentType
(
occupation
.
getAssessmentType
());
}
}
// restarting process as custom attributes needs to be updated to intercom
completeProcessRestartAndRestoreAttribs
(
process
,
request
);
SecUser
secUser
=
SecUser
.
getTXUser
(
process
.
getTransaction
());
CompanyUser
companyUser
=
secUser
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
);
// Update company in intercom
if
(
companyUser
.
getCompany
()
!=
null
)
{
IntercomUtils
.
updateCompany
(
companyUser
.
getCompany
());
}
return
super
.
processForm
(
process
,
submission
,
params
);
return
super
.
processForm
(
process
,
submission
,
params
);
}
}
...
...
cmsWebApp/src/performa/form/SaveUserDetailsFP.java
View file @
360576bf
...
@@ -19,8 +19,6 @@ import oneit.utils.CollectionUtils;
...
@@ -19,8 +19,6 @@ import oneit.utils.CollectionUtils;
import
oneit.utils.InitialisationException
;
import
oneit.utils.InitialisationException
;
import
oneit.utils.MultiException
;
import
oneit.utils.MultiException
;
import
oneit.utils.StringUtils
;
import
oneit.utils.StringUtils
;
import
performa.intercom.resources.User
;
import
performa.intercom.utils.IntercomUtils
;
import
performa.orm.CompanyUser
;
import
performa.orm.CompanyUser
;
import
performa.utils.Utils
;
import
performa.utils.Utils
;
...
@@ -83,18 +81,6 @@ public class SaveUserDetailsFP extends SaveFP
...
@@ -83,18 +81,6 @@ public class SaveUserDetailsFP extends SaveFP
}
}
}
}
User
intercomUser
=
(
User
)
request
.
getSession
().
getAttribute
(
"IntercomUser"
);
if
(
intercomUser
==
null
)
{
performa
.
intercom
.
resources
.
Company
intercomCompany
=
IntercomUtils
.
findOrCreateCompany
(
companyUser
.
getCompany
());
IntercomUtils
.
createIntercomUser
(
secUser
,
"Hiring Team"
,
intercomCompany
,
companyUser
.
getPhone
());
}
else
{
IntercomUtils
.
updateIntercomUser
(
secUser
,
companyUser
.
getPhone
());
}
}
}
return
super
.
processForm
(
process
,
submission
,
params
);
return
super
.
processForm
(
process
,
submission
,
params
);
...
...
cmsWebApp/src/performa/form/SendCompanyUserInvitesFP.java
View file @
360576bf
...
@@ -17,7 +17,6 @@ import oneit.servlets.forms.*;
...
@@ -17,7 +17,6 @@ import oneit.servlets.forms.*;
import
oneit.servlets.process.*
;
import
oneit.servlets.process.*
;
import
oneit.servlets.security.SessionSecUserDecorator
;
import
oneit.servlets.security.SessionSecUserDecorator
;
import
oneit.utils.*
;
import
oneit.utils.*
;
import
performa.intercom.utils.IntercomUtils
;
import
performa.orm.*
;
import
performa.orm.*
;
import
performa.orm.types.RoleType
;
import
performa.orm.types.RoleType
;
import
performa.utils.StripeUtils
;
import
performa.utils.StripeUtils
;
...
@@ -165,12 +164,6 @@ public class SendCompanyUserInvitesFP extends SaveFP
...
@@ -165,12 +164,6 @@ public class SendCompanyUserInvitesFP extends SaveFP
}
}
}
}
// Create company and the first user of it in intercom
performa
.
intercom
.
resources
.
Company
intercomCompany
=
IntercomUtils
.
findOrCreateCompany
(
company
);
IntercomUtils
.
createIntercomUser
(
secUser
,
"Hiring Team"
,
intercomCompany
,
companyUser
.
getPhone
());
return
super
.
processForm
(
process
,
submission
,
params
);
return
super
.
processForm
(
process
,
submission
,
params
);
}
}
...
...
cmsWebApp/src/performa/form/VerifyIdentityFP.java
View file @
360576bf
...
@@ -15,7 +15,6 @@ import oneit.servlets.forms.*;
...
@@ -15,7 +15,6 @@ import oneit.servlets.forms.*;
import
oneit.servlets.process.*
;
import
oneit.servlets.process.*
;
import
oneit.servlets.security.SessionSecUserDecorator
;
import
oneit.servlets.security.SessionSecUserDecorator
;
import
oneit.utils.*
;
import
oneit.utils.*
;
import
performa.intercom.utils.IntercomUtils
;
import
performa.orm.*
;
import
performa.orm.*
;
import
performa.utils.Utils
;
import
performa.utils.Utils
;
import
performa.utils.WebUtils
;
import
performa.utils.WebUtils
;
...
@@ -74,9 +73,6 @@ public class VerifyIdentityFP extends SaveFP
...
@@ -74,9 +73,6 @@ public class VerifyIdentityFP extends SaveFP
sendMail
(
candidate
,
job
,
request
);
sendMail
(
candidate
,
job
,
request
);
// Create a applicant user in intercom
IntercomUtils
.
createIntercomUser
(
secUser
,
"Applicant"
,
null
,
candidate
.
getPhone
());
request
.
getSession
().
setAttribute
(
SecUser
.
SEC_USER_ID
,
secUser
);
request
.
getSession
().
setAttribute
(
SecUser
.
SEC_USER_ID
,
secUser
);
request
.
getSession
().
setAttribute
(
SessionSecUserDecorator
.
REFRESH_SECURITY
,
Boolean
.
TRUE
);
request
.
getSession
().
setAttribute
(
SessionSecUserDecorator
.
REFRESH_SECURITY
,
Boolean
.
TRUE
);
// request.setAttribute("nextPage", nextPage + "&JobID=" + job.getObjectID());
// request.setAttribute("nextPage", nextPage + "&JobID=" + job.getObjectID());
...
...
cmsWebApp/src/performa/intercom/resources/Admin.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.collect.Maps
;
import
java.util.Map
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
Admin
extends
TypedData
implements
Replier
{
private
static
final
Map
<
String
,
String
>
SENTINEL
=
Maps
.
newHashMap
();
public
static
final
String
TYPE_NOBODY
=
"nobody_admin"
;
// don't make public for now
static
AdminCollection
list
(
Map
<
String
,
String
>
params
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
list
(
params
,
"admins"
,
AdminCollection
.
class
);
}
public
static
AdminCollection
list
()
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
list
(
SENTINEL
,
"admins"
,
AdminCollection
.
class
);
}
@SuppressWarnings
(
"FieldCanBeLocal"
)
@JsonProperty
(
"type"
)
private
final
String
type
=
"admin"
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"name"
)
private
String
name
;
@JsonProperty
(
"email"
)
private
String
email
;
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
(
"updated_at"
)
private
long
updatedAt
;
@JsonProperty
(
"open"
)
private
long
open
;
@JsonProperty
(
"closed"
)
private
long
closed
;
public
Admin
()
{
}
@JsonIgnore
public
String
getReplyType
()
{
return
getType
()
+
"_reply"
;
}
public
String
getType
()
{
return
type
;
}
@JsonIgnore
public
boolean
isNobody
()
{
return
TYPE_NOBODY
.
equalsIgnoreCase
(
getType
());
}
@JsonIgnore
public
boolean
isSomebody
()
{
return
(!
isNobody
())
&&
(
getId
()
!=
null
);
}
public
String
getId
()
{
return
id
;
}
public
Admin
setId
(
String
id
)
{
this
.
id
=
id
;
return
this
;
}
public
String
getName
()
{
return
name
;
}
public
String
getEmail
()
{
return
email
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
public
long
getUpdatedAt
()
{
return
updatedAt
;
}
public
long
getOpen
()
{
return
open
;
}
public
long
getClosed
()
{
return
closed
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Admin
admin
=
(
Admin
)
o
;
if
(
closed
!=
admin
.
closed
)
return
false
;
if
(
createdAt
!=
admin
.
createdAt
)
return
false
;
if
(
open
!=
admin
.
open
)
return
false
;
if
(
updatedAt
!=
admin
.
updatedAt
)
return
false
;
if
(
email
!=
null
?
!
email
.
equals
(
admin
.
email
)
:
admin
.
email
!=
null
)
return
false
;
if
(
id
!=
null
?
!
id
.
equals
(
admin
.
id
)
:
admin
.
id
!=
null
)
return
false
;
if
(
name
!=
null
?
!
name
.
equals
(
admin
.
name
)
:
admin
.
name
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(!
type
.
equals
(
admin
.
type
))
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
type
.
hashCode
();
result
=
31
*
result
+
(
id
!=
null
?
id
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
name
!=
null
?
name
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
email
!=
null
?
email
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
int
)
(
createdAt
^
(
createdAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
updatedAt
^
(
updatedAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
open
^
(
open
>>>
32
));
result
=
31
*
result
+
(
int
)
(
closed
^
(
closed
>>>
32
));
return
result
;
}
@Override
public
String
toString
()
{
return
"Admin{"
+
"id='"
+
id
+
'\''
+
", name='"
+
name
+
'\''
+
", email='"
+
email
+
'\''
+
", createdAt="
+
createdAt
+
", updatedAt="
+
updatedAt
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/AdminCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
performa.intercom.resources.Admin
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Iterator
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
AdminCollection
extends
TypedDataCollection
<
Admin
>
implements
Iterator
<
Admin
>
{
protected
TypedDataCollectionIterator
<
Admin
>
iterator
;
public
AdminCollection
()
{
type
=
"company.list"
;
iterator
=
new
TypedDataCollectionIterator
<
Admin
>(
this
);
}
@Override
public
AdminCollection
nextPage
()
{
return
fetchNextPage
(
AdminCollection
.
class
);
}
@SuppressWarnings
(
"EmptyMethod"
)
@JsonProperty
(
"admins"
)
@Override
public
List
<
Admin
>
getPage
()
{
return
super
.
getPage
();
}
public
boolean
hasNext
()
{
return
iterator
.
hasNext
();
}
public
Admin
next
()
{
return
iterator
.
next
();
}
public
void
remove
()
{
iterator
.
remove
();
}
}
cmsWebApp/src/performa/intercom/resources/AdminMessage.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.annotations.VisibleForTesting
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
AdminMessage
extends
TypedData
{
@JsonProperty
(
"type"
)
private
final
String
type
=
"admin_message"
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"message_type"
)
private
String
messageType
;
@JsonProperty
(
"subject"
)
private
String
subject
=
""
;
// Set default to blank string so null pointer exception won't thrown if messageType = inapp and subject not set
@JsonProperty
(
"body"
)
private
String
body
;
@JsonProperty
(
"template"
)
private
String
template
=
"plain"
;
// Set default to plain so null pointer exception won't thrown if messageType = inapp and template not set
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
(
"from"
)
private
Admin
admin
;
@JsonProperty
(
"to"
)
private
User
user
;
public
AdminMessage
()
{
}
public
String
getType
()
{
return
type
;
}
public
String
getId
()
{
return
id
;
}
@SuppressWarnings
(
"UnusedReturnValue"
)
@VisibleForTesting
AdminMessage
setId
(
String
id
)
{
this
.
id
=
id
;
return
this
;
}
public
String
getMessageType
()
{
return
messageType
;
}
public
AdminMessage
setMessageType
(
String
messageType
)
{
this
.
messageType
=
messageType
;
return
this
;
}
public
String
getSubject
()
{
return
subject
;
}
public
AdminMessage
setSubject
(
String
subject
)
{
this
.
subject
=
subject
;
return
this
;
}
public
String
getBody
()
{
return
body
;
}
public
AdminMessage
setBody
(
String
body
)
{
this
.
body
=
body
;
return
this
;
}
public
String
getTemplate
()
{
return
template
;
}
public
AdminMessage
setTemplate
(
String
template
)
{
this
.
template
=
template
;
return
this
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
@SuppressWarnings
(
"UnusedReturnValue"
)
public
AdminMessage
setCreatedAt
(
long
createdAt
)
{
this
.
createdAt
=
createdAt
;
return
this
;
}
public
Admin
getAdmin
()
{
return
admin
;
}
public
AdminMessage
setAdmin
(
Admin
admin
)
{
this
.
admin
=
admin
;
return
this
;
}
public
User
getUser
()
{
return
user
;
}
public
AdminMessage
setUser
(
User
user
)
{
this
.
user
=
user
;
return
this
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
AdminMessage
message
=
(
AdminMessage
)
o
;
if
(
createdAt
!=
message
.
createdAt
)
return
false
;
if
(
admin
!=
null
?
!
admin
.
equals
(
message
.
admin
)
:
message
.
admin
!=
null
)
return
false
;
if
(
body
!=
null
?
!
body
.
equals
(
message
.
body
)
:
message
.
body
!=
null
)
return
false
;
if
(
id
!=
null
?
!
id
.
equals
(
message
.
id
)
:
message
.
id
!=
null
)
return
false
;
if
(
messageType
!=
null
?
!
messageType
.
equals
(
message
.
messageType
)
:
message
.
messageType
!=
null
)
return
false
;
if
(
subject
!=
null
?
!
subject
.
equals
(
message
.
subject
)
:
message
.
subject
!=
null
)
return
false
;
if
(
template
!=
null
?
!
template
.
equals
(
message
.
template
)
:
message
.
template
!=
null
)
return
false
;
if
(!
type
.
equals
(
message
.
type
))
return
false
;
//noinspection RedundantIfStatement
if
(
user
!=
null
?
!
user
.
equals
(
message
.
user
)
:
message
.
user
!=
null
)
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
type
.
hashCode
();
result
=
31
*
result
+
(
id
!=
null
?
id
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
messageType
!=
null
?
messageType
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
subject
!=
null
?
subject
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
body
!=
null
?
body
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
template
!=
null
?
template
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
int
)
(
createdAt
^
(
createdAt
>>>
32
));
result
=
31
*
result
+
(
admin
!=
null
?
admin
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
user
!=
null
?
user
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
String
toString
()
{
return
"AdminMessage{"
+
"id='"
+
id
+
'\''
+
", messageType='"
+
messageType
+
'\''
+
", subject='"
+
subject
+
'\''
+
", body='"
+
body
+
'\''
+
", template='"
+
template
+
'\''
+
", createdAt="
+
createdAt
+
", admin="
+
admin
+
", user="
+
user
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/AdminMessageResponse.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
performa.intercom.resources.Admin
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
class
AdminMessageResponse
extends
TypedData
{
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"message_type"
)
private
String
messageType
;
@JsonProperty
(
"subject"
)
private
String
subject
;
@JsonProperty
(
"body"
)
private
String
body
;
@JsonProperty
(
"template"
)
private
String
template
;
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
(
"updated_at"
)
private
long
updatedAt
;
@JsonProperty
(
"owner"
)
private
Admin
admin
;
@JsonProperty
(
"to"
)
private
User
user
;
public
AdminMessageResponse
()
{
}
public
String
getType
()
{
return
"admin_message"
;
}
public
String
getId
()
{
return
id
;
}
public
AdminMessageResponse
setId
(
String
id
)
{
this
.
id
=
id
;
return
this
;
}
public
String
getMessageType
()
{
return
messageType
;
}
public
AdminMessageResponse
setMessageType
(
String
messageType
)
{
this
.
messageType
=
messageType
;
return
this
;
}
public
String
getSubject
()
{
return
subject
;
}
public
AdminMessageResponse
setSubject
(
String
subject
)
{
this
.
subject
=
subject
;
return
this
;
}
public
String
getBody
()
{
return
body
;
}
public
AdminMessageResponse
setBody
(
String
body
)
{
this
.
body
=
body
;
return
this
;
}
public
String
getTemplate
()
{
return
template
;
}
public
AdminMessageResponse
setTemplate
(
String
template
)
{
this
.
template
=
template
;
return
this
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
public
AdminMessageResponse
setCreatedAt
(
long
createdAt
)
{
this
.
createdAt
=
createdAt
;
return
this
;
}
public
long
getUpdatedAt
()
{
return
updatedAt
;
}
public
AdminMessageResponse
setUpdatedAt
(
long
updatedAt
)
{
this
.
updatedAt
=
updatedAt
;
return
this
;
}
public
Admin
getAdmin
()
{
return
admin
;
}
public
AdminMessageResponse
setAdmin
(
Admin
admin
)
{
this
.
admin
=
admin
;
return
this
;
}
public
User
getUser
()
{
return
user
;
}
public
AdminMessageResponse
setUser
(
User
user
)
{
this
.
user
=
user
;
return
this
;
}
}
cmsWebApp/src/performa/intercom/resources/AdminReply.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
performa.intercom.resources.Admin
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
AdminReply
extends
Reply
<
Admin
>
{
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
static
class
AdminStringReply
{
private
AdminReply
reply
;
public
AdminStringReply
(
AdminReply
reply
)
{
this
.
reply
=
reply
;
}
@JsonProperty
(
"type"
)
public
String
getType
()
{
return
reply
.
getType
();
}
@JsonProperty
(
"message_type"
)
public
String
getMessageType
()
{
return
reply
.
getMessageType
();
}
@JsonProperty
(
"body"
)
public
String
getBody
()
{
return
reply
.
getBody
();
}
@JsonProperty
(
"admin_id"
)
public
String
getAdminID
()
{
return
reply
.
getFrom
().
getId
();
}
@JsonProperty
(
"assignee_id"
)
public
String
getAssigneeID
()
{
return
reply
.
getAssigneeID
();
}
@JsonProperty
(
"attachment_urls"
)
private
String
[]
getAttachmentUrls
()
{
return
reply
.
getAttachmentUrls
();
}
}
@JsonProperty
(
"assignee_id"
)
private
String
assigneeID
;
public
AdminReply
(
Admin
admin
)
{
this
.
from
=
admin
;
}
public
Reply
<
Admin
>
setMessageType
(
String
messageType
)
{
return
setMessageReplyType
(
messageType
);
}
public
String
getAssigneeID
()
{
return
assigneeID
;
}
public
Reply
<
Admin
>
setAssigneeID
(
String
assigneeID
)
{
this
.
assigneeID
=
assigneeID
;
this
.
setMessageType
(
Conversation
.
MESSAGE_TYPE_ASSIGNMENT
);
return
this
;
}
@Override
public
String
toString
()
{
return
"AdminReply{} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/Author.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
Author
extends
TypedData
{
@JsonProperty
(
"type"
)
private
String
type
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"name"
)
private
String
name
;
@JsonProperty
(
"email"
)
private
String
email
;
@JsonProperty
(
"user_id"
)
private
String
userId
;
public
Author
()
{
}
public
String
getType
()
{
return
type
;
}
@JsonIgnore
public
boolean
isUser
()
{
return
"user"
.
equalsIgnoreCase
(
getType
());
}
@JsonIgnore
public
boolean
isAdmin
()
{
return
"admin"
.
equalsIgnoreCase
(
getType
());
}
public
String
getId
()
{
return
id
;
}
public
Author
setId
(
String
id
)
{
this
.
id
=
id
;
return
this
;
}
public
String
getName
()
{
return
name
;
}
public
Author
setName
(
String
name
)
{
this
.
name
=
name
;
return
this
;
}
public
String
getEmail
()
{
return
email
;
}
public
Author
setEmail
(
String
email
)
{
this
.
email
=
email
;
return
this
;
}
public
String
getUserId
()
{
return
userId
;
}
public
Author
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
return
this
;
}
@Override
public
int
hashCode
()
{
int
result
=
id
!=
null
?
id
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
name
!=
null
?
name
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
email
!=
null
?
email
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
userId
!=
null
?
userId
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Author
author
=
(
Author
)
o
;
if
(
email
!=
null
?
!
email
.
equals
(
author
.
email
)
:
author
.
email
!=
null
)
return
false
;
if
(
id
!=
null
?
!
id
.
equals
(
author
.
id
)
:
author
.
id
!=
null
)
return
false
;
if
(
name
!=
null
?
!
name
.
equals
(
author
.
name
)
:
author
.
name
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(
userId
!=
null
?
!
userId
.
equals
(
author
.
userId
)
:
author
.
userId
!=
null
)
return
false
;
return
true
;
}
@Override
public
String
toString
()
{
return
"Author{"
+
"id='"
+
id
+
'\''
+
", name='"
+
name
+
'\''
+
", email='"
+
email
+
'\''
+
", userId='"
+
userId
+
'\''
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/AuthorizationException.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
public
class
AuthorizationException
extends
IntercomException
{
private
static
final
long
serialVersionUID
=
2917082281352001861L
;
public
AuthorizationException
(
String
message
)
{
super
(
message
);
}
public
AuthorizationException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
AuthorizationException
(
ErrorCollection
errorCollection
)
{
super
(
errorCollection
);
}
public
AuthorizationException
(
ErrorCollection
errorCollection
,
Throwable
cause
)
{
super
(
errorCollection
,
cause
);
}
}
cmsWebApp/src/performa/intercom/resources/Avatar.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.net.URI
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
public
class
Avatar
extends
TypedData
{
@JsonProperty
(
"type"
)
private
final
String
type
=
"avatar"
;
@JsonProperty
(
"image_url"
)
private
URI
imageURL
;
Avatar
()
{
}
public
String
getType
()
{
return
type
;
}
public
URI
getImageURL
()
{
return
imageURL
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Avatar
avatar
=
(
Avatar
)
o
;
if
(
imageURL
!=
null
?
!
imageURL
.
equals
(
avatar
.
imageURL
)
:
avatar
.
imageURL
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(!
type
.
equals
(
avatar
.
type
))
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
type
.
hashCode
();
result
=
31
*
result
+
(
imageURL
!=
null
?
imageURL
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
String
toString
()
{
return
"Avatar{"
+
"type='"
+
type
+
'\''
+
", imageURL="
+
imageURL
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/ClientException.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
public
class
ClientException
extends
IntercomException
{
private
static
final
long
serialVersionUID
=
-
2111295679006526646L
;
public
ClientException
(
String
message
)
{
super
(
message
);
}
public
ClientException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
ClientException
(
ErrorCollection
errorCollection
)
{
super
(
errorCollection
);
}
public
ClientException
(
ErrorCollection
errorCollection
,
Throwable
cause
)
{
super
(
errorCollection
,
cause
);
}
}
cmsWebApp/src/performa/intercom/resources/Company.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.annotations.VisibleForTesting
;
import
com.google.common.collect.Maps
;
import
java.net.URI
;
import
java.util.Map
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
Company
extends
TypedData
{
private
static
final
Map
<
String
,
String
>
SENTINEL
=
Maps
.
newHashMap
();
public
static
Company
find
(
String
id
)
throws
InvalidException
,
AuthorizationException
{
final
HttpClient
resource
=
new
HttpClient
(
UriBuilder
.
newBuilder
().
path
(
"companies"
).
path
(
id
).
build
());
return
resource
.
get
(
Company
.
class
);
}
public
static
Company
find
(
Map
<
String
,
String
>
params
)
throws
InvalidException
,
AuthorizationException
{
if
(!
params
.
containsKey
(
"company_id"
)
&&
!
params
.
containsKey
(
"name"
))
{
throw
new
InvalidException
(
"a company find must include a company_id or name parameter"
);
}
return
DataResource
.
find
(
params
,
"companies"
,
Company
.
class
);
}
public
static
Company
create
(
Company
company
)
throws
InvalidException
,
AuthorizationException
{
return
update
(
company
);
}
public
static
Company
update
(
Company
company
)
throws
InvalidException
,
AuthorizationException
{
// because the data is asymmetric on the plan field
final
CompanyWithStringPlan
entity
=
new
CompanyWithStringPlan
();
entity
.
setCompanyID
(
company
.
getCompanyID
());
entity
.
setName
(
company
.
getName
());
entity
.
setSessionCount
(
company
.
getSessionCount
());
entity
.
setMonthlySpend
(
company
.
getMonthlySpend
());
entity
.
setRemoteCreatedAt
(
company
.
getRemoteCreatedAt
());
if
(
company
.
getCustomAttributes
()
!=
null
)
{
entity
.
getCustomAttributes
().
putAll
(
company
.
getCustomAttributes
());
}
if
(
company
.
getPlan
()
!=
null
)
{
entity
.
setPlan
(
company
.
getPlan
().
getName
());
}
return
DataResource
.
update
(
entity
,
"companies"
,
Company
.
class
);
}
public
static
Company
delete
(
String
id
)
throws
InvalidException
,
AuthorizationException
{
return
DataResource
.
delete
(
id
,
"companies"
,
Company
.
class
);
}
public
static
CompanyCollection
list
(
Map
<
String
,
String
>
params
)
throws
InvalidException
,
AuthorizationException
{
return
DataResource
.
list
(
params
,
"companies"
,
CompanyCollection
.
class
);
}
public
static
CompanyCollection
list
()
throws
InvalidException
,
AuthorizationException
{
return
DataResource
.
list
(
SENTINEL
,
"companies"
,
CompanyCollection
.
class
);
}
public
static
ScrollableCompanyCollection
scroll
()
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
scroll
(
null
,
"companies"
,
ScrollableCompanyCollection
.
class
);
}
public
static
UserCollection
listUsers
(
Map
<
String
,
String
>
params
)
throws
InvalidException
,
AuthorizationException
{
URI
usersURI
;
if
(
params
.
containsKey
(
"company_id"
))
{
usersURI
=
UriBuilder
.
newBuilder
()
.
path
(
"companies"
)
.
query
(
"company_id"
,
params
.
get
(
"company_id"
))
.
query
(
"type"
,
"users"
)
.
build
();
}
else
if
(
params
.
containsKey
(
"id"
))
{
usersURI
=
UriBuilder
.
newBuilder
()
.
path
(
"companies"
)
.
path
(
params
.
get
(
"id"
))
.
path
(
"users"
)
.
build
();
}
else
{
throw
new
InvalidException
(
"a company user list query must supply a company_id or id parameter"
);
}
final
HttpClient
resource
=
new
HttpClient
(
usersURI
);
return
resource
.
get
(
UserCollection
.
class
);
}
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
static
class
Plan
extends
TypedData
{
@JsonProperty
(
"type"
)
protected
String
type
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"name"
)
private
String
name
;
public
Plan
()
{
type
=
"plan"
;
}
public
Plan
(
String
name
)
{
this
();
this
.
name
=
name
;
}
public
String
getId
()
{
return
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getType
()
{
return
type
;
}
@Override
public
int
hashCode
()
{
int
result
=
id
!=
null
?
id
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
name
!=
null
?
name
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Plan
plan
=
(
Plan
)
o
;
if
(
id
!=
null
?
!
id
.
equals
(
plan
.
id
)
:
plan
.
id
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(
name
!=
null
?
!
name
.
equals
(
plan
.
name
)
:
plan
.
name
!=
null
)
return
false
;
return
true
;
}
@Override
public
String
toString
()
{
return
"Plan{"
+
"id='"
+
id
+
'\''
+
", name='"
+
name
+
'\''
+
"} "
+
super
.
toString
();
}
}
@SuppressWarnings
(
"FieldCanBeLocal"
)
@JsonProperty
(
"type"
)
private
final
String
type
=
"company"
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"name"
)
private
String
name
;
@JsonProperty
(
"company_id"
)
private
String
companyID
;
@JsonProperty
(
"session_count"
)
private
int
sessionCount
;
@JsonProperty
(
"monthly_spend"
)
private
float
monthlySpend
;
@JsonProperty
(
"remote_created_at"
)
private
long
remoteCreatedAt
;
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
(
"updated_at"
)
private
long
updatedAt
;
@JsonProperty
(
"plan"
)
private
Plan
plan
;
@JsonProperty
(
"user_count"
)
private
Integer
userCount
;
@JsonIgnoreProperties
(
ignoreUnknown
=
false
)
@JsonProperty
(
"custom_attributes"
)
private
Map
<
String
,
CustomAttribute
>
customAttributes
=
Maps
.
newHashMap
();
@JsonProperty
(
"segments"
)
private
SegmentCollection
segmentCollection
=
new
SegmentCollection
();
@JsonProperty
(
"tags"
)
private
TagCollection
tagCollection
=
new
TagCollection
();
private
Boolean
untag
;
public
Company
()
{
}
public
Company
untag
()
{
untag
=
Boolean
.
TRUE
;
return
this
;
}
public
String
getType
()
{
return
type
;
}
public
String
getId
()
{
return
id
;
}
@VisibleForTesting
Company
setId
(
String
id
)
{
this
.
id
=
id
;
return
this
;
}
public
String
getName
()
{
return
name
;
}
public
Company
setName
(
String
name
)
{
this
.
name
=
name
;
return
this
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
public
long
getUpdatedAt
()
{
return
updatedAt
;
}
public
String
getCompanyID
()
{
return
companyID
;
}
public
Company
setCompanyID
(
String
companyID
)
{
this
.
companyID
=
companyID
;
return
this
;
}
public
int
getSessionCount
()
{
return
sessionCount
;
}
/**
* Deprecated. The Intercom API does not support changing the
* session value for a company. Calling this method has no
* effect.
*
* @param sessionCount this value is ignored
* @return the company object
*/
@Deprecated
public
Company
setSessionCount
(
int
sessionCount
)
{
return
this
;
}
public
long
getRemoteCreatedAt
()
{
return
remoteCreatedAt
;
}
public
Company
setRemoteCreatedAt
(
long
remoteCreatedAt
)
{
this
.
remoteCreatedAt
=
remoteCreatedAt
;
return
this
;
}
public
Map
<
String
,
CustomAttribute
>
getCustomAttributes
()
{
return
customAttributes
;
}
public
Company
setCustomAttributes
(
Map
<
String
,
CustomAttribute
>
customAttributes
)
{
this
.
customAttributes
=
customAttributes
;
return
this
;
}
public
Company
addCustomAttribute
(
CustomAttribute
customAttribute
)
{
this
.
customAttributes
.
put
(
customAttribute
.
getName
(),
customAttribute
);
return
this
;
}
public
Plan
getPlan
()
{
return
plan
;
}
public
Company
setPlan
(
Plan
plan
)
{
this
.
plan
=
plan
;
return
this
;
}
public
Integer
getUserCount
()
{
return
userCount
;
}
public
float
getMonthlySpend
()
{
return
monthlySpend
;
}
public
Company
setMonthlySpend
(
float
monthlySpend
)
{
this
.
monthlySpend
=
monthlySpend
;
return
this
;
}
public
SegmentCollection
getSegmentCollection
()
{
return
segmentCollection
;
}
public
TagCollection
getTagCollection
()
{
return
tagCollection
;
}
boolean
isUntag
()
{
return
untag
==
null
?
false
:
untag
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Company
company
=
(
Company
)
o
;
if
(
createdAt
!=
company
.
createdAt
)
return
false
;
if
(
Float
.
compare
(
company
.
monthlySpend
,
monthlySpend
)
!=
0
)
return
false
;
if
(
remoteCreatedAt
!=
company
.
remoteCreatedAt
)
return
false
;
if
(
sessionCount
!=
company
.
sessionCount
)
return
false
;
if
(
updatedAt
!=
company
.
updatedAt
)
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
;
if
(
id
!=
null
?
!
id
.
equals
(
company
.
id
)
:
company
.
id
!=
null
)
return
false
;
if
(
name
!=
null
?
!
name
.
equals
(
company
.
name
)
:
company
.
name
!=
null
)
return
false
;
if
(
plan
!=
null
?
!
plan
.
equals
(
company
.
plan
)
:
company
.
plan
!=
null
)
return
false
;
if
(
segmentCollection
!=
null
?
!
segmentCollection
.
equals
(
company
.
segmentCollection
)
:
company
.
segmentCollection
!=
null
)
return
false
;
if
(
tagCollection
!=
null
?
!
tagCollection
.
equals
(
company
.
tagCollection
)
:
company
.
tagCollection
!=
null
)
return
false
;
if
(!
type
.
equals
(
company
.
type
))
return
false
;
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
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
type
.
hashCode
();
result
=
31
*
result
+
(
id
!=
null
?
id
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
name
!=
null
?
name
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
companyID
!=
null
?
companyID
.
hashCode
()
:
0
);
result
=
31
*
result
+
sessionCount
;
result
=
31
*
result
+
(
monthlySpend
!=
+
0.0f
?
Float
.
floatToIntBits
(
monthlySpend
)
:
0
);
result
=
31
*
result
+
(
int
)
(
remoteCreatedAt
^
(
remoteCreatedAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
createdAt
^
(
createdAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
updatedAt
^
(
updatedAt
>>>
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
);
return
result
;
}
@Override
public
String
toString
()
{
return
"Company{"
+
"id='"
+
id
+
'\''
+
", name='"
+
name
+
'\''
+
", companyID='"
+
companyID
+
'\''
+
", sessionCount="
+
sessionCount
+
", monthlySpend="
+
monthlySpend
+
", remoteCreatedAt="
+
remoteCreatedAt
+
", createdAt="
+
createdAt
+
", updatedAt="
+
updatedAt
+
", plan="
+
plan
+
", customAttributes="
+
customAttributes
+
", segmentCollection="
+
segmentCollection
+
", tagCollection="
+
tagCollection
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/CompanyCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Iterator
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
CompanyCollection
extends
TypedDataCollection
<
Company
>
implements
Iterator
<
Company
>
{
protected
TypedDataCollectionIterator
<
Company
>
iterator
;
@JsonProperty
(
"total_count"
)
private
long
totalCount
;
public
CompanyCollection
()
{
type
=
"company.list"
;
iterator
=
new
TypedDataCollectionIterator
<
Company
>(
this
);
}
public
CompanyCollection
(
List
<
Company
>
companies
)
{
this
();
this
.
page
=
companies
;
}
@SuppressWarnings
(
"EmptyMethod"
)
@JsonProperty
(
"companies"
)
@Override
public
List
<
Company
>
getPage
()
{
return
super
.
getPage
();
}
public
long
getTotalCount
()
{
return
totalCount
;
}
@Override
public
CompanyCollection
nextPage
()
{
return
fetchNextPage
(
CompanyCollection
.
class
);
}
public
boolean
hasNext
()
{
return
iterator
.
hasNext
();
}
public
Company
next
()
{
return
iterator
.
next
();
}
public
void
remove
()
{
iterator
.
remove
();
}
@Override
public
String
toString
()
{
return
"CompanyCollection{"
+
", totalCount="
+
totalCount
+
"} "
+
super
.
toString
();
}
void
addCompany
(
Company
company
)
{
page
.
add
(
company
);
}
}
cmsWebApp/src/performa/intercom/resources/CompanyUpdateBuilder.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.google.common.base.Objects
;
import
com.google.common.base.Predicate
;
import
com.google.common.collect.Iterables
;
import
com.google.common.collect.Lists
;
import
java.util.List
;
class
CompanyUpdateBuilder
{
/**
* Provide restrictions on the company data that can be sent via a user update
*/
static
List
<
CompanyWithStringPlan
>
buildUserUpdateCompanies
(
CompanyCollection
add
,
CompanyCollection
remove
)
{
final
List
<
CompanyWithStringPlan
>
updatableCompanies
=
Lists
.
newArrayList
();
if
(
add
!=
null
)
{
final
List
<
Company
>
companies
=
add
.
getPage
();
for
(
Company
company
:
companies
)
{
if
(!
isCompanyInList
(
company
,
remove
))
{
updatableCompanies
.
add
(
prepareUpdatableCompany
(
company
));
}
}
}
if
(
remove
!=
null
)
{
final
List
<
Company
>
companies
=
remove
.
getPage
();
for
(
Company
company
:
companies
)
{
updatableCompanies
.
add
(
prepareUpdatableCompany
(
company
).
setRemove
(
Boolean
.
TRUE
));
}
}
return
updatableCompanies
;
}
private
static
boolean
isCompanyInList
(
final
Company
company
,
CompanyCollection
companyCollection
)
{
if
(
companyCollection
==
null
)
{
return
false
;
}
return
Iterables
.
any
(
companyCollection
.
getPage
(),
new
Predicate
<
Company
>()
{
@Override
public
boolean
apply
(
Company
e
)
{
return
Objects
.
equal
(
company
.
getCompanyID
(),
e
.
getCompanyID
())
||
Objects
.
equal
(
company
.
getId
(),
e
.
getId
());
}
});
}
private
static
CompanyWithStringPlan
prepareUpdatableCompany
(
Company
company
)
{
final
CompanyWithStringPlan
updatableCompany
=
new
CompanyWithStringPlan
();
updatableCompany
.
setId
(
company
.
getId
());
updatableCompany
.
setCompanyID
(
company
.
getCompanyID
());
updatableCompany
.
setName
(
company
.
getName
());
updatableCompany
.
setSessionCount
(
company
.
getSessionCount
());
updatableCompany
.
setMonthlySpend
(
company
.
getMonthlySpend
());
updatableCompany
.
setRemoteCreatedAt
(
company
.
getRemoteCreatedAt
());
if
(
company
.
getCustomAttributes
()
!=
null
)
{
updatableCompany
.
getCustomAttributes
().
putAll
(
company
.
getCustomAttributes
());
}
if
(
company
.
getPlan
()
!=
null
)
{
updatableCompany
.
setPlan
(
company
.
getPlan
().
getName
());
}
return
updatableCompany
;
}
}
cmsWebApp/src/performa/intercom/resources/CompanyWithStringPlan.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.collect.Maps
;
import
java.util.Map
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
class
CompanyWithStringPlan
extends
TypedData
{
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"name"
)
private
String
name
;
@JsonProperty
(
"company_id"
)
private
String
companyID
;
@JsonProperty
(
"session_count"
)
private
int
sessionCount
;
@JsonProperty
(
"monthly_spend"
)
private
float
monthlySpend
;
@JsonProperty
(
"remote_created_at"
)
private
long
remoteCreatedAt
;
@JsonProperty
(
"plan"
)
private
String
plan
;
@JsonIgnoreProperties
(
ignoreUnknown
=
false
)
@JsonProperty
(
"custom_attributes"
)
private
Map
<
String
,
CustomAttribute
>
customAttributes
=
Maps
.
newHashMap
();
@JsonProperty
(
"remove"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
private
Boolean
remove
;
public
CompanyWithStringPlan
()
{
}
public
String
getType
()
{
return
"company"
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getCompanyID
()
{
return
companyID
;
}
public
void
setCompanyID
(
String
companyID
)
{
this
.
companyID
=
companyID
;
}
public
Integer
getSessionCount
()
{
return
sessionCount
;
}
public
void
setSessionCount
(
Integer
sessionCount
)
{
this
.
sessionCount
=
sessionCount
;
}
public
float
getMonthlySpend
()
{
return
monthlySpend
;
}
public
void
setMonthlySpend
(
float
monthlySpend
)
{
this
.
monthlySpend
=
monthlySpend
;
}
public
long
getRemoteCreatedAt
()
{
return
remoteCreatedAt
;
}
public
void
setRemoteCreatedAt
(
long
remoteCreatedAt
)
{
this
.
remoteCreatedAt
=
remoteCreatedAt
;
}
public
String
getPlan
()
{
return
plan
;
}
public
void
setPlan
(
String
plan
)
{
this
.
plan
=
plan
;
}
public
Map
<
String
,
CustomAttribute
>
getCustomAttributes
()
{
return
customAttributes
;
}
public
void
setCustomAttributes
(
Map
<
String
,
CustomAttribute
>
customAttributes
)
{
this
.
customAttributes
=
customAttributes
;
}
public
Boolean
getRemove
()
{
return
remove
;
}
public
CompanyWithStringPlan
setRemove
(
Boolean
remove
)
{
this
.
remove
=
remove
;
return
this
;
}
}
cmsWebApp/src/performa/intercom/resources/Conditions.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.google.common.collect.Lists
;
class
Conditions
{
/**
* Ensures that an object reference passed as a parameter to the calling
* method is not null. Variant of Guava's Preconditions that returns an
* InvalidException containing an ErrorCollection
*
* @param reference an object reference
* @param errorMessage the exception message to use if the check fails
* @return the non-null reference that was validated
* @throws InvalidException if {@code reference} is null
*/
public
static
<
T
>
T
checkNotNull
(
T
reference
,
String
errorMessage
)
{
if
(
reference
==
null
)
{
throw
new
InvalidException
(
new
ErrorCollection
(
Lists
.
newArrayList
(
new
Error
(
"invalid"
,
"item method must be supplied"
))));
}
return
reference
;
}
}
cmsWebApp/src/performa/intercom/resources/Contact.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.annotations.VisibleForTesting
;
import
com.google.common.collect.Maps
;
import
java.net.URI
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
public
class
Contact
extends
TypedData
implements
Replier
{
private
static
final
Map
<
String
,
String
>
SENTINEL
=
Maps
.
newHashMap
();
public
static
Contact
findByID
(
String
id
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
new
HttpClient
(
contactURI
(
id
)).
get
(
Contact
.
class
);
}
public
static
Contact
findByUserID
(
String
userID
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
final
Map
<
String
,
String
>
params
=
Maps
.
newHashMap
();
params
.
put
(
"user_id"
,
userID
);
return
DataResource
.
find
(
params
,
"contacts"
,
Contact
.
class
);
}
public
static
ContactCollection
listByEmail
(
String
email
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
final
Map
<
String
,
String
>
params
=
Maps
.
newHashMap
();
params
.
put
(
"email"
,
email
);
return
list
(
params
);
}
public
static
ContactCollection
list
(
Map
<
String
,
String
>
params
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
list
(
params
,
"contacts"
,
ContactCollection
.
class
);
}
public
static
ContactCollection
list
()
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
list
(
SENTINEL
,
"contacts"
,
ContactCollection
.
class
);
}
public
static
ScrollableContactCollection
scroll
()
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
scroll
(
null
,
"contacts"
,
ScrollableContactCollection
.
class
);
}
public
static
Contact
create
(
Contact
c
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
create
(
ContactUpdate
.
buildFrom
(
c
),
"contacts"
,
Contact
.
class
);
}
public
static
Contact
update
(
Contact
c
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
update
(
ContactUpdate
.
buildFrom
(
c
),
"contacts"
,
Contact
.
class
);
}
public
static
Contact
delete
(
Contact
c
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
delete
(
c
.
getID
(),
"contacts"
,
Contact
.
class
);
}
public
static
User
convert
(
Contact
c
,
User
u
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
post
(
ContactConvertBuilder
.
buildConvert
(
c
,
u
),
convertURI
(),
User
.
class
);
}
private
static
URI
contactURI
(
String
id
)
{
return
UriBuilder
.
newBuilder
().
path
(
"contacts"
).
path
(
id
).
build
();
}
private
static
URI
convertURI
()
{
return
UriBuilder
.
newBuilder
().
path
(
"contacts"
).
path
(
"convert"
).
build
();
}
static
class
ContactConvertBuilder
{
static
ContactConvert
buildConvert
(
Contact
c
,
User
u
)
throws
InvalidException
{
return
new
ContactConvertBuilder
().
build
(
c
,
u
);
}
ContactConvert
build
(
Contact
c
,
User
u
)
throws
InvalidException
{
return
new
ContactConvert
(
buildConvertContact
(
c
),
buildConvertUser
(
u
));
}
HashMap
<
String
,
String
>
buildConvertUser
(
User
u
)
{
final
HashMap
<
String
,
String
>
convertUser
=
Maps
.
newHashMap
();
if
(
u
.
getId
()
!=
null
)
{
convertUser
.
put
(
"id"
,
u
.
getId
());
}
if
(
u
.
getUserId
()
!=
null
)
{
convertUser
.
put
(
"user_id"
,
u
.
getUserId
());
}
if
(
u
.
getEmail
()
!=
null
)
{
convertUser
.
put
(
"email"
,
u
.
getEmail
());
}
checkValidConvertContact
(
convertUser
);
return
convertUser
;
}
void
checkValidConvertContact
(
HashMap
<
String
,
String
>
convertUser
)
{
if
((!
convertUser
.
containsKey
(
"id"
))
&&
(!
convertUser
.
containsKey
(
"user_id"
))
&&
(!
convertUser
.
containsKey
(
"email"
)))
{
throw
new
InvalidException
(
"a convert user must include at least one of, an id, user_id or email parameter"
);
}
}
HashMap
<
String
,
String
>
buildConvertContact
(
Contact
c
)
{
final
HashMap
<
String
,
String
>
convertContact
=
Maps
.
newHashMap
();
if
(
c
.
getID
()
!=
null
)
{
convertContact
.
put
(
"id"
,
c
.
getID
());
}
if
(
c
.
getUserID
()
!=
null
)
{
convertContact
.
put
(
"user_id"
,
c
.
getUserID
());
}
checkValidConvertUser
(
convertContact
);
return
convertContact
;
}
void
checkValidConvertUser
(
HashMap
<
String
,
String
>
convertContact
)
{
if
((!
convertContact
.
containsKey
(
"id"
))
&&
(!
convertContact
.
containsKey
(
"user_id"
)))
{
throw
new
InvalidException
(
"a convert contact must include at least one of, an id or a user_id parameter"
);
}
}
}
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
static
class
ContactConvert
{
@JsonProperty
(
"contact"
)
private
Map
<
String
,
String
>
contact
;
@JsonProperty
(
"user"
)
private
Map
<
String
,
String
>
user
;
public
ContactConvert
()
{
}
public
ContactConvert
(
Map
<
String
,
String
>
contact
,
Map
<
String
,
String
>
user
)
{
this
.
contact
=
contact
;
this
.
user
=
user
;
}
public
Map
<
String
,
String
>
getContact
()
{
return
contact
;
}
public
void
setContact
(
Map
<
String
,
String
>
contact
)
{
this
.
contact
=
contact
;
}
public
Map
<
String
,
String
>
getUser
()
{
return
user
;
}
public
void
setUser
(
Map
<
String
,
String
>
user
)
{
this
.
user
=
user
;
}
}
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
static
class
ContactUpdate
extends
TypedData
{
static
ContactUpdate
buildFrom
(
Contact
c
)
{
final
ContactUpdate
contactUpdate
=
new
ContactUpdate
();
contactUpdate
.
id
=
c
.
getID
();
// propagated, noset
contactUpdate
.
userID
=
c
.
getUserID
();
// propagated, noset
contactUpdate
.
email
=
c
.
getEmail
();
contactUpdate
.
phone
=
c
.
getPhone
();
contactUpdate
.
name
=
c
.
getName
();
contactUpdate
.
lastSeenIP
=
c
.
getLastSeenIP
();
contactUpdate
.
customAttributes
=
c
.
getCustomAttributes
();
contactUpdate
.
lastRequestAt
=
c
.
getLastRequestAt
();
contactUpdate
.
unsubscribedFromEmails
=
c
.
getUnsubscribedFromEmails
();
return
contactUpdate
;
}
@JsonProperty
(
"type"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
private
String
type
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"user_id"
)
private
String
userID
;
@JsonProperty
(
"email"
)
private
String
email
;
@JsonProperty
(
"phone"
)
private
String
phone
;
@JsonProperty
(
"name"
)
private
String
name
;
@JsonProperty
(
"last_seen_ip"
)
private
String
lastSeenIP
;
@JsonIgnoreProperties
(
ignoreUnknown
=
false
)
@JsonProperty
(
"custom_attributes"
)
private
Map
<
String
,
CustomAttribute
>
customAttributes
=
Maps
.
newHashMap
();
@JsonProperty
(
"last_seen_user_agent"
)
private
String
lastSeenUserAgent
;
@JsonProperty
(
"companies"
)
private
List
<
CompanyWithStringPlan
>
companyCollection
;
@JsonProperty
(
"last_request_at"
)
private
long
lastRequestAt
;
@JsonProperty
(
"signed_up_at"
)
private
long
signedUpAt
;
/*
* Making these Booleans allows us to send true or false as set
* values leaving null the ignored field for NON_DEFAULT. A
* primitive would result in false not being sent
*/
@JsonProperty
(
"unsubscribed_from_emails"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
private
Boolean
unsubscribedFromEmails
;
@JsonProperty
(
"update_last_request_at"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
private
Boolean
updateLastRequestAt
;
@JsonProperty
(
"new_session"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
private
Boolean
newSession
;
public
ContactUpdate
()
{
}
public
String
getType
()
{
return
type
;
}
public
String
getID
()
{
return
id
;
}
public
String
getUserID
()
{
return
userID
;
}
public
String
getEmail
()
{
return
email
;
}
public
String
getPhone
()
{
return
phone
;
}
public
String
getName
()
{
return
name
;
}
public
String
getLastSeenIP
()
{
return
lastSeenIP
;
}
public
Map
<
String
,
CustomAttribute
>
getCustomAttributes
()
{
return
customAttributes
;
}
public
String
getLastSeenUserAgent
()
{
return
lastSeenUserAgent
;
}
public
List
<
CompanyWithStringPlan
>
getCompanyCollection
()
{
return
companyCollection
;
}
public
long
getLastRequestAt
()
{
return
lastRequestAt
;
}
public
Boolean
getUnsubscribedFromEmails
()
{
return
unsubscribedFromEmails
;
}
public
Boolean
isUpdateLastRequestAt
()
{
return
updateLastRequestAt
;
}
public
Boolean
isNewSession
()
{
return
newSession
;
}
}
@JsonProperty
(
"type"
)
@JsonInclude
(
JsonInclude
.
Include
.
ALWAYS
)
private
final
String
type
=
"contact"
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"user_id"
)
private
String
userID
;
@JsonProperty
(
"email"
)
private
String
email
;
@JsonProperty
(
"phone"
)
private
String
phone
;
@JsonProperty
(
"name"
)
private
String
name
;
@JsonProperty
(
"pseudonym"
)
private
String
pseudonym
;
@JsonProperty
(
"avatar"
)
private
Avatar
avatar
;
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
(
"updated_at"
)
private
long
updatedAt
;
@JsonProperty
(
"unsubscribed_from_emails"
)
private
Boolean
unsubscribedFromEmails
;
@JsonProperty
(
"session_count"
)
private
int
sessionCount
;
@JsonProperty
(
"last_request_at"
)
private
long
lastRequestAt
;
@JsonProperty
(
"last_seen_ip"
)
private
String
lastSeenIP
;
@JsonIgnoreProperties
(
ignoreUnknown
=
false
)
@JsonProperty
(
"custom_attributes"
)
private
Map
<
String
,
CustomAttribute
>
customAttributes
=
Maps
.
newHashMap
();
@JsonProperty
(
"user_agent_data"
)
private
String
userAgentData
;
@JsonProperty
(
"location_data"
)
private
LocationData
locationData
;
@JsonIgnoreProperties
(
ignoreUnknown
=
false
)
@JsonProperty
(
"companies"
)
private
CompanyCollection
companyCollection
=
new
CompanyCollection
();
@JsonProperty
(
"social_profiles"
)
private
SocialProfileCollection
socialProfileCollection
=
new
SocialProfileCollection
();
@JsonProperty
(
"segments"
)
private
SegmentCollection
segmentCollection
=
new
SegmentCollection
();
@JsonProperty
(
"tags"
)
private
TagCollection
tagCollection
=
new
TagCollection
();
@JsonProperty
(
"update_last_request_at"
)
private
Boolean
updateLastRequestAt
;
@JsonProperty
(
"new_session"
)
private
Boolean
newSession
;
private
Boolean
untag
;
public
Contact
()
{
}
public
Contact
untag
()
{
untag
=
Boolean
.
TRUE
;
return
this
;
}
boolean
isUntag
()
{
return
untag
==
null
?
false
:
untag
;
}
@JsonIgnore
public
String
getReplyType
()
{
return
getType
()
+
"_reply"
;
}
public
String
getType
()
{
return
type
;
}
public
String
getID
()
{
return
id
;
}
@VisibleForTesting
Contact
setID
(
String
id
)
{
this
.
id
=
id
;
return
this
;
}
public
String
getName
()
{
return
name
;
}
public
Contact
setName
(
String
name
)
{
this
.
name
=
name
;
return
this
;
}
public
String
getPseudonym
()
{
return
pseudonym
;
}
public
String
getEmail
()
{
return
email
;
}
public
Contact
setEmail
(
String
email
)
{
this
.
email
=
email
;
return
this
;
}
public
String
getPhone
()
{
return
phone
;
}
public
Contact
setPhone
(
String
phone
)
{
this
.
phone
=
phone
;
return
this
;
}
public
String
getUserID
()
{
return
userID
;
}
public
Avatar
getAvatar
()
{
return
avatar
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
public
long
getUpdatedAt
()
{
return
updatedAt
;
}
public
Boolean
getUnsubscribedFromEmails
()
{
return
unsubscribedFromEmails
;
}
public
Contact
setUnsubscribedFromEmails
(
boolean
unsubscribedFromEmails
)
{
this
.
unsubscribedFromEmails
=
unsubscribedFromEmails
;
return
this
;
}
public
int
getSessionCount
()
{
return
sessionCount
;
}
public
long
getLastRequestAt
()
{
return
lastRequestAt
;
}
public
Contact
setLastRequestAt
(
long
lastRequestAt
)
{
this
.
lastRequestAt
=
lastRequestAt
;
return
this
;
}
public
String
getLastSeenIP
()
{
return
lastSeenIP
;
}
public
Contact
setLastSeenIP
(
String
lastSeenIP
)
{
this
.
lastSeenIP
=
lastSeenIP
;
return
this
;
}
public
Map
<
String
,
CustomAttribute
>
getCustomAttributes
()
{
return
customAttributes
;
}
public
Contact
setCustomAttributes
(
Map
<
String
,
CustomAttribute
>
customAttributes
)
{
this
.
customAttributes
=
customAttributes
;
return
this
;
}
public
Contact
addCustomAttribute
(
CustomAttribute
customAttribute
)
{
this
.
customAttributes
.
put
(
customAttribute
.
getName
(),
customAttribute
);
return
this
;
}
public
String
getUserAgentData
()
{
return
userAgentData
;
}
public
LocationData
getLocationData
()
{
return
locationData
;
}
public
CompanyCollection
getCompanyCollection
()
{
return
companyCollection
;
}
public
SocialProfileCollection
getSocialProfileCollection
()
{
return
socialProfileCollection
;
}
public
SegmentCollection
getSegmentCollection
()
{
return
segmentCollection
;
}
public
TagCollection
getTagCollection
()
{
return
tagCollection
;
}
public
Boolean
isUpdateLastRequestAt
()
{
return
updateLastRequestAt
;
}
public
Boolean
isNewSession
()
{
return
newSession
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Contact
contact
=
(
Contact
)
o
;
if
(
createdAt
!=
contact
.
createdAt
)
return
false
;
if
(
updatedAt
!=
contact
.
updatedAt
)
return
false
;
if
(
sessionCount
!=
contact
.
sessionCount
)
return
false
;
if
(
lastRequestAt
!=
contact
.
lastRequestAt
)
return
false
;
if
(!
type
.
equals
(
contact
.
type
))
return
false
;
if
(
id
!=
null
?
!
id
.
equals
(
contact
.
id
)
:
contact
.
id
!=
null
)
return
false
;
if
(
name
!=
null
?
!
name
.
equals
(
contact
.
name
)
:
contact
.
name
!=
null
)
return
false
;
if
(
email
!=
null
?
!
email
.
equals
(
contact
.
email
)
:
contact
.
email
!=
null
)
return
false
;
if
(
phone
!=
null
?
!
phone
.
equals
(
contact
.
phone
)
:
contact
.
phone
!=
null
)
return
false
;
if
(
userID
!=
null
?
!
userID
.
equals
(
contact
.
userID
)
:
contact
.
userID
!=
null
)
return
false
;
if
(
avatar
!=
null
?
!
avatar
.
equals
(
contact
.
avatar
)
:
contact
.
avatar
!=
null
)
return
false
;
if
(
unsubscribedFromEmails
!=
null
?
!
unsubscribedFromEmails
.
equals
(
contact
.
unsubscribedFromEmails
)
:
contact
.
unsubscribedFromEmails
!=
null
)
return
false
;
if
(
lastSeenIP
!=
null
?
!
lastSeenIP
.
equals
(
contact
.
lastSeenIP
)
:
contact
.
lastSeenIP
!=
null
)
return
false
;
if
(
customAttributes
!=
null
?
!
customAttributes
.
equals
(
contact
.
customAttributes
)
:
contact
.
customAttributes
!=
null
)
return
false
;
if
(
userAgentData
!=
null
?
!
userAgentData
.
equals
(
contact
.
userAgentData
)
:
contact
.
userAgentData
!=
null
)
return
false
;
if
(
locationData
!=
null
?
!
locationData
.
equals
(
contact
.
locationData
)
:
contact
.
locationData
!=
null
)
return
false
;
if
(
companyCollection
!=
null
?
!
companyCollection
.
equals
(
contact
.
companyCollection
)
:
contact
.
companyCollection
!=
null
)
return
false
;
if
(
socialProfileCollection
!=
null
?
!
socialProfileCollection
.
equals
(
contact
.
socialProfileCollection
)
:
contact
.
socialProfileCollection
!=
null
)
return
false
;
if
(
segmentCollection
!=
null
?
!
segmentCollection
.
equals
(
contact
.
segmentCollection
)
:
contact
.
segmentCollection
!=
null
)
return
false
;
if
(
tagCollection
!=
null
?
!
tagCollection
.
equals
(
contact
.
tagCollection
)
:
contact
.
tagCollection
!=
null
)
return
false
;
if
(
updateLastRequestAt
!=
null
?
!
updateLastRequestAt
.
equals
(
contact
.
updateLastRequestAt
)
:
contact
.
updateLastRequestAt
!=
null
)
return
false
;
//noinspection SimplifiableIfStatement
if
(
newSession
!=
null
?
!
newSession
.
equals
(
contact
.
newSession
)
:
contact
.
newSession
!=
null
)
return
false
;
return
!(
untag
!=
null
?
!
untag
.
equals
(
contact
.
untag
)
:
contact
.
untag
!=
null
);
}
@Override
public
int
hashCode
()
{
int
result
=
type
.
hashCode
();
result
=
31
*
result
+
(
id
!=
null
?
id
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
name
!=
null
?
name
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
email
!=
null
?
email
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
phone
!=
null
?
phone
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
userID
!=
null
?
userID
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
avatar
!=
null
?
avatar
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
int
)
(
createdAt
^
(
createdAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
updatedAt
^
(
updatedAt
>>>
32
));
result
=
31
*
result
+
(
unsubscribedFromEmails
!=
null
?
unsubscribedFromEmails
.
hashCode
()
:
0
);
result
=
31
*
result
+
sessionCount
;
result
=
31
*
result
+
(
int
)
(
lastRequestAt
^
(
lastRequestAt
>>>
32
));
result
=
31
*
result
+
(
lastSeenIP
!=
null
?
lastSeenIP
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
customAttributes
!=
null
?
customAttributes
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
userAgentData
!=
null
?
userAgentData
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
locationData
!=
null
?
locationData
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
companyCollection
!=
null
?
companyCollection
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
socialProfileCollection
!=
null
?
socialProfileCollection
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
segmentCollection
!=
null
?
segmentCollection
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
tagCollection
!=
null
?
tagCollection
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
updateLastRequestAt
!=
null
?
updateLastRequestAt
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
newSession
!=
null
?
newSession
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
untag
!=
null
?
untag
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
String
toString
()
{
return
"Contact{"
+
"type='"
+
type
+
'\''
+
", id='"
+
id
+
'\''
+
", name='"
+
name
+
'\''
+
", email='"
+
email
+
'\''
+
", phone='"
+
phone
+
'\''
+
", userID='"
+
userID
+
'\''
+
", avatar="
+
avatar
+
", createdAt="
+
createdAt
+
", updatedAt="
+
updatedAt
+
", unsubscribedFromEmails="
+
unsubscribedFromEmails
+
", sessionCount="
+
sessionCount
+
", lastRequestAt="
+
lastRequestAt
+
", lastSeenIP='"
+
lastSeenIP
+
'\''
+
", customAttributes="
+
customAttributes
+
", userAgentData='"
+
userAgentData
+
'\''
+
", locationData="
+
locationData
+
", companyCollection="
+
companyCollection
+
", socialProfileCollection="
+
socialProfileCollection
+
", segmentCollection="
+
segmentCollection
+
", tagCollection="
+
tagCollection
+
", updateLastRequestAt="
+
updateLastRequestAt
+
", newSession="
+
newSession
+
", untag="
+
untag
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/ContactCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Iterator
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
ContactCollection
extends
TypedDataCollection
<
Contact
>
implements
Iterator
<
Contact
>
{
protected
TypedDataCollectionIterator
<
Contact
>
iterator
;
public
ContactCollection
()
{
iterator
=
new
TypedDataCollectionIterator
<
Contact
>(
this
);
}
public
ContactCollection
(
List
<
Contact
>
contacts
)
{
this
();
this
.
page
=
contacts
;
}
@SuppressWarnings
(
"EmptyMethod"
)
@JsonProperty
(
"contacts"
)
@Override
public
List
<
Contact
>
getPage
()
{
return
super
.
getPage
();
}
@Override
public
ContactCollection
nextPage
()
{
return
fetchNextPage
(
ContactCollection
.
class
);
}
public
boolean
hasNext
()
{
return
iterator
.
hasNext
();
}
public
Contact
next
()
{
return
iterator
.
next
();
}
public
void
remove
()
{
iterator
.
remove
();
}
}
cmsWebApp/src/performa/intercom/resources/ContactMessage.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
ContactMessage
extends
TypedMessage
<
Contact
,
ContactMessage
>
{
public
ContactMessage
()
{
}
@Override
public
String
toString
()
{
return
"ContactMessage{} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/Conversation.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.base.Joiner
;
import
com.google.common.base.Optional
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
java.net.URI
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
Conversation
extends
TypedData
{
private
static
final
HashMap
<
String
,
String
>
SENTINEL
=
Maps
.
newHashMap
();
private
static
final
List
<
String
>
DISPLAY_AS_FORMATS
=
Lists
.
newArrayList
(
"plaintext"
,
"html"
);
static
final
String
MESSAGE_TYPE_ASSIGNMENT
=
"assignment"
;
static
final
String
MESSAGE_TYPE_COMMENT
=
"comment"
;
static
final
String
MESSAGE_TYPE_NOTE
=
"note"
;
static
final
String
MESSAGE_TYPE_CLOSE
=
"close"
;
static
final
String
MESSAGE_TYPE_OPEN
=
"open"
;
static
final
List
<
String
>
MESSAGE_TYPES
=
Lists
.
newArrayList
(
MESSAGE_TYPE_ASSIGNMENT
,
MESSAGE_TYPE_COMMENT
,
MESSAGE_TYPE_NOTE
,
MESSAGE_TYPE_CLOSE
,
MESSAGE_TYPE_OPEN
);
public
static
Conversation
find
(
String
id
)
throws
InvalidException
,
AuthorizationException
{
final
HttpClient
resource
=
new
HttpClient
(
UriBuilder
.
newBuilder
().
path
(
"conversations"
).
path
(
id
).
build
());
return
resource
.
get
(
Conversation
.
class
);
}
public
static
ConversationCollection
list
()
throws
InvalidException
,
AuthorizationException
{
return
DataResource
.
list
(
SENTINEL
,
"conversations"
,
ConversationCollection
.
class
);
}
public
static
ConversationCollection
list
(
Map
<
String
,
String
>
params
)
throws
InvalidException
,
AuthorizationException
{
validateListRequest
(
params
);
return
DataResource
.
list
(
params
,
"conversations"
,
ConversationCollection
.
class
);
}
public
static
Conversation
reply
(
String
id
,
UserReply
reply
)
{
validateUserReplyRequest
(
reply
);
final
URI
uri
=
UriBuilder
.
newBuilder
()
.
path
(
"conversations"
)
.
path
(
id
)
.
path
(
"reply"
)
.
build
();
return
new
HttpClient
(
uri
)
.
post
(
Conversation
.
class
,
new
UserReply
.
UserStringReply
(
reply
));
}
public
static
Conversation
reply
(
String
id
,
AdminReply
reply
)
{
validateAdminReplyRequest
(
reply
);
final
URI
uri
=
UriBuilder
.
newBuilder
()
.
path
(
"conversations"
)
.
path
(
id
)
.
path
(
"reply"
)
.
build
();
return
new
HttpClient
(
uri
)
.
post
(
Conversation
.
class
,
new
AdminReply
.
AdminStringReply
(
reply
));
}
public
static
UserMessage
create
(
UserMessage
message
)
{
return
DataResource
.
create
(
message
,
"messages"
,
UserMessage
.
class
);
}
public
static
ContactMessage
create
(
ContactMessage
message
)
{
return
DataResource
.
create
(
message
,
"messages"
,
ContactMessage
.
class
);
}
public
static
AdminMessage
create
(
AdminMessage
message
)
throws
InvalidException
{
if
((!
message
.
getTemplate
().
equals
(
"plain"
))
&&
(!
message
.
getTemplate
().
equals
(
"personal"
)))
{
throw
new
InvalidException
(
"The template must be either personal or plain"
);
}
if
((!
message
.
getMessageType
().
equals
(
"email"
))
&&
(!
message
.
getMessageType
().
equals
(
"inapp"
)))
{
throw
new
InvalidException
(
"The message type must be either email or inapp"
);
}
/*
the message api is asymmetric because reasons. this wraps the response
type so we only expose AdminMessage in the client surface
*/
final
AdminMessageResponse
adminMessageResponse
=
DataResource
.
create
(
message
,
"messages"
,
AdminMessageResponse
.
class
);
AdminMessage
response
=
new
AdminMessage
();
response
.
setAdmin
(
adminMessageResponse
.
getAdmin
());
response
.
setBody
(
adminMessageResponse
.
getBody
());
response
.
setCreatedAt
(
adminMessageResponse
.
getCreatedAt
());
response
.
setId
(
adminMessageResponse
.
getId
());
response
.
setMessageType
(
adminMessageResponse
.
getMessageType
());
response
.
setSubject
(
adminMessageResponse
.
getSubject
());
response
.
setTemplate
(
adminMessageResponse
.
getTemplate
());
// user returns null
// response.setUser(adminMessageResponse.getFrom());
return
response
;
}
static
void
validateAdminReplyRequest
(
AdminReply
reply
)
{
validateMessageType
(
reply
);
if
(
reply
.
getAssigneeID
()
!=
null
&&
!
"assignment"
.
equals
(
reply
.
getMessageType
()))
{
throw
new
InvalidException
(
"an assignee id can be set only for a message type of assignment"
);
}
if
((
"note"
.
equals
(
reply
.
getMessageType
())
||
"comment"
.
equals
(
reply
.
getMessageType
()))
&&
(
isNullOrBlank
(
reply
.
getBody
()))
)
{
throw
new
InvalidException
(
"a comment or note reply must have a body"
);
}
}
static
boolean
isNullOrBlank
(
String
s
)
{
return
s
==
null
||
s
.
trim
().
length
()
==
0
;
}
static
void
validateUserReplyRequest
(
UserReply
reply
)
{
if
(!
"comment"
.
equals
(
reply
.
getMessageType
()))
{
throw
new
InvalidException
(
"a user reply must have a message type of comment"
);
}
}
static
void
validateMessageType
(
Reply
reply
)
{
if
(!
MESSAGE_TYPES
.
contains
(
reply
.
getMessageType
()))
{
throw
new
InvalidException
(
"A reply message type must be one of "
+
Joiner
.
on
(
", "
).
join
(
MESSAGE_TYPES
));
}
}
static
void
validateListRequest
(
Map
<
String
,
String
>
params
)
{
if
(!
params
.
containsKey
(
"type"
))
{
throw
new
InvalidException
(
"a user or admin type must be supplied for a conversation query"
);
}
if
(
isAdminQuery
(
params
)
&&
!(
params
.
containsKey
(
"admin_id"
)))
{
throw
new
InvalidException
(
"an admin_id must be supplied for an admin conversation query"
);
}
if
(
params
.
containsKey
(
"display_as"
))
{
if
(!
DISPLAY_AS_FORMATS
.
contains
(
params
.
get
(
"display_as"
)))
{
throw
new
InvalidException
(
"A display_as parameter must have one of the values "
+
Joiner
.
on
(
", "
).
join
(
DISPLAY_AS_FORMATS
));
}
}
if
(
isUserQuery
(
params
)
&&
(!
params
.
containsKey
(
"intercom_user_id"
)
&&
!
params
.
containsKey
(
"user_id"
)
&&
!
params
.
containsKey
(
"email"
)))
{
throw
new
InvalidException
(
"One of intercom_user_id, user_id or email must be supplied for a user conversation query"
);
}
}
private
static
boolean
isUserQuery
(
Map
<
String
,
String
>
params
)
{
return
params
.
containsKey
(
"type"
)
&&
params
.
get
(
"type"
).
equals
(
"user"
);
}
private
static
boolean
isAdminQuery
(
Map
<
String
,
String
>
params
)
{
return
params
.
containsKey
(
"type"
)
&&
params
.
get
(
"type"
).
equals
(
"admin"
);
}
@JsonProperty
(
"type"
)
private
final
String
type
=
"conversation"
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"conversation_message"
)
private
ConversationMessage
conversationMessage
;
@JsonProperty
(
"user"
)
private
User
user
;
@JsonProperty
(
"assignee"
)
private
Admin
assignee
;
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
(
"updated_at"
)
private
long
updatedAt
;
@JsonProperty
(
"conversation_parts"
)
private
ConversationPartCollection
conversationPartCollection
;
@JsonProperty
(
"open"
)
private
boolean
open
;
@JsonProperty
(
"read"
)
private
boolean
read
;
@JsonProperty
(
"links"
)
private
Map
<
String
,
URI
>
links
;
public
Conversation
()
{
}
public
String
getType
()
{
return
type
;
}
public
Admin
getCurrentAssignee
()
{
Admin
assignee
=
null
;
if
(
getAssignee
()
!=
null
)
{
assignee
=
getAssignee
();
}
else
if
(
getMostRecentConversationPart
()
!=
null
&&
getMostRecentConversationPart
().
getAssignedTo
()
!=
null
)
{
assignee
=
getMostRecentConversationPart
().
getAssignedTo
();
}
return
assignee
;
}
public
Optional
<
ConversationPart
>
getFirstConversationPart
()
{
return
Optional
.
fromNullable
(
getConversationPartCollection
().
getPage
().
get
(
0
));
}
public
ConversationPart
getMostRecentConversationPart
()
{
final
ConversationPartCollection
conversationParts
=
getConversationPartCollection
();
final
List
<
ConversationPart
>
items
=
conversationParts
.
getPage
();
if
(
items
.
isEmpty
())
{
return
null
;
}
else
{
return
items
.
get
(
items
.
size
()
-
1
);
}
}
public
String
getId
()
{
return
id
;
}
public
ConversationMessage
getConversationMessage
()
{
return
conversationMessage
;
}
public
User
getUser
()
{
return
user
;
}
public
Admin
getAssignee
()
{
return
assignee
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
public
long
getUpdatedAt
()
{
return
updatedAt
;
}
public
ConversationPartCollection
getConversationPartCollection
()
{
if
(
conversationPartCollection
==
null
)
{
conversationPartCollection
=
find
(
this
.
getId
()).
getConversationPartCollection
();
}
return
conversationPartCollection
;
}
public
boolean
getOpen
()
{
return
open
;
}
public
boolean
getRead
()
{
return
read
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Conversation
that
=
(
Conversation
)
o
;
if
(
createdAt
!=
that
.
createdAt
)
return
false
;
if
(
open
!=
that
.
open
)
return
false
;
if
(
read
!=
that
.
read
)
return
false
;
if
(
updatedAt
!=
that
.
updatedAt
)
return
false
;
if
(
assignee
!=
null
?
!
assignee
.
equals
(
that
.
assignee
)
:
that
.
assignee
!=
null
)
return
false
;
if
(
conversationMessage
!=
null
?
!
conversationMessage
.
equals
(
that
.
conversationMessage
)
:
that
.
conversationMessage
!=
null
)
return
false
;
if
(
conversationPartCollection
!=
null
?
!
conversationPartCollection
.
equals
(
that
.
conversationPartCollection
)
:
that
.
conversationPartCollection
!=
null
)
return
false
;
if
(
id
!=
null
?
!
id
.
equals
(
that
.
id
)
:
that
.
id
!=
null
)
return
false
;
if
(
links
!=
null
?
!
links
.
equals
(
that
.
links
)
:
that
.
links
!=
null
)
return
false
;
if
(!
type
.
equals
(
that
.
type
))
return
false
;
//noinspection RedundantIfStatement
if
(
user
!=
null
?
!
user
.
equals
(
that
.
user
)
:
that
.
user
!=
null
)
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
type
.
hashCode
();
result
=
31
*
result
+
(
id
!=
null
?
id
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
conversationMessage
!=
null
?
conversationMessage
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
user
!=
null
?
user
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
assignee
!=
null
?
assignee
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
int
)
(
createdAt
^
(
createdAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
updatedAt
^
(
updatedAt
>>>
32
));
result
=
31
*
result
+
(
conversationPartCollection
!=
null
?
conversationPartCollection
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
open
?
1
:
0
);
result
=
31
*
result
+
(
read
?
1
:
0
);
result
=
31
*
result
+
(
links
!=
null
?
links
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
String
toString
()
{
return
"Conversation{"
+
"type='"
+
type
+
'\''
+
", id='"
+
id
+
'\''
+
", conversationMessage="
+
conversationMessage
+
", user="
+
user
+
", assignee="
+
assignee
+
", createdAt="
+
createdAt
+
", updatedAt="
+
updatedAt
+
", conversationPartCollection="
+
conversationPartCollection
+
", open="
+
open
+
", read="
+
read
+
", links="
+
links
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/ConversationCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Iterator
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
ConversationCollection
extends
TypedDataCollection
<
Conversation
>
implements
Iterator
<
Conversation
>
{
protected
TypedDataCollectionIterator
<
Conversation
>
iterator
;
public
ConversationCollection
()
{
type
=
"conversation.list"
;
iterator
=
new
TypedDataCollectionIterator
<
Conversation
>(
this
);
}
@SuppressWarnings
(
"EmptyMethod"
)
@JsonProperty
(
"conversations"
)
public
List
<
Conversation
>
getPage
()
{
return
super
.
getPage
();
}
@Override
public
ConversationCollection
nextPage
()
{
return
fetchNextPage
(
ConversationCollection
.
class
);
}
public
boolean
hasNext
()
{
return
iterator
.
hasNext
();
}
public
Conversation
next
()
{
return
iterator
.
next
();
}
public
void
remove
()
{
iterator
.
remove
();
}
}
cmsWebApp/src/performa/intercom/resources/ConversationMessage.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
ConversationMessage
extends
TypedData
{
@SuppressWarnings
(
"FieldCanBeLocal"
)
@JsonProperty
(
"type"
)
private
final
String
type
=
"conversation_message"
;
@JsonProperty
private
String
subject
;
@JsonProperty
private
String
body
;
@JsonProperty
private
Author
author
;
public
ConversationMessage
()
{
}
public
String
getType
()
{
return
type
;
}
public
String
getSubject
()
{
return
subject
;
}
public
String
getBody
()
{
return
body
;
}
public
Author
getAuthor
()
{
return
author
;
}
@Override
public
int
hashCode
()
{
int
result
=
subject
!=
null
?
subject
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
body
!=
null
?
body
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
author
!=
null
?
author
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
ConversationMessage
that
=
(
ConversationMessage
)
o
;
if
(
author
!=
null
?
!
author
.
equals
(
that
.
author
)
:
that
.
author
!=
null
)
return
false
;
if
(
body
!=
null
?
!
body
.
equals
(
that
.
body
)
:
that
.
body
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(
subject
!=
null
?
!
subject
.
equals
(
that
.
subject
)
:
that
.
subject
!=
null
)
return
false
;
return
true
;
}
@Override
public
String
toString
()
{
return
"ConversationMessage{"
+
"type='"
+
type
+
'\''
+
", subject='"
+
subject
+
'\''
+
", body='"
+
body
+
'\''
+
", author="
+
author
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/ConversationPart.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
performa.intercom.resources.Admin
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
ConversationPart
extends
TypedData
{
@JsonProperty
(
"type"
)
private
final
String
type
=
"conversation_part"
;
@JsonProperty
private
String
id
;
@JsonProperty
(
"part_type"
)
private
String
partType
;
@JsonProperty
private
String
body
;
@JsonProperty
private
Author
author
;
@JsonProperty
(
"assigned_to"
)
private
Admin
assignedTo
;
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
(
"updated_at"
)
private
long
updatedAt
;
@JsonProperty
(
"notified_at"
)
private
long
NotifiedAt
;
public
ConversationPart
()
{
}
public
String
getType
()
{
return
type
;
}
public
String
getId
()
{
return
id
;
}
public
String
getPartType
()
{
return
partType
;
}
public
String
getBody
()
{
return
body
;
}
public
Author
getAuthor
()
{
return
author
;
}
public
Admin
getAssignedTo
()
{
return
assignedTo
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
public
long
getUpdatedAt
()
{
return
updatedAt
;
}
public
long
getNotifiedAt
()
{
return
NotifiedAt
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
ConversationPart
that
=
(
ConversationPart
)
o
;
if
(
NotifiedAt
!=
that
.
NotifiedAt
)
return
false
;
if
(
createdAt
!=
that
.
createdAt
)
return
false
;
if
(
updatedAt
!=
that
.
updatedAt
)
return
false
;
if
(
assignedTo
!=
null
?
!
assignedTo
.
equals
(
that
.
assignedTo
)
:
that
.
assignedTo
!=
null
)
return
false
;
if
(
author
!=
null
?
!
author
.
equals
(
that
.
author
)
:
that
.
author
!=
null
)
return
false
;
if
(
body
!=
null
?
!
body
.
equals
(
that
.
body
)
:
that
.
body
!=
null
)
return
false
;
if
(
id
!=
null
?
!
id
.
equals
(
that
.
id
)
:
that
.
id
!=
null
)
return
false
;
if
(
partType
!=
null
?
!
partType
.
equals
(
that
.
partType
)
:
that
.
partType
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(!
type
.
equals
(
that
.
type
))
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
type
.
hashCode
();
result
=
31
*
result
+
(
id
!=
null
?
id
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
partType
!=
null
?
partType
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
body
!=
null
?
body
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
author
!=
null
?
author
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
assignedTo
!=
null
?
assignedTo
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
int
)
(
createdAt
^
(
createdAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
updatedAt
^
(
updatedAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
NotifiedAt
^
(
NotifiedAt
>>>
32
));
return
result
;
}
@Override
public
String
toString
()
{
return
"ConversationPart{"
+
"type='"
+
type
+
'\''
+
", id='"
+
id
+
'\''
+
", partType='"
+
partType
+
'\''
+
", body='"
+
body
+
'\''
+
", author="
+
author
+
", assignedTo="
+
assignedTo
+
", createdAt="
+
createdAt
+
", updatedAt="
+
updatedAt
+
", NotifiedAt="
+
NotifiedAt
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/ConversationPartCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
ConversationPartCollection
extends
TypedDataCollection
<
ConversationPart
>
{
public
ConversationPartCollection
()
{
type
=
"conversation_part.list"
;
}
@SuppressWarnings
(
"EmptyMethod"
)
@JsonProperty
(
"conversation_parts"
)
public
List
<
ConversationPart
>
getPage
()
{
return
super
.
getPage
();
}
@Override
public
ConversationPartCollection
nextPage
()
{
return
new
ConversationPartCollection
();
}
}
cmsWebApp/src/performa/intercom/resources/CountItemDeserializer.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.core.JsonParser
;
import
com.fasterxml.jackson.core.TreeNode
;
import
com.fasterxml.jackson.databind.DeserializationContext
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.deser.std.StdDeserializer
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
java.io.IOException
;
import
java.util.Map
;
class
CountItemDeserializer
extends
StdDeserializer
<
Counts
.
CountItem
>
{
private
static
final
long
serialVersionUID
=
8226175715446656115L
;
public
CountItemDeserializer
()
{
super
(
Counts
.
CountItem
.
class
);
}
@Override
public
Counts
.
CountItem
deserialize
(
JsonParser
jp
,
DeserializationContext
ctxt
)
throws
IOException
{
final
TreeNode
treeNode
=
jp
.
getCodec
().
readTree
(
jp
);
final
Map
.
Entry
<
String
,
JsonNode
>
next
=
((
ObjectNode
)
treeNode
).
fields
().
next
();
return
new
Counts
.
CountItem
(
next
.
getKey
(),
next
.
getValue
().
asLong
());
}
}
cmsWebApp/src/performa/intercom/resources/CountItemSerializer.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.core.JsonGenerator
;
import
com.fasterxml.jackson.databind.SerializerProvider
;
import
com.fasterxml.jackson.databind.ser.std.StdSerializer
;
import
java.io.IOException
;
class
CountItemSerializer
extends
StdSerializer
<
Counts
.
CountItem
>
{
public
CountItemSerializer
()
{
super
(
Counts
.
CountItem
.
class
);
}
@Override
public
void
serialize
(
Counts
.
CountItem
value
,
JsonGenerator
jgen
,
SerializerProvider
provider
)
throws
IOException
{
jgen
.
writeStartObject
();
jgen
.
writeNumberField
(
value
.
getName
(),
value
.
getValue
());
jgen
.
writeEndObject
();
}
}
cmsWebApp/src/performa/intercom/resources/Counts.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.collect.Maps
;
import
java.net.URI
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
Counts
{
static
Counts
countQuery
(
Map
<
String
,
String
>
query
)
{
final
URI
build
=
UriBuilder
.
newBuilder
()
.
path
(
"counts"
)
.
query
(
query
)
.
build
();
final
HttpClient
resource
=
new
HttpClient
(
build
);
return
resource
.
get
(
Counts
.
class
);
}
public
static
Counts
.
Totals
appTotals
()
throws
InvalidException
,
AuthorizationException
{
final
HttpClient
resource
=
new
HttpClient
(
UriBuilder
.
newBuilder
().
path
(
"counts"
).
build
());
return
resource
.
get
(
Totals
.
class
);
}
// public static Long userCount() throws InvalidException, AuthorizationException{
// final HashMap<String, String> params = Maps.newHashMap();
// params.put("type", "user");
// return countQuery(params).getUser().getUser();
// }
public
static
List
<
CountItem
>
userTags
()
throws
InvalidException
,
AuthorizationException
{
final
HashMap
<
String
,
String
>
params
=
Maps
.
newHashMap
();
params
.
put
(
"type"
,
"user"
);
params
.
put
(
"count"
,
"tag"
);
return
countQuery
(
params
).
getUser
().
getTags
();
}
public
static
List
<
CountItem
>
userSegments
()
throws
InvalidException
,
AuthorizationException
{
final
HashMap
<
String
,
String
>
params
=
Maps
.
newHashMap
();
params
.
put
(
"type"
,
"user"
);
params
.
put
(
"count"
,
"segment"
);
return
countQuery
(
params
).
getUser
().
getSegments
();
}
public
static
Counts
.
Conversation
conversationTotals
()
throws
InvalidException
,
AuthorizationException
{
final
HashMap
<
String
,
String
>
params
=
Maps
.
newHashMap
();
params
.
put
(
"type"
,
"conversation"
);
return
countQuery
(
params
).
getConversation
();
}
public
static
Counts
.
Conversation
conversationAdmins
()
throws
InvalidException
,
AuthorizationException
{
final
HashMap
<
String
,
String
>
params
=
Maps
.
newHashMap
();
params
.
put
(
"type"
,
"conversation"
);
params
.
put
(
"count"
,
"admin"
);
return
countQuery
(
params
).
getConversation
();
}
// public static Long companyCount() throws InvalidException, AuthorizationException{
// final HashMap<String, String> params = Maps.newHashMap();
// params.put("type", "company");
// return countQuery(params).getCompany().getCompanies();
// }
public
static
List
<
CountItem
>
companySegments
()
throws
InvalidException
,
AuthorizationException
{
final
HashMap
<
String
,
String
>
params
=
Maps
.
newHashMap
();
params
.
put
(
"type"
,
"company"
);
params
.
put
(
"count"
,
"segment"
);
return
countQuery
(
params
).
getCompany
().
getSegments
();
}
public
static
List
<
CountItem
>
companyTags
()
throws
InvalidException
,
AuthorizationException
{
final
HashMap
<
String
,
String
>
params
=
Maps
.
newHashMap
();
params
.
put
(
"type"
,
"company"
);
params
.
put
(
"count"
,
"tag"
);
return
countQuery
(
params
).
getCompany
().
getTags
();
}
public
static
List
<
CountItem
>
companyUsers
()
throws
InvalidException
,
AuthorizationException
{
final
HashMap
<
String
,
String
>
params
=
Maps
.
newHashMap
();
params
.
put
(
"type"
,
"company"
);
params
.
put
(
"count"
,
"user"
);
return
countQuery
(
params
).
getCompany
().
getUsers
();
}
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
static
class
Totals
{
@JsonProperty
(
"company"
)
private
CountItem
company
;
@JsonProperty
(
"segment"
)
private
CountItem
segment
;
@JsonProperty
(
"tag"
)
private
CountItem
tag
;
@JsonProperty
(
"user"
)
private
CountItem
user
;
public
CountItem
getCompany
()
{
return
company
;
}
public
CountItem
getSegment
()
{
return
segment
;
}
public
CountItem
getTag
()
{
return
tag
;
}
public
CountItem
getUser
()
{
return
user
;
}
@Override
public
String
toString
()
{
return
"Totals{"
+
"company="
+
company
+
", segment="
+
segment
+
", tag="
+
tag
+
", user="
+
user
+
'}'
;
}
}
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
static
class
CountItem
{
private
String
name
;
private
long
value
;
public
CountItem
(
String
name
,
long
value
)
{
this
.
name
=
name
;
this
.
value
=
value
;
}
public
String
getName
()
{
return
name
;
}
public
long
getValue
()
{
return
value
;
}
@Override
public
String
toString
()
{
return
"CountItem{"
+
"name='"
+
name
+
'\''
+
", value="
+
value
+
'}'
;
}
}
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
static
class
Conversation
{
@JsonProperty
(
"admin"
)
List
<
Admin
>
admins
;
@JsonProperty
(
"assigned"
)
private
long
assigned
;
@JsonProperty
(
"closed"
)
private
long
closed
;
@JsonProperty
(
"open"
)
private
long
open
;
@JsonProperty
(
"unassigned"
)
private
long
unassigned
;
Conversation
()
{
}
public
List
<
Admin
>
getAdmins
()
{
return
admins
;
}
public
long
getAssigned
()
{
return
assigned
;
}
public
long
getClosed
()
{
return
closed
;
}
public
long
getOpen
()
{
return
open
;
}
public
long
getUnassigned
()
{
return
unassigned
;
}
@Override
public
String
toString
()
{
return
"Conversation{"
+
"assigned="
+
assigned
+
", closed="
+
closed
+
", open="
+
open
+
", unassigned="
+
unassigned
+
", admins="
+
admins
+
'}'
;
}
}
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
static
class
User
{
@JsonProperty
(
"user"
)
private
long
user
;
@JsonProperty
(
"tag"
)
private
List
<
CountItem
>
tags
;
@JsonProperty
(
"segment"
)
private
List
<
CountItem
>
segments
;
User
()
{
}
public
long
getUser
()
{
return
user
;
}
public
List
<
CountItem
>
getTags
()
{
return
tags
;
}
public
List
<
CountItem
>
getSegments
()
{
return
segments
;
}
@Override
public
String
toString
()
{
return
"User{"
+
"user="
+
user
+
", tags="
+
tags
+
", segments="
+
segments
+
'}'
;
}
}
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
static
class
Company
{
@JsonProperty
(
"company"
)
private
long
companies
;
@JsonProperty
(
"tag"
)
private
List
<
CountItem
>
tags
;
@JsonProperty
(
"user"
)
private
List
<
CountItem
>
users
;
@JsonProperty
(
"segment"
)
private
List
<
CountItem
>
segments
;
Company
()
{
}
public
long
getCompanies
()
{
return
companies
;
}
public
List
<
CountItem
>
getTags
()
{
return
tags
;
}
public
List
<
CountItem
>
getUsers
()
{
return
users
;
}
public
List
<
CountItem
>
getSegments
()
{
return
segments
;
}
@Override
public
String
toString
()
{
return
"Company{"
+
"companies="
+
companies
+
", tags="
+
tags
+
", users="
+
users
+
", segments="
+
segments
+
'}'
;
}
}
@JsonProperty
(
"type"
)
private
String
type
=
"count"
;
@JsonProperty
(
"company"
)
private
Counts
.
Company
company
;
@JsonProperty
(
"user"
)
private
Counts
.
User
user
;
@JsonProperty
(
"conversation"
)
private
Counts
.
Conversation
conversation
;
public
String
getType
()
{
return
type
;
}
public
Company
getCompany
()
{
return
company
;
}
public
User
getUser
()
{
return
user
;
}
public
Conversation
getConversation
()
{
return
conversation
;
}
@Override
public
String
toString
()
{
return
"Counts{"
+
"type='"
+
type
+
'\''
+
", company="
+
company
+
", user="
+
user
+
", conversation="
+
conversation
+
'}'
;
}
}
cmsWebApp/src/performa/intercom/resources/CustomAttribute.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.google.common.collect.Lists
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
@SuppressWarnings
(
"UnusedDeclaration"
)
public
class
CustomAttribute
<
T
>
{
@SuppressWarnings
(
"unchecked"
)
private
static
final
ArrayList
<?
extends
Class
<?
extends
Serializable
>>
CLASSES
=
Lists
.
newArrayList
(
String
.
class
,
Long
.
class
,
Float
.
class
,
Double
.
class
,
Boolean
.
class
,
Integer
.
class
);
public
static
StringAttribute
newStringAttribute
(
String
name
,
String
value
)
{
return
new
StringAttribute
(
name
,
value
);
}
public
static
BooleanAttribute
newBooleanAttribute
(
String
name
,
boolean
value
)
{
return
new
BooleanAttribute
(
name
,
value
);
}
public
static
DoubleAttribute
newDoubleAttribute
(
String
name
,
double
value
)
{
return
new
DoubleAttribute
(
name
,
value
);
}
public
static
LongAttribute
newLongAttribute
(
String
name
,
long
value
)
{
return
new
LongAttribute
(
name
,
value
);
}
public
static
IntegerAttribute
newIntegerAttribute
(
String
name
,
int
value
)
{
return
new
IntegerAttribute
(
name
,
value
);
}
public
static
FloatAttribute
newFloatAttribute
(
String
name
,
float
value
)
{
return
new
FloatAttribute
(
name
,
value
);
}
public
static
class
StringAttribute
extends
CustomAttribute
<
String
>
{
private
StringAttribute
(
String
name
,
String
value
)
{
super
(
name
,
value
,
String
.
class
);
}
private
StringAttribute
(
String
name
,
String
value
,
Class
<
String
>
clazz
)
{
super
(
name
,
value
,
clazz
);
}
}
public
static
class
BooleanAttribute
extends
CustomAttribute
<
Boolean
>
{
private
BooleanAttribute
(
String
name
,
boolean
value
)
{
super
(
name
,
value
,
Boolean
.
class
);
}
private
BooleanAttribute
(
String
name
,
boolean
value
,
Class
<
Boolean
>
clazz
)
{
super
(
name
,
value
,
clazz
);
}
}
public
static
class
DoubleAttribute
extends
CustomAttribute
<
Double
>
{
private
DoubleAttribute
(
String
name
,
double
value
,
Class
<
Double
>
clazz
)
{
super
(
name
,
value
,
clazz
);
}
private
DoubleAttribute
(
String
name
,
double
value
)
{
super
(
name
,
value
,
Double
.
class
);
}
}
public
static
class
FloatAttribute
extends
CustomAttribute
<
Float
>
{
private
FloatAttribute
(
String
name
,
float
value
,
Class
<
Float
>
clazz
)
{
super
(
name
,
value
,
clazz
);
}
private
FloatAttribute
(
String
name
,
float
value
)
{
super
(
name
,
value
,
Float
.
class
);
}
}
public
static
class
IntegerAttribute
extends
CustomAttribute
<
Integer
>
{
private
IntegerAttribute
(
String
name
,
int
value
)
{
super
(
name
,
value
,
Integer
.
class
);
}
private
IntegerAttribute
(
String
name
,
int
value
,
Class
<
Integer
>
clazz
)
{
super
(
name
,
value
,
clazz
);
}
}
public
static
class
LongAttribute
extends
CustomAttribute
<
Long
>
{
public
LongAttribute
(
String
name
,
long
value
,
Class
<
Long
>
clazz
)
{
super
(
name
,
value
,
clazz
);
}
public
LongAttribute
(
String
name
,
long
value
)
{
super
(
name
,
value
,
Long
.
class
);
}
}
private
String
name
;
private
T
value
;
private
Class
<
T
>
clazz
;
public
CustomAttribute
(
String
name
,
T
value
,
Class
<
T
>
clazz
)
{
//noinspection SuspiciousMethodCalls
if
(!
CLASSES
.
contains
(
clazz
))
{
throw
new
InvalidException
(
String
.
format
(
"cannot accept class type [%s] for custom attribute"
,
clazz
.
getName
()));
}
this
.
name
=
name
;
this
.
value
=
value
;
this
.
clazz
=
clazz
;
}
public
Class
<
T
>
getValueClass
()
{
return
clazz
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
T
getValue
()
{
return
value
;
}
public
void
setValue
(
T
value
)
{
this
.
value
=
value
;
}
public
<
C
>
C
as
(
Class
<
C
>
c
)
{
//noinspection unchecked
return
(
C
)
getValue
();
}
public
long
longValue
()
{
return
as
(
Long
.
class
);
}
public
String
textValue
()
{
return
as
(
String
.
class
);
}
public
boolean
booleanValue
()
{
return
as
(
Boolean
.
class
);
}
public
float
floatValue
()
{
return
as
(
Float
.
class
);
}
public
double
doubleValue
()
{
return
as
(
Double
.
class
);
}
public
int
integerValue
()
{
return
as
(
Integer
.
class
);
}
@Override
public
int
hashCode
()
{
int
result
=
name
!=
null
?
name
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
value
!=
null
?
value
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
clazz
!=
null
?
clazz
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
CustomAttribute
that
=
(
CustomAttribute
)
o
;
if
(
clazz
!=
null
?
!
clazz
.
equals
(
that
.
clazz
)
:
that
.
clazz
!=
null
)
return
false
;
if
(
name
!=
null
?
!
name
.
equals
(
that
.
name
)
:
that
.
name
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(
value
!=
null
?
!
value
.
equals
(
that
.
value
)
:
that
.
value
!=
null
)
return
false
;
return
true
;
}
@Override
public
String
toString
()
{
return
"CustomAttribute{"
+
"name='"
+
name
+
'\''
+
", value="
+
value
+
", clazz="
+
clazz
+
'}'
;
}
}
cmsWebApp/src/performa/intercom/resources/CustomAttributeDeserializer.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.core.JsonParser
;
import
com.fasterxml.jackson.databind.DeserializationContext
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.deser.std.StdDeserializer
;
import
com.fasterxml.jackson.databind.node.JsonNodeType
;
import
com.fasterxml.jackson.databind.node.NumericNode
;
import
com.fasterxml.jackson.databind.node.ValueNode
;
import
java.io.IOException
;
class
CustomAttributeDeserializer
extends
StdDeserializer
<
CustomAttribute
>
{
private
static
final
long
serialVersionUID
=
5069924730975394938L
;
public
CustomAttributeDeserializer
()
{
super
(
CustomAttribute
.
class
);
}
@Override
public
CustomAttribute
deserialize
(
JsonParser
jp
,
DeserializationContext
ctxt
)
throws
IOException
{
CustomAttribute
cda
=
null
;
final
String
currentName
=
jp
.
getParsingContext
().
getCurrentName
();
final
ObjectMapper
mapper
=
(
ObjectMapper
)
jp
.
getCodec
();
final
ValueNode
vNode
=
mapper
.
readTree
(
jp
);
if
(
vNode
.
asToken
().
isScalarValue
())
{
if
(
vNode
.
getNodeType
()
==
JsonNodeType
.
BOOLEAN
)
{
cda
=
new
CustomAttribute
<
Boolean
>(
currentName
,
vNode
.
asBoolean
(),
Boolean
.
class
);
}
else
if
(
vNode
.
getNodeType
()
==
JsonNodeType
.
STRING
)
{
cda
=
new
CustomAttribute
<
String
>(
currentName
,
vNode
.
asText
(),
String
.
class
);
}
else
if
(
vNode
.
getNodeType
()
==
JsonNodeType
.
NUMBER
)
{
final
NumericNode
nNode
=
(
NumericNode
)
vNode
;
if
(
currentName
.
endsWith
(
"_at"
))
{
cda
=
new
CustomAttribute
<
Long
>(
currentName
,
vNode
.
longValue
(),
Long
.
class
);
}
else
if
(
nNode
.
isInt
())
{
cda
=
new
CustomAttribute
<
Integer
>(
currentName
,
vNode
.
intValue
(),
Integer
.
class
);
}
else
if
(
nNode
.
isFloat
())
{
cda
=
new
CustomAttribute
<
Float
>(
currentName
,
vNode
.
floatValue
(),
Float
.
class
);
}
else
if
(
nNode
.
isDouble
())
{
cda
=
new
CustomAttribute
<
Double
>(
currentName
,
vNode
.
doubleValue
(),
Double
.
class
);
}
else
if
(
nNode
.
isLong
())
{
cda
=
new
CustomAttribute
<
Long
>(
currentName
,
vNode
.
longValue
(),
Long
.
class
);
}
else
{
cda
=
new
CustomAttribute
<
String
>(
currentName
,
vNode
.
asText
(),
String
.
class
);
}
}
else
{
cda
=
new
CustomAttribute
<
String
>(
currentName
,
vNode
.
asText
(),
String
.
class
);
}
}
return
cda
;
}
}
cmsWebApp/src/performa/intercom/resources/CustomAttributeSerializer.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.core.JsonGenerator
;
import
com.fasterxml.jackson.databind.SerializerProvider
;
import
com.fasterxml.jackson.databind.ser.std.StdSerializer
;
import
java.io.IOException
;
class
CustomAttributeSerializer
extends
StdSerializer
<
CustomAttribute
>
{
public
CustomAttributeSerializer
()
{
super
(
CustomAttribute
.
class
);
}
@Override
public
void
serialize
(
CustomAttribute
value
,
JsonGenerator
jgen
,
SerializerProvider
provider
)
throws
IOException
{
// the field name has already been written
jgen
.
writeObject
(
value
.
getValue
());
}
}
cmsWebApp/src/performa/intercom/resources/DataResource.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.google.common.base.Strings
;
import
com.google.common.collect.Maps
;
import
java.net.URI
;
import
java.util.List
;
import
java.util.Map
;
abstract
class
DataResource
{
@SuppressWarnings
(
"SameParameterValue"
)
public
static
<
T
>
T
find
(
String
id
,
String
collectionPath
,
Class
<
T
>
c
)
{
final
HttpClient
resource
=
new
HttpClient
(
UriBuilder
.
newBuilder
().
path
(
collectionPath
).
path
(
id
).
build
());
return
resource
.
get
(
c
);
}
public
static
<
T
>
T
find
(
Map
<
String
,
String
>
params
,
String
collectionPath
,
Class
<
T
>
c
)
{
final
HttpClient
resource
=
new
HttpClient
(
UriBuilder
.
newBuilder
().
path
(
collectionPath
).
query
(
params
).
build
());
return
resource
.
get
(
c
);
}
public
static
<
T
,
R
>
R
create
(
T
entity
,
String
collectionPath
,
Class
<
R
>
response
)
{
final
HttpClient
resource
=
new
HttpClient
(
UriBuilder
.
newBuilder
().
path
(
collectionPath
).
build
());
return
resource
.
post
(
response
,
entity
);
}
public
static
<
T
,
R
>
R
create
(
T
entity
,
List
<
String
>
paths
,
Class
<
R
>
response
)
{
final
HttpClient
resource
=
new
HttpClient
(
UriBuilder
.
newBuilder
().
path
(
paths
).
build
());
return
resource
.
post
(
response
,
entity
);
}
public
static
<
T
,
R
>
R
update
(
T
entity
,
String
collectionPath
,
Class
<
R
>
response
)
{
final
HttpClient
resource
=
new
HttpClient
(
UriBuilder
.
newBuilder
().
path
(
collectionPath
).
build
());
return
resource
.
post
(
response
,
entity
);
}
public
static
<
T
,
R
>
R
post
(
T
entity
,
URI
path
,
Class
<
R
>
response
)
{
final
HttpClient
resource
=
new
HttpClient
(
path
);
return
resource
.
post
(
response
,
entity
);
}
public
static
<
T
,
R
>
R
updatePut
(
T
entity
,
URI
collectionPath
,
Class
<
R
>
response
)
{
final
HttpClient
resource
=
new
HttpClient
(
collectionPath
);
return
resource
.
put
(
response
,
entity
);
}
@SuppressWarnings
(
"SameParameterValue"
)
public
static
<
T
,
R
>
R
update
(
T
entity
,
String
collectionPath
,
String
id
,
Class
<
R
>
response
)
{
final
HttpClient
resource
=
new
HttpClient
(
UriBuilder
.
newBuilder
().
path
(
collectionPath
).
path
(
id
).
build
());
return
resource
.
post
(
response
,
entity
);
}
public
static
<
T
>
T
delete
(
String
id
,
String
collectionPath
,
Class
<
T
>
c
)
{
final
HttpClient
resource
=
new
HttpClient
(
UriBuilder
.
newBuilder
().
path
(
collectionPath
).
path
(
id
).
build
());
return
resource
.
delete
(
c
);
}
public
static
<
C
>
C
list
(
Map
<
String
,
String
>
params
,
String
collectionPath
,
Class
<
C
>
c
)
{
final
HttpClient
resource
=
new
HttpClient
(
UriBuilder
.
newBuilder
().
path
(
collectionPath
).
query
(
params
).
build
());
return
resource
.
get
(
c
);
}
public
static
<
C
>
C
scroll
(
String
scrollParam
,
String
collectionPath
,
Class
<
C
>
c
)
{
Map
<
String
,
String
>
params
=
Maps
.
newHashMap
();
if
(!
Strings
.
isNullOrEmpty
(
scrollParam
))
{
params
.
put
(
"scroll_param"
,
scrollParam
);
}
final
HttpClient
resource
=
new
HttpClient
(
UriBuilder
.
newBuilder
().
path
(
collectionPath
+
"/scroll"
).
query
(
params
).
build
());
return
resource
.
get
(
c
);
}
}
cmsWebApp/src/performa/intercom/resources/Error.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
Error
extends
TypedData
{
@SuppressWarnings
(
"FieldCanBeLocal"
)
@JsonProperty
(
"type"
)
private
final
String
type
=
"error"
;
@JsonProperty
(
"code"
)
private
String
code
;
@JsonProperty
(
"message"
)
private
String
message
;
public
Error
()
{
}
public
Error
(
String
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
public
String
getType
()
{
return
type
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
@Override
public
int
hashCode
()
{
int
result
=
code
!=
null
?
code
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
message
!=
null
?
message
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Error
error
=
(
Error
)
o
;
if
(
code
!=
null
?
!
code
.
equals
(
error
.
code
)
:
error
.
code
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(
message
!=
null
?
!
message
.
equals
(
error
.
message
)
:
error
.
message
!=
null
)
return
false
;
return
true
;
}
@Override
public
String
toString
()
{
return
getType
()
+
"{"
+
"code='"
+
code
+
'\''
+
", message='"
+
message
+
'\''
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/ErrorCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.base.Preconditions
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
final
class
ErrorCollection
{
@JsonProperty
(
"errors"
)
private
List
<
Error
>
errors
;
// for jackson
ErrorCollection
()
{
}
public
ErrorCollection
(
List
<
Error
>
errors
)
{
Preconditions
.
checkNotNull
(
errors
,
"cannot create an error collection with a null error list"
);
Preconditions
.
checkArgument
(
errors
.
size
()
>
0
,
"cannot create an error collection with an empty error list"
);
this
.
errors
=
errors
;
}
public
List
<
Error
>
getErrors
()
{
return
errors
;
}
public
String
getType
()
{
return
"error.list"
;
}
}
cmsWebApp/src/performa/intercom/resources/Event.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.annotations.VisibleForTesting
;
import
com.google.common.base.Strings
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
public
class
Event
extends
TypedData
{
private
static
final
List
<
String
>
BULK_METHODS
=
Lists
.
newArrayList
(
"post"
);
private
static
final
ArrayList
<
String
>
BULK_PATHS
=
Lists
.
newArrayListWithExpectedSize
(
2
);
static
{
BULK_PATHS
.
add
(
"bulk"
);
BULK_PATHS
.
add
(
"events"
);
}
public
static
void
create
(
Event
event
)
throws
InvalidException
,
AuthorizationException
{
validateCreateEvent
(
event
);
if
(
event
.
getCreatedAt
()
==
0L
)
{
event
.
setCreatedAt
(
System
.
currentTimeMillis
()
/
1000
);
}
DataResource
.
create
(
event
,
"events"
,
Void
.
class
);
}
public
static
Job
submit
(
List
<
JobItem
<
Event
>>
items
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
submit
(
items
,
null
);
}
public
static
Job
submit
(
List
<
JobItem
<
Event
>>
items
,
Job
job
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
Job
.
submit
(
validateJobItems
(
items
),
job
,
BULK_PATHS
);
}
public
static
JobItemCollection
<
Event
>
listJobErrorFeed
(
String
jobID
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
Job
.
listJobErrorFeed
(
jobID
,
Event
.
class
);
}
@VisibleForTesting
static
List
<
JobItem
<
Event
>>
validateJobItems
(
List
<
JobItem
<
Event
>>
items
)
{
final
JobSupport
jobSupport
=
new
JobSupport
();
for
(
JobItem
<
Event
>
item
:
items
)
{
jobSupport
.
validateJobItem
(
item
,
BULK_METHODS
);
validateCreateEvent
(
item
.
getData
());
}
return
items
;
}
private
static
final
ErrorCollection
INVALID_NAME
=
new
ErrorCollection
(
Lists
.
newArrayList
(
new
Error
(
"invalid"
,
"an event must supply an event name"
)));
private
static
final
ErrorCollection
INVALID_USER
=
new
ErrorCollection
(
Lists
.
newArrayList
(
new
Error
(
"invalid"
,
"an event must supply either an email or a user id"
)));
@VisibleForTesting
static
void
validateCreateEvent
(
Event
event
)
{
if
(
Strings
.
isNullOrEmpty
(
event
.
getEventName
()))
{
throw
new
InvalidException
(
INVALID_NAME
);
}
if
(
Strings
.
isNullOrEmpty
(
event
.
getUserID
())
&&
Strings
.
isNullOrEmpty
(
event
.
getEmail
()))
{
throw
new
InvalidException
(
INVALID_USER
);
}
}
@SuppressWarnings
(
"FieldCanBeLocal"
)
@JsonProperty
(
"type"
)
private
final
String
type
=
"event"
;
@JsonProperty
(
"event_name"
)
private
String
eventName
;
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
(
"email"
)
private
String
email
;
@JsonProperty
(
"user_id"
)
private
String
userID
;
@JsonProperty
(
"metadata"
)
private
Map
<
String
,
Object
>
metadata
=
Maps
.
newHashMap
();
public
Event
()
{
}
public
String
getType
()
{
return
type
;
}
public
String
getEventName
()
{
return
eventName
;
}
public
Event
setEventName
(
String
eventName
)
{
this
.
eventName
=
eventName
;
return
this
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
@SuppressWarnings
(
"UnusedReturnValue"
)
public
Event
setCreatedAt
(
long
createdAt
)
{
this
.
createdAt
=
createdAt
;
return
this
;
}
public
String
getEmail
()
{
return
email
;
}
public
Event
setEmail
(
String
email
)
{
this
.
email
=
email
;
return
this
;
}
public
String
getUserID
()
{
return
userID
;
}
public
Event
setUserID
(
String
userID
)
{
this
.
userID
=
userID
;
return
this
;
}
public
Event
putMetadata
(
String
name
,
String
value
)
{
metadata
.
put
(
name
,
value
);
return
this
;
}
public
Event
putMetadata
(
String
name
,
boolean
value
)
{
metadata
.
put
(
name
,
value
);
return
this
;
}
public
Event
putMetadata
(
String
name
,
int
value
)
{
metadata
.
put
(
name
,
value
);
return
this
;
}
public
Event
putMetadata
(
String
name
,
double
value
)
{
metadata
.
put
(
name
,
value
);
return
this
;
}
public
Event
putMetadata
(
String
name
,
long
value
)
{
metadata
.
put
(
name
,
value
);
return
this
;
}
public
Event
putMetadata
(
String
name
,
float
value
)
{
metadata
.
put
(
name
,
value
);
return
this
;
}
public
Map
<
String
,
Object
>
getMetadata
()
{
return
metadata
;
}
public
Event
setMetadata
(
Map
<
String
,
Object
>
metadata
)
{
this
.
metadata
=
metadata
;
return
this
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Event
event
=
(
Event
)
o
;
if
(
createdAt
!=
event
.
createdAt
)
return
false
;
if
(
email
!=
null
?
!
email
.
equals
(
event
.
email
)
:
event
.
email
!=
null
)
return
false
;
if
(
eventName
!=
null
?
!
eventName
.
equals
(
event
.
eventName
)
:
event
.
eventName
!=
null
)
return
false
;
if
(
metadata
!=
null
?
!
metadata
.
equals
(
event
.
metadata
)
:
event
.
metadata
!=
null
)
return
false
;
if
(!
type
.
equals
(
event
.
type
))
return
false
;
//noinspection RedundantIfStatement
if
(
userID
!=
null
?
!
userID
.
equals
(
event
.
userID
)
:
event
.
userID
!=
null
)
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
type
.
hashCode
();
result
=
31
*
result
+
(
eventName
!=
null
?
eventName
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
int
)
(
createdAt
^
(
createdAt
>>>
32
));
result
=
31
*
result
+
(
email
!=
null
?
email
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
userID
!=
null
?
userID
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
metadata
!=
null
?
metadata
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
String
toString
()
{
return
"Event{"
+
"type='"
+
type
+
'\''
+
", eventName='"
+
eventName
+
'\''
+
", createdAt="
+
createdAt
+
", email='"
+
email
+
'\''
+
", userID='"
+
userID
+
'\''
+
", metadata="
+
metadata
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/HttpClient.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.databind.JavaType
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.io.CharStreams
;
import
com.google.common.primitives.Ints
;
import
com.google.common.primitives.Longs
;
import
org.apache.commons.codec.binary.Base64
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.OutputStream
;
import
java.net.HttpURLConnection
;
import
java.net.URI
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.ThreadLocalRandom
;
import
oneit.utils.Storage
;
class
HttpClient
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
"intercom-java"
);
private
static
final
String
CLIENT_AGENT_DETAILS
=
clientAgentDetails
();
private
static
final
String
USER_AGENT
=
Intercom
.
USER_AGENT
;
private
static
final
String
UTF_8
=
"UTF-8"
;
private
static
final
String
APPLICATION_JSON
=
"application/json"
;
public
static
final
String
RATE_LIMIT_HEADER
=
"X-RateLimit-Limit"
;
public
static
final
String
RATE_LIMIT_REMAINING_HEADER
=
"X-RateLimit-Remaining"
;
public
static
final
String
RATE_LIMIT_RESET_HEADER
=
"X-RateLimit-Reset"
;
private
static
String
clientAgentDetails
()
{
final
HashMap
<
String
,
String
>
map
=
Maps
.
newHashMap
();
final
ArrayList
<
String
>
propKeys
=
Lists
.
newArrayList
(
"os.arch"
,
"os.name"
,
"os.version"
,
"user.language"
,
"user.timezone"
,
"java.class.version"
,
"java.runtime.version"
,
"java.version"
,
"java.vm.name"
,
"java.vm.vendor"
,
"java.vm.version"
);
for
(
String
propKey
:
propKeys
)
{
map
.
put
(
propKey
,
System
.
getProperty
(
propKey
));
}
final
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
try
{
MapperSupport
.
objectMapper
().
disable
(
SerializationFeature
.
INDENT_OUTPUT
).
writeValue
(
baos
,
map
);
}
catch
(
IOException
e
)
{
logger
.
warn
(
String
.
format
(
"could not serialize client agent details [%s]"
,
e
.
getMessage
()),
e
);
}
return
baos
.
toString
();
}
private
final
ObjectMapper
objectMapper
;
private
final
URI
uri
;
private
final
Map
<
String
,
String
>
headers
;
private
final
HttpConnectorSupplier
connection
=
Intercom
.
getHttpConnectorSupplier
();
public
HttpClient
(
URI
uri
)
{
this
(
uri
,
Maps
.<
String
,
String
>
newHashMap
());
}
private
HttpClient
(
URI
uri
,
Map
<
String
,
String
>
headers
)
{
this
.
uri
=
uri
;
this
.
headers
=
headers
;
this
.
objectMapper
=
MapperSupport
.
objectMapper
();
}
public
<
T
>
T
get
(
Class
<
T
>
reqres
)
throws
IntercomException
{
return
get
(
getJavaType
(
reqres
));
}
<
T
>
T
get
(
JavaType
responseType
)
throws
IntercomException
{
return
executeHttpMethod
(
"GET"
,
null
,
responseType
);
}
public
<
T
>
T
delete
(
Class
<
T
>
reqres
)
{
return
executeHttpMethod
(
"DELETE"
,
null
,
getJavaType
(
reqres
));
}
public
<
T
,
E
>
T
put
(
Class
<
T
>
reqres
,
E
entity
)
{
headers
.
put
(
"Content-Type"
,
APPLICATION_JSON
);
return
executeHttpMethod
(
"PUT"
,
(
E
)
entity
,
getJavaType
(
reqres
));
}
public
<
T
,
E
>
T
post
(
Class
<
T
>
reqres
,
E
entity
)
{
headers
.
put
(
"Content-Type"
,
APPLICATION_JSON
);
return
executeHttpMethod
(
"POST"
,
entity
,
getJavaType
(
reqres
));
}
private
<
T
,
E
>
T
executeHttpMethod
(
String
method
,
E
entity
,
JavaType
responseType
)
{
HttpURLConnection
conn
=
null
;
try
{
conn
=
initializeConnection
(
uri
,
method
);
if
(
entity
!=
null
)
{
prepareRequestEntity
(
entity
,
conn
);
}
return
runRequest
(
uri
,
responseType
,
conn
);
}
catch
(
IOException
e
)
{
return
throwLocalException
(
e
);
}
finally
{
IOUtils
.
disconnectQuietly
(
conn
);
}
}
private
<
T
>
JavaType
getJavaType
(
Class
<
T
>
reqres
)
{
return
objectMapper
.
getTypeFactory
().
constructType
(
reqres
);
}
// trick java with a dummy return
private
<
T
>
T
throwLocalException
(
IOException
e
)
{
throw
new
IntercomException
(
String
.
format
(
"Local exception calling [%s]. Check connectivity and settings. [%s]"
,
uri
.
toASCIIString
(),
e
.
getMessage
()),
e
);
}
private
void
prepareRequestEntity
(
Object
entity
,
HttpURLConnection
conn
)
throws
IOException
{
conn
.
setDoOutput
(
true
);
OutputStream
stream
=
null
;
try
{
stream
=
conn
.
getOutputStream
();
if
(
logger
.
isDebugEnabled
())
{
logger
.
info
(
String
.
format
(
"api server request --\n%s\n-- "
,
objectMapper
.
writeValueAsString
(
entity
)));
}
objectMapper
.
writeValue
(
stream
,
entity
);
}
finally
{
IOUtils
.
closeQuietly
(
stream
);
}
}
private
HttpURLConnection
initializeConnection
(
URI
uri
,
String
method
)
throws
IOException
{
HttpURLConnection
conn
=
connection
.
connect
(
uri
);
conn
.
setRequestMethod
(
method
);
conn
=
prepareConnection
(
conn
);
conn
=
applyHeaders
(
conn
);
return
conn
;
}
private
<
T
>
T
runRequest
(
URI
uri
,
JavaType
javaType
,
HttpURLConnection
conn
)
throws
IOException
{
conn
.
connect
();
final
int
responseCode
=
conn
.
getResponseCode
();
if
(
responseCode
>=
200
&&
responseCode
<
300
)
{
return
handleSuccess
(
javaType
,
conn
,
responseCode
);
}
else
{
return
handleError
(
uri
,
conn
,
responseCode
);
}
}
private
<
T
>
T
handleError
(
URI
uri
,
HttpURLConnection
conn
,
int
responseCode
)
throws
IOException
{
ErrorCollection
errors
;
try
{
errors
=
objectMapper
.
readValue
(
conn
.
getErrorStream
(),
ErrorCollection
.
class
);
}
catch
(
IOException
e
)
{
errors
=
createUnprocessableErrorResponse
(
e
);
}
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
"error json follows --\n{}\n-- "
,
objectMapper
.
writeValueAsString
(
errors
));
}
return
throwException
(
responseCode
,
errors
,
conn
);
}
private
<
T
>
T
handleSuccess
(
JavaType
javaType
,
HttpURLConnection
conn
,
int
responseCode
)
throws
IOException
{
if
(
shouldSkipResponseEntity
(
javaType
,
conn
,
responseCode
))
{
return
null
;
}
else
{
return
readEntity
(
conn
,
responseCode
,
javaType
);
}
}
private
boolean
shouldSkipResponseEntity
(
JavaType
javaType
,
HttpURLConnection
conn
,
int
responseCode
)
{
return
responseCode
==
204
||
Void
.
class
.
equals
(
javaType
.
getRawClass
())
||
"DELETE"
.
equals
(
conn
.
getRequestMethod
());
}
private
<
T
>
T
readEntity
(
HttpURLConnection
conn
,
int
responseCode
,
JavaType
javaType
)
throws
IOException
{
final
InputStream
entityStream
=
conn
.
getInputStream
();
try
{
if
(
logger
.
isDebugEnabled
())
{
final
String
text
=
CharStreams
.
toString
(
new
InputStreamReader
(
entityStream
));
logger
.
debug
(
"api server response status[{}] --\n{}\n-- "
,
responseCode
,
text
);
return
objectMapper
.
readValue
(
text
,
javaType
);
}
else
{
return
objectMapper
.
readValue
(
entityStream
,
javaType
);
}
}
finally
{
IOUtils
.
closeQuietly
(
entityStream
);
}
}
private
<
T
>
T
throwException
(
int
responseCode
,
ErrorCollection
errors
,
HttpURLConnection
conn
)
{
// bind some well known response codes to exceptions
if
(
responseCode
==
403
||
responseCode
==
401
)
{
throw
new
AuthorizationException
(
errors
);
}
else
if
(
responseCode
==
429
)
{
throw
new
RateLimitException
(
errors
,
Ints
.
tryParse
(
conn
.
getHeaderField
(
RATE_LIMIT_HEADER
)),
Ints
.
tryParse
(
conn
.
getHeaderField
(
RATE_LIMIT_REMAINING_HEADER
)),
Longs
.
tryParse
(
conn
.
getHeaderField
(
RATE_LIMIT_RESET_HEADER
)));
}
else
if
(
responseCode
==
404
)
{
throw
new
NotFoundException
(
errors
);
}
else
if
(
responseCode
==
422
)
{
throw
new
InvalidException
(
errors
);
}
else
if
(
responseCode
==
400
||
responseCode
==
405
||
responseCode
==
406
)
{
throw
new
ClientException
(
errors
);
}
else
if
(
responseCode
==
500
||
responseCode
==
503
)
{
throw
new
ServerException
(
errors
);
}
else
{
throw
new
IntercomException
(
errors
);
}
}
private
HttpURLConnection
applyHeaders
(
HttpURLConnection
conn
)
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
createHeaders
().
entrySet
())
{
conn
.
setRequestProperty
(
entry
.
getKey
(),
entry
.
getValue
());
}
for
(
Map
.
Entry
<
String
,
String
>
entry
:
createAuthorizationHeaders
().
entrySet
())
{
conn
.
setRequestProperty
(
entry
.
getKey
(),
entry
.
getValue
());
}
return
conn
;
}
// todo: expose this config
private
HttpURLConnection
prepareConnection
(
HttpURLConnection
conn
)
{
conn
.
setConnectTimeout
(
Intercom
.
getConnectionTimeout
());
conn
.
setReadTimeout
(
Intercom
.
getRequestTimeout
());
conn
.
setUseCaches
(
Intercom
.
isRequestUsingCaches
());
return
conn
;
}
private
Map
<
String
,
String
>
createAuthorizationHeaders
()
{
switch
(
Intercom
.
getAuthKeyType
())
{
case
API_KEY:
headers
.
put
(
"Authorization"
,
"Basic "
+
generateAuthString
(
Intercom
.
getAppID
(),
Intercom
.
getApiKey
()));
break
;
case
TOKEN:
headers
.
put
(
"Authorization"
,
"Basic "
+
generateAuthString
(
Intercom
.
getToken
(),
""
));
break
;
}
return
headers
;
}
private
String
generateAuthString
(
String
username
,
String
password
)
{
return
Storage
.
bytesToBase64
((
username
+
":"
+
password
).
getBytes
());
}
private
Map
<
String
,
String
>
createHeaders
()
{
headers
.
put
(
"User-Agent"
,
USER_AGENT
);
headers
.
put
(
"X-Client-Platform-Details"
,
CLIENT_AGENT_DETAILS
);
headers
.
put
(
"Accept-Charset"
,
UTF_8
);
headers
.
put
(
"Accept"
,
APPLICATION_JSON
);
return
headers
;
}
private
ErrorCollection
createUnprocessableErrorResponse
(
IOException
e
)
{
ErrorCollection
errors
;
final
long
grepCode
=
getGrepCode
();
final
String
msg
=
String
.
format
(
"could not parse error response: [%s]"
,
e
.
getLocalizedMessage
());
logger
.
error
(
String
.
format
(
"[%016x] %s"
,
grepCode
,
msg
),
e
);
Error
err
=
new
Error
(
"unprocessable_entity"
,
String
.
format
(
"%s logged with code [%016x]"
,
msg
,
grepCode
));
errors
=
new
ErrorCollection
(
Lists
.
newArrayList
(
err
));
return
errors
;
}
private
long
getGrepCode
()
{
return
ThreadLocalRandom
.
current
().
nextLong
();
}
}
cmsWebApp/src/performa/intercom/resources/HttpConnectorSupplier.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
java.io.IOException
;
import
java.net.HttpURLConnection
;
import
java.net.URI
;
public
interface
HttpConnectorSupplier
{
HttpURLConnection
connect
(
URI
uri
)
throws
IOException
;
HttpConnectorSupplier
defaultSupplier
=
new
HttpConnectorSupplier
()
{
public
HttpURLConnection
connect
(
URI
uri
)
throws
IOException
{
return
(
HttpURLConnection
)
uri
.
toURL
().
openConnection
();
}
};
}
cmsWebApp/src/performa/intercom/resources/IOUtils.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
org.slf4j.LoggerFactory
;
import
java.io.Closeable
;
import
java.net.HttpURLConnection
;
class
IOUtils
{
private
static
final
org
.
slf4j
.
Logger
logger
=
LoggerFactory
.
getLogger
(
"intercom-java"
);
/**
* Close a HttpURLConnection, ignores checked Exceptions and nulls,
* but rethrows RuntimeExceptions.
*
* @param connection the connection to disconnect
*/
public
static
void
disconnectQuietly
(
HttpURLConnection
connection
)
{
if
(
connection
!=
null
)
{
try
{
connection
.
disconnect
();
}
catch
(
RuntimeException
rethrow
)
{
throw
rethrow
;
}
catch
(
Exception
e
)
{
logger
.
warn
(
e
.
getMessage
());
}
}
}
/**
* Close a stream, ignores checked Exceptions and nulls,
* but rethrows RuntimeExceptions.
*
* @param stream the object to close
*/
public
static
void
closeQuietly
(
Closeable
stream
)
{
if
(
stream
!=
null
)
{
try
{
stream
.
close
();
}
catch
(
RuntimeException
rethrow
)
{
throw
rethrow
;
}
catch
(
Exception
e
)
{
logger
.
warn
(
e
.
getMessage
());
}
}
}
}
cmsWebApp/src/performa/intercom/resources/Intercom.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
java.net.URI
;
public
class
Intercom
{
private
static
final
URI
API_BASE_URI
=
URI
.
create
(
"https://api.intercom.io/"
);
private
static
volatile
URI
apiBaseURI
=
API_BASE_URI
;
private
static
volatile
AuthKeyType
authKeyType
=
AuthKeyType
.
API_KEY
;
enum
AuthKeyType
{
API_KEY
,
TOKEN
}
private
static
final
String
VERSION
=
"2.2.7"
;
public
static
final
String
USER_AGENT
=
"intercom-java/"
+
Intercom
.
VERSION
;
private
static
volatile
String
apiKey
;
private
static
volatile
String
token
;
private
static
volatile
String
appID
;
private
static
volatile
int
connectionTimeout
=
3
*
1000
;
private
static
volatile
int
requestTimeout
=
60
*
1000
;
private
static
volatile
boolean
requestUsingCaches
=
false
;
private
static
volatile
HttpConnectorSupplier
httpConnectorSupplier
=
HttpConnectorSupplier
.
defaultSupplier
;
public
static
long
currentTimestamp
()
{
return
System
.
currentTimeMillis
()/
1000
;
}
public
static
int
getConnectionTimeout
()
{
return
connectionTimeout
;
}
@SuppressWarnings
(
"UnusedDeclaration"
)
public
static
void
setConnectionTimeout
(
int
connectionTimeout
)
{
Intercom
.
connectionTimeout
=
connectionTimeout
;
}
public
static
int
getRequestTimeout
()
{
return
requestTimeout
;
}
@SuppressWarnings
(
"UnusedDeclaration"
)
public
static
void
setRequestTimeout
(
int
requestTimeout
)
{
Intercom
.
requestTimeout
=
requestTimeout
;
}
public
static
boolean
isRequestUsingCaches
()
{
return
requestUsingCaches
;
}
public
static
void
setRequestUsingCaches
(
boolean
requestUsingCaches
)
{
Intercom
.
requestUsingCaches
=
requestUsingCaches
;
}
public
static
HttpConnectorSupplier
getHttpConnectorSupplier
()
{
return
httpConnectorSupplier
;
}
public
static
void
setHttpConnectorSupplier
(
HttpConnectorSupplier
supplier
)
{
Intercom
.
httpConnectorSupplier
=
supplier
;
}
public
static
String
getAppID
()
{
return
appID
;
}
public
static
void
setAppID
(
String
appID
)
{
Intercom
.
appID
=
appID
;
}
public
static
void
setToken
(
String
token
)
{
authKeyType
=
AuthKeyType
.
TOKEN
;
Intercom
.
token
=
token
;
}
public
static
String
getApiKey
()
{
return
Intercom
.
apiKey
;
}
public
static
void
setApiKey
(
String
apiKey
)
{
authKeyType
=
AuthKeyType
.
API_KEY
;
Intercom
.
apiKey
=
apiKey
;
}
public
static
URI
getApiBaseURI
()
{
return
Intercom
.
apiBaseURI
;
}
public
static
void
setApiBaseURI
(
URI
apiBaseURI
)
{
Intercom
.
apiBaseURI
=
apiBaseURI
;
}
static
AuthKeyType
getAuthKeyType
()
{
return
authKeyType
;
}
public
static
String
getToken
()
{
return
token
;
}
}
cmsWebApp/src/performa/intercom/resources/IntercomException.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
public
class
IntercomException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
-
2723350106062183796L
;
private
ErrorCollection
errorCollection
;
@SuppressWarnings
(
"WeakerAccess"
)
public
IntercomException
(
String
message
)
{
super
(
message
);
}
public
IntercomException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
IntercomException
(
ErrorCollection
errorCollection
)
{
this
(
getMessage
(
errorCollection
));
this
.
errorCollection
=
errorCollection
;
}
public
static
String
getMessage
(
ErrorCollection
errorCollection
)
{
String
message
=
"Could not read error message from server"
;
if
(
errorCollection
!=
null
&&
errorCollection
.
getErrors
()
!=
null
&&
errorCollection
.
getErrors
().
size
()
>
0
&&
errorCollection
.
getErrors
().
get
(
0
)
!=
null
&&
errorCollection
.
getErrors
().
get
(
0
).
getMessage
()
!=
null
){
message
=
errorCollection
.
getErrors
().
get
(
0
).
getMessage
();
}
return
message
;
}
@SuppressWarnings
(
"WeakerAccess"
)
public
IntercomException
(
ErrorCollection
errorCollection
,
Throwable
cause
)
{
this
(
getMessage
(
errorCollection
),
cause
);
this
.
errorCollection
=
errorCollection
;
}
public
ErrorCollection
getErrorCollection
()
{
return
errorCollection
;
}
public
Error
getFirstError
()
{
return
errorCollection
.
getErrors
().
get
(
0
);
}
}
cmsWebApp/src/performa/intercom/resources/InvalidException.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
public
class
InvalidException
extends
IntercomException
{
private
static
final
long
serialVersionUID
=
-
2111295679006526646L
;
public
InvalidException
(
String
message
)
{
super
(
message
);
}
public
InvalidException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
InvalidException
(
ErrorCollection
errorCollection
)
{
super
(
errorCollection
);
}
public
InvalidException
(
ErrorCollection
errorCollection
,
Throwable
cause
)
{
super
(
errorCollection
,
cause
);
}
}
cmsWebApp/src/performa/intercom/resources/Job.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.JavaType
;
import
com.google.common.collect.Maps
;
import
java.net.URI
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
public
class
Job
extends
TypedData
{
private
static
final
HashMap
<
String
,
String
>
SENTINEL
=
Maps
.
newHashMap
();
public
static
Job
find
(
String
id
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
find
(
id
,
SENTINEL
);
}
public
static
Job
find
(
String
id
,
Map
<
String
,
String
>
params
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
new
HttpClient
(
UriBuilder
.
newBuilder
().
path
(
"jobs"
).
path
(
id
).
query
(
params
).
build
()
).
get
(
Job
.
class
);
}
public
static
Job
update
(
Job
job
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
post
(
job
,
UriBuilder
.
newBuilder
().
path
(
"jobs"
).
path
(
job
.
getID
()).
build
(),
Job
.
class
);
}
static
<
T
extends
TypedData
>
Job
submit
(
List
<
JobItem
<
T
>>
items
,
List
<
String
>
bulkPaths
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
submit
(
items
,
null
,
bulkPaths
);
}
static
<
T
extends
TypedData
>
Job
submit
(
List
<
JobItem
<
T
>>
items
,
Job
job
,
List
<
String
>
bulkPaths
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
create
(
new
JobItemRequest
<
T
>(
items
,
job
),
bulkPaths
,
Job
.
class
);
}
static
<
T
extends
TypedData
>
JobItemCollection
<
T
>
listJobErrorFeed
(
String
jobID
,
Class
<
T
>
c
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
final
URI
feedURI
=
UriBuilder
.
newBuilder
()
.
path
(
"jobs"
)
.
path
(
jobID
)
.
path
(
"error"
)
.
build
();
final
HttpClient
resource
=
new
HttpClient
(
feedURI
);
final
TypeReference
<
JobItemCollection
<
T
>>
typeReference
=
new
TypeReference
<
JobItemCollection
<
T
>>()
{
};
final
JavaType
type
=
MapperSupport
.
objectMapper
()
.
getTypeFactory
()
.
constructParametricType
(
JobItemCollection
.
class
,
c
);
return
resource
.
get
(
type
);
}
@JsonProperty
(
"type"
)
private
final
String
type
=
"job"
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"app_id"
)
private
String
appID
;
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
(
"updated_at"
)
private
long
updatedAt
;
@JsonProperty
(
"completed_at"
)
private
long
completedAt
;
@JsonProperty
(
"closing_at"
)
private
long
closingAt
;
@JsonProperty
(
"name"
)
private
String
name
;
@JsonProperty
(
"state"
)
private
String
state
;
@JsonProperty
(
"tasks"
)
private
List
<
JobTask
>
tasks
;
@JsonProperty
(
"links"
)
private
Map
<
String
,
URI
>
links
;
public
Job
()
{
}
public
String
getType
()
{
return
type
;
}
public
String
getID
()
{
return
id
;
}
public
Job
setID
(
String
id
)
{
this
.
id
=
id
;
return
this
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
public
long
getUpdatedAt
()
{
return
updatedAt
;
}
public
long
getCompletedAt
()
{
return
completedAt
;
}
public
String
getName
()
{
return
name
;
}
public
Job
setName
(
String
name
)
{
this
.
name
=
name
;
return
this
;
}
public
String
getState
()
{
return
state
;
}
public
String
getAppID
()
{
return
appID
;
}
public
Map
<
String
,
URI
>
getLinks
()
{
return
links
;
}
public
long
getClosingAt
()
{
return
closingAt
;
}
public
Job
setClosingAt
(
long
closingAt
)
{
this
.
closingAt
=
closingAt
;
return
this
;
}
public
List
<
JobTask
>
getTasks
()
{
return
tasks
;
}
@Override
public
String
toString
()
{
return
"Job{"
+
"type='"
+
type
+
'\''
+
", id='"
+
id
+
'\''
+
", appID='"
+
appID
+
'\''
+
", createdAt="
+
createdAt
+
", updatedAt="
+
updatedAt
+
", completedAt="
+
completedAt
+
", name='"
+
name
+
'\''
+
", state='"
+
state
+
'\''
+
", links="
+
links
+
"} "
+
super
.
toString
();
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Job
job
=
(
Job
)
o
;
if
(
createdAt
!=
job
.
createdAt
)
return
false
;
if
(
updatedAt
!=
job
.
updatedAt
)
return
false
;
if
(
completedAt
!=
job
.
completedAt
)
return
false
;
//noinspection ConstantConditions
if
(
type
!=
null
?
!
type
.
equals
(
job
.
type
)
:
job
.
type
!=
null
)
return
false
;
if
(
id
!=
null
?
!
id
.
equals
(
job
.
id
)
:
job
.
id
!=
null
)
return
false
;
if
(
appID
!=
null
?
!
appID
.
equals
(
job
.
appID
)
:
job
.
appID
!=
null
)
return
false
;
if
(
name
!=
null
?
!
name
.
equals
(
job
.
name
)
:
job
.
name
!=
null
)
return
false
;
//noinspection SimplifiableIfStatement
if
(
state
!=
null
?
!
state
.
equals
(
job
.
state
)
:
job
.
state
!=
null
)
return
false
;
return
!(
links
!=
null
?
!
links
.
equals
(
job
.
links
)
:
job
.
links
!=
null
);
}
@Override
public
int
hashCode
()
{
@SuppressWarnings
(
"ConstantConditions"
)
int
result
=
type
!=
null
?
type
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
id
!=
null
?
id
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
appID
!=
null
?
appID
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
int
)
(
createdAt
^
(
createdAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
updatedAt
^
(
updatedAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
completedAt
^
(
completedAt
>>>
32
));
result
=
31
*
result
+
(
name
!=
null
?
name
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
state
!=
null
?
state
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
links
!=
null
?
links
.
hashCode
()
:
0
);
return
result
;
}
}
cmsWebApp/src/performa/intercom/resources/JobItem.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
public
class
JobItem
<
T
extends
TypedData
>
extends
TypedData
{
@JsonProperty
(
"type"
)
private
final
String
type
=
"job_item"
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"updated_at"
)
private
long
updatedAt
;
@JsonProperty
(
"method"
)
private
String
method
;
@JsonProperty
(
"data_type"
)
private
String
dataType
;
@JsonProperty
(
"error"
)
private
Error
error
;
@JsonProperty
(
"data"
)
private
T
data
;
public
JobItem
()
{
}
public
JobItem
(
String
method
,
T
data
)
{
this
(
method
,
data
,
null
);
}
JobItem
(
String
method
,
T
data
,
String
dataType
)
{
Conditions
.
checkNotNull
(
method
,
"item method must be supplied"
);
Conditions
.
checkNotNull
(
data
,
"item data must be supplied"
);
this
.
method
=
method
;
this
.
data
=
data
;
this
.
dataType
=
dataType
;
if
(
dataType
==
null
)
{
this
.
dataType
=
data
.
getType
();
}
Conditions
.
checkNotNull
(
data
,
"item dataType must be supplied"
);
}
public
String
getType
()
{
return
type
;
}
public
String
getID
()
{
return
id
;
}
public
long
getUpdatedAt
()
{
return
updatedAt
;
}
public
String
getMethod
()
{
return
method
;
}
public
JobItem
<
T
>
setMethod
(
String
method
)
{
this
.
method
=
method
;
return
this
;
}
public
Error
getError
()
{
return
error
;
}
public
T
getData
()
{
return
data
;
}
public
JobItem
<
T
>
setData
(
T
data
)
{
this
.
data
=
data
;
return
this
;
}
public
String
getDataType
()
{
return
dataType
;
}
@Override
public
String
toString
()
{
return
"JobItem{"
+
"type='"
+
type
+
'\''
+
", id='"
+
id
+
'\''
+
", updatedAt="
+
updatedAt
+
", method='"
+
method
+
'\''
+
", dataType='"
+
dataType
+
'\''
+
", error="
+
error
+
", data="
+
data
+
"} "
+
super
.
toString
();
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
JobItem
<?>
jobItem
=
(
JobItem
<?>)
o
;
if
(
updatedAt
!=
jobItem
.
updatedAt
)
return
false
;
//noinspection ConstantConditions
if
(
type
!=
null
?
!
type
.
equals
(
jobItem
.
type
)
:
jobItem
.
type
!=
null
)
return
false
;
if
(
id
!=
null
?
!
id
.
equals
(
jobItem
.
id
)
:
jobItem
.
id
!=
null
)
return
false
;
if
(
method
!=
null
?
!
method
.
equals
(
jobItem
.
method
)
:
jobItem
.
method
!=
null
)
return
false
;
if
(
dataType
!=
null
?
!
dataType
.
equals
(
jobItem
.
dataType
)
:
jobItem
.
dataType
!=
null
)
return
false
;
//noinspection SimplifiableIfStatement
if
(
error
!=
null
?
!
error
.
equals
(
jobItem
.
error
)
:
jobItem
.
error
!=
null
)
return
false
;
return
!(
data
!=
null
?
!
data
.
equals
(
jobItem
.
data
)
:
jobItem
.
data
!=
null
);
}
@Override
public
int
hashCode
()
{
@SuppressWarnings
(
"ConstantConditions"
)
int
result
=
type
!=
null
?
type
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
id
!=
null
?
id
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
int
)
(
updatedAt
^
(
updatedAt
>>>
32
));
result
=
31
*
result
+
(
method
!=
null
?
method
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
dataType
!=
null
?
dataType
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
error
!=
null
?
error
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
data
!=
null
?
data
.
hashCode
()
:
0
);
return
result
;
}
}
cmsWebApp/src/performa/intercom/resources/JobItemCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Iterator
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
JobItemCollection
<
T
extends
TypedData
>
extends
TypedDataCollection
<
JobItem
<
T
>>
implements
Iterator
<
JobItem
<
T
>>
{
protected
TypedDataCollectionIterator
<
JobItem
<
T
>>
iterator
;
public
JobItemCollection
()
{
iterator
=
new
TypedDataCollectionIterator
<
JobItem
<
T
>>(
this
);
}
public
JobItemCollection
(
List
<
JobItem
<
T
>>
items
)
{
this
();
this
.
page
=
items
;
}
@SuppressWarnings
(
"EmptyMethod"
)
@JsonProperty
(
"items"
)
@Override
public
List
<
JobItem
<
T
>>
getPage
()
{
return
super
.
getPage
();
}
@Override
public
JobItemCollection
<
T
>
nextPage
()
{
return
fetchNextPage
(
JobItemCollection
.
class
);
}
public
boolean
hasNext
()
{
return
iterator
.
hasNext
();
}
public
JobItem
<
T
>
next
()
{
return
iterator
.
next
();
}
public
void
remove
()
{
iterator
.
remove
();
}
}
cmsWebApp/src/performa/intercom/resources/JobItemRequest.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
class
JobItemRequest
<
T
extends
TypedData
>
extends
TypedData
{
@JsonProperty
(
"items"
)
private
List
<
JobItem
<
T
>>
items
;
@JsonProperty
(
"job"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
private
Job
job
;
public
JobItemRequest
(
List
<
JobItem
<
T
>>
items
,
Job
job
)
{
this
.
items
=
items
;
this
.
job
=
job
;
}
public
List
<
JobItem
<
T
>>
getItems
()
{
return
items
;
}
public
Job
getJob
()
{
return
job
;
}
@Override
String
getType
()
{
return
"job_item.list"
;
}
}
cmsWebApp/src/performa/intercom/resources/JobSupport.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.google.common.base.Joiner
;
import
com.google.common.collect.Lists
;
import
java.util.List
;
class
JobSupport
{
public
void
validateJobItem
(
JobItem
item
,
List
<
String
>
methods
)
{
if
(!
methods
.
contains
(
item
.
getMethod
()))
{
final
String
message
=
String
.
format
(
"job method [%s] not allowed, must be one of "
+
Joiner
.
on
(
", "
).
join
(
methods
),
item
.
getMethod
()
);
throw
new
InvalidException
(
new
ErrorCollection
(
Lists
.
newArrayList
(
new
Error
(
"invalid"
,
message
))));
}
}
}
cmsWebApp/src/performa/intercom/resources/JobTask.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
public
class
JobTask
extends
TypedData
{
@JsonProperty
(
"type"
)
private
final
String
type
=
"job_task"
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"completed_at"
)
private
Long
completedAt
;
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
(
"item_count"
)
private
long
itemCount
;
@Override
public
String
getType
()
{
return
type
;
}
public
String
getID
()
{
return
id
;
}
public
Long
getCompletedAt
()
{
return
completedAt
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
public
long
getItemCount
()
{
return
itemCount
;
}
}
cmsWebApp/src/performa/intercom/resources/LocationData.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
LocationData
extends
TypedData
{
@JsonProperty
(
"type"
)
private
final
String
type
=
"location_data"
;
@JsonProperty
(
"city_name"
)
private
String
city_Name
;
@JsonProperty
(
"continent_code"
)
private
String
continentCode
;
@JsonProperty
(
"country_code"
)
private
String
countryCode
;
@JsonProperty
(
"country_name"
)
private
String
countryName
;
@JsonProperty
(
"latitude"
)
private
float
latitude
;
@JsonProperty
(
"longitude"
)
private
float
longitude
;
@JsonProperty
(
"postal_code"
)
private
String
postalCode
;
@JsonProperty
(
"region_name"
)
private
String
regionName
;
@JsonProperty
(
"timezone"
)
private
String
timezone
;
public
LocationData
()
{
}
public
String
getType
()
{
return
type
;
}
public
String
getCity_Name
()
{
return
city_Name
;
}
public
String
getContinentCode
()
{
return
continentCode
;
}
public
String
getCountryCode
()
{
return
countryCode
;
}
public
String
getCountryName
()
{
return
countryName
;
}
public
float
getLatitude
()
{
return
latitude
;
}
public
float
getLongitude
()
{
return
longitude
;
}
public
String
getPostalCode
()
{
return
postalCode
;
}
public
String
getRegionName
()
{
return
regionName
;
}
public
String
getTimezone
()
{
return
timezone
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
LocationData
that
=
(
LocationData
)
o
;
if
(
Float
.
compare
(
that
.
latitude
,
latitude
)
!=
0
)
return
false
;
if
(
Float
.
compare
(
that
.
longitude
,
longitude
)
!=
0
)
return
false
;
if
(
city_Name
!=
null
?
!
city_Name
.
equals
(
that
.
city_Name
)
:
that
.
city_Name
!=
null
)
return
false
;
if
(
continentCode
!=
null
?
!
continentCode
.
equals
(
that
.
continentCode
)
:
that
.
continentCode
!=
null
)
return
false
;
if
(
countryCode
!=
null
?
!
countryCode
.
equals
(
that
.
countryCode
)
:
that
.
countryCode
!=
null
)
return
false
;
if
(
countryName
!=
null
?
!
countryName
.
equals
(
that
.
countryName
)
:
that
.
countryName
!=
null
)
return
false
;
if
(
postalCode
!=
null
?
!
postalCode
.
equals
(
that
.
postalCode
)
:
that
.
postalCode
!=
null
)
return
false
;
if
(
regionName
!=
null
?
!
regionName
.
equals
(
that
.
regionName
)
:
that
.
regionName
!=
null
)
return
false
;
if
(
timezone
!=
null
?
!
timezone
.
equals
(
that
.
timezone
)
:
that
.
timezone
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(!
type
.
equals
(
that
.
type
))
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
type
.
hashCode
();
result
=
31
*
result
+
(
city_Name
!=
null
?
city_Name
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
continentCode
!=
null
?
continentCode
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
countryCode
!=
null
?
countryCode
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
countryName
!=
null
?
countryName
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
latitude
!=
+
0.0f
?
Float
.
floatToIntBits
(
latitude
)
:
0
);
result
=
31
*
result
+
(
longitude
!=
+
0.0f
?
Float
.
floatToIntBits
(
longitude
)
:
0
);
result
=
31
*
result
+
(
postalCode
!=
null
?
postalCode
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
regionName
!=
null
?
regionName
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
timezone
!=
null
?
timezone
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
String
toString
()
{
return
"LocationData{"
+
"type='"
+
type
+
'\''
+
", city_Name='"
+
city_Name
+
'\''
+
", continentCode='"
+
continentCode
+
'\''
+
", countryCode='"
+
countryCode
+
'\''
+
", countryName='"
+
countryName
+
'\''
+
", latitude="
+
latitude
+
", longitude="
+
longitude
+
", postalCode='"
+
postalCode
+
'\''
+
", regionName='"
+
regionName
+
'\''
+
", timezone='"
+
timezone
+
'\''
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/MapperSupport.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.core.Version
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.databind.module.SimpleModule
;
public
class
MapperSupport
{
public
static
ObjectMapper
objectMapper
()
{
return
Holder
.
INSTANCE
;
}
private
static
class
Holder
{
private
static
final
ObjectMapper
INSTANCE
=
new
Holder
().
configure
(
new
ObjectMapper
());
private
ObjectMapper
configure
(
ObjectMapper
om
)
{
return
om
.
configure
(
SerializationFeature
.
WRITE_DATES_AS_TIMESTAMPS
,
true
)
.
configure
(
SerializationFeature
.
INDENT_OUTPUT
,
true
)
.
configure
(
SerializationFeature
.
WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS
,
false
)
.
configure
(
DeserializationFeature
.
READ_DATE_TIMESTAMPS_AS_NANOSECONDS
,
false
)
.
registerModule
(
customAttributeModule
());
}
private
SimpleModule
customAttributeModule
()
{
final
SimpleModule
customAttributeModule
=
new
SimpleModule
(
"IntercomClientModule"
,
new
Version
(
1
,
0
,
0
,
null
,
""
,
""
)
);
customAttributeModule
.
addDeserializer
(
CustomAttribute
.
class
,
new
CustomAttributeDeserializer
());
customAttributeModule
.
addSerializer
(
CustomAttribute
.
class
,
new
CustomAttributeSerializer
());
customAttributeModule
.
addDeserializer
(
Subscription
.
Topic
.
class
,
new
TopicDeserializer
());
customAttributeModule
.
addSerializer
(
Subscription
.
Topic
.
class
,
new
TopicSerializer
());
customAttributeModule
.
addSerializer
(
Counts
.
CountItem
.
class
,
new
CountItemSerializer
());
customAttributeModule
.
addDeserializer
(
Counts
.
CountItem
.
class
,
new
CountItemDeserializer
());
return
customAttributeModule
;
}
}
}
cmsWebApp/src/performa/intercom/resources/NotFoundException.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
public
class
NotFoundException
extends
IntercomException
{
private
static
final
long
serialVersionUID
=
2917082281352001861L
;
public
NotFoundException
(
String
message
)
{
super
(
message
);
}
public
NotFoundException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
NotFoundException
(
ErrorCollection
errorCollection
)
{
super
(
errorCollection
);
}
public
NotFoundException
(
ErrorCollection
errorCollection
,
Throwable
cause
)
{
super
(
errorCollection
,
cause
);
}
}
cmsWebApp/src/performa/intercom/resources/Note.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.collect.Maps
;
import
java.util.HashMap
;
import
java.util.Map
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
Note
extends
TypedData
{
private
static
final
HashMap
<
String
,
String
>
SENTINEL
=
Maps
.
newHashMap
();
public
static
Note
find
(
String
id
)
throws
InvalidException
,
AuthorizationException
{
return
DataResource
.
find
(
id
,
"notes"
,
Note
.
class
);
}
public
static
Note
create
(
Note
note
)
throws
InvalidException
,
AuthorizationException
{
return
DataResource
.
create
(
note
,
"notes"
,
Note
.
class
);
}
public
static
NoteCollection
list
(
Map
<
String
,
String
>
params
)
throws
InvalidException
,
AuthorizationException
{
if
((!
params
.
containsKey
(
"email"
))
&&
(!
params
.
containsKey
(
"id"
))
&&
(!
params
.
containsKey
(
"user_id"
))
&&
(!
params
.
containsKey
(
"intercom_user_id"
)))
{
throw
new
InvalidException
(
"a notes query must include an email, user_id or intercom_user_id parameter"
);
}
return
DataResource
.
list
(
params
,
"notes"
,
NoteCollection
.
class
);
}
@JsonProperty
(
"type"
)
private
final
String
type
=
"note"
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"body"
)
private
String
body
;
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
(
"user"
)
private
User
user
;
@JsonProperty
(
"author"
)
private
Author
author
;
public
Note
()
{
}
public
String
getType
()
{
return
type
;
}
public
String
getId
()
{
return
id
;
}
public
String
getBody
()
{
return
body
;
}
public
Note
setBody
(
String
body
)
{
this
.
body
=
body
;
return
this
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
public
User
getUser
()
{
return
user
;
}
public
Note
setUser
(
User
user
)
{
this
.
user
=
user
;
return
this
;
}
public
Author
getAuthor
()
{
return
author
;
}
public
Note
setAuthor
(
Author
author
)
{
this
.
author
=
author
;
return
this
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Note
note
=
(
Note
)
o
;
if
(
createdAt
!=
note
.
createdAt
)
return
false
;
if
(
author
!=
null
?
!
author
.
equals
(
note
.
author
)
:
note
.
author
!=
null
)
return
false
;
if
(
body
!=
null
?
!
body
.
equals
(
note
.
body
)
:
note
.
body
!=
null
)
return
false
;
if
(
id
!=
null
?
!
id
.
equals
(
note
.
id
)
:
note
.
id
!=
null
)
return
false
;
if
(!
type
.
equals
(
note
.
type
))
return
false
;
//noinspection RedundantIfStatement
if
(
user
!=
null
?
!
user
.
equals
(
note
.
user
)
:
note
.
user
!=
null
)
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
type
.
hashCode
();
result
=
31
*
result
+
(
id
!=
null
?
id
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
body
!=
null
?
body
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
int
)
(
createdAt
^
(
createdAt
>>>
32
));
result
=
31
*
result
+
(
user
!=
null
?
user
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
author
!=
null
?
author
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
String
toString
()
{
return
"Note{"
+
"id='"
+
id
+
'\''
+
", body='"
+
body
+
'\''
+
", createdAt="
+
createdAt
+
", user="
+
user
+
", author="
+
author
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/NoteCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Iterator
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
NoteCollection
extends
TypedDataCollection
<
Note
>
implements
Iterator
<
Note
>
{
protected
TypedDataCollectionIterator
<
Note
>
iterator
;
public
NoteCollection
()
{
iterator
=
new
TypedDataCollectionIterator
<
Note
>(
this
);
}
@Override
public
NoteCollection
nextPage
()
{
return
fetchNextPage
(
NoteCollection
.
class
);
}
@SuppressWarnings
(
"EmptyMethod"
)
@JsonProperty
(
"notes"
)
@Override
public
List
<
Note
>
getPage
()
{
return
super
.
getPage
();
}
public
boolean
hasNext
()
{
return
iterator
.
hasNext
();
}
public
Note
next
()
{
return
iterator
.
next
();
}
public
void
remove
()
{
iterator
.
remove
();
}
}
cmsWebApp/src/performa/intercom/resources/Notification.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.collect.Maps
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.URI
;
import
java.util.Map
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
({
"intercom"
})
public
class
Notification
extends
TypedData
{
public
static
Notification
readJSON
(
String
json
)
throws
InvalidException
{
try
{
return
MapperSupport
.
objectMapper
().
readValue
(
json
,
Notification
.
class
);
}
catch
(
IOException
e
)
{
throw
new
InvalidException
(
"could not parse json string ["
+
e
.
getMessage
()
+
"]"
,
e
);
}
}
public
static
Notification
readJSON
(
InputStream
json
)
throws
InvalidException
{
try
{
return
MapperSupport
.
objectMapper
().
readValue
(
json
,
Notification
.
class
);
}
catch
(
IOException
e
)
{
throw
new
InvalidException
(
"could not parse json stream ["
+
e
.
getMessage
()
+
"]"
,
e
);
}
}
@JsonProperty
(
"type"
)
private
final
String
type
=
"notification_event"
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"topic"
)
private
String
topic
;
@JsonProperty
(
"app_id"
)
private
String
appID
;
@JsonProperty
(
"data"
)
private
NotificationData
data
;
@JsonProperty
(
"delivery_status"
)
private
String
deliveryStatus
;
@JsonProperty
(
"delivery_attempts"
)
private
int
deliveryAttempts
;
@JsonProperty
(
"delivered_at"
)
private
long
deliveredAt
;
@JsonProperty
(
"first_sent_at"
)
private
long
firstSentAt
;
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
private
Map
<
String
,
URI
>
links
=
Maps
.
newHashMap
();
@JsonProperty
(
"self"
)
private
URI
self
;
public
Notification
()
{
}
public
String
getType
()
{
return
type
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getTopic
()
{
return
topic
;
}
public
void
setTopic
(
String
topic
)
{
this
.
topic
=
topic
;
}
public
String
getAppID
()
{
return
appID
;
}
public
void
setAppID
(
String
appID
)
{
this
.
appID
=
appID
;
}
public
NotificationData
getData
()
{
return
data
;
}
public
void
setData
(
NotificationData
data
)
{
this
.
data
=
data
;
}
public
String
getDeliveryStatus
()
{
return
deliveryStatus
;
}
public
void
setDeliveryStatus
(
String
deliveryStatus
)
{
this
.
deliveryStatus
=
deliveryStatus
;
}
public
int
getDeliveryAttempts
()
{
return
deliveryAttempts
;
}
public
void
setDeliveryAttempts
(
int
deliveryAttempts
)
{
this
.
deliveryAttempts
=
deliveryAttempts
;
}
public
long
getDeliveredAt
()
{
return
deliveredAt
;
}
public
void
setDeliveredAt
(
long
deliveredAt
)
{
this
.
deliveredAt
=
deliveredAt
;
}
public
long
getFirstSentAt
()
{
return
firstSentAt
;
}
public
void
setFirstSentAt
(
long
firstSentAt
)
{
this
.
firstSentAt
=
firstSentAt
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
public
Map
<
String
,
URI
>
getLinks
()
{
return
links
;
}
public
void
setLinks
(
Map
<
String
,
URI
>
links
)
{
this
.
links
=
links
;
}
public
URI
getSelf
()
{
return
self
;
}
public
void
setSelf
(
URI
self
)
{
this
.
self
=
self
;
}
@Override
public
int
hashCode
()
{
int
result
=
id
!=
null
?
id
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
topic
!=
null
?
topic
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
appID
!=
null
?
appID
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
data
!=
null
?
data
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
deliveryStatus
!=
null
?
deliveryStatus
.
hashCode
()
:
0
);
result
=
31
*
result
+
deliveryAttempts
;
result
=
31
*
result
+
(
int
)
(
deliveredAt
^
(
deliveredAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
firstSentAt
^
(
firstSentAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
createdAt
^
(
createdAt
>>>
32
));
result
=
31
*
result
+
(
links
!=
null
?
links
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
self
!=
null
?
self
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Notification
that
=
(
Notification
)
o
;
if
(
createdAt
!=
that
.
createdAt
)
return
false
;
if
(
deliveredAt
!=
that
.
deliveredAt
)
return
false
;
if
(
deliveryAttempts
!=
that
.
deliveryAttempts
)
return
false
;
if
(
firstSentAt
!=
that
.
firstSentAt
)
return
false
;
if
(
appID
!=
null
?
!
appID
.
equals
(
that
.
appID
)
:
that
.
appID
!=
null
)
return
false
;
if
(
data
!=
null
?
!
data
.
equals
(
that
.
data
)
:
that
.
data
!=
null
)
return
false
;
if
(
deliveryStatus
!=
null
?
!
deliveryStatus
.
equals
(
that
.
deliveryStatus
)
:
that
.
deliveryStatus
!=
null
)
return
false
;
if
(
id
!=
null
?
!
id
.
equals
(
that
.
id
)
:
that
.
id
!=
null
)
return
false
;
if
(
links
!=
null
?
!
links
.
equals
(
that
.
links
)
:
that
.
links
!=
null
)
return
false
;
if
(
self
!=
null
?
!
self
.
equals
(
that
.
self
)
:
that
.
self
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(
topic
!=
null
?
!
topic
.
equals
(
that
.
topic
)
:
that
.
topic
!=
null
)
return
false
;
return
true
;
}
@Override
public
String
toString
()
{
return
"Notification{"
+
"type='"
+
type
+
'\''
+
", id='"
+
id
+
'\''
+
", topic='"
+
topic
+
'\''
+
", appID='"
+
appID
+
'\''
+
", data="
+
data
+
", deliveryStatus='"
+
deliveryStatus
+
'\''
+
", deliveryAttempts="
+
deliveryAttempts
+
", deliveredAt="
+
deliveredAt
+
", firstSentAt="
+
firstSentAt
+
", createdAt="
+
createdAt
+
", links="
+
links
+
", self="
+
self
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/NotificationCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Iterator
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
NotificationCollection
extends
TypedDataCollection
<
Notification
>
implements
Iterator
<
Notification
>
{
protected
TypedDataCollectionIterator
<
Notification
>
iterator
;
public
NotificationCollection
()
{
type
=
"notification.list"
;
iterator
=
new
TypedDataCollectionIterator
<
Notification
>(
this
);
}
@Override
public
NotificationCollection
nextPage
()
{
return
fetchNextPage
(
NotificationCollection
.
class
);
}
@SuppressWarnings
(
"EmptyMethod"
)
@JsonProperty
(
"notifications"
)
@Override
public
List
<
Notification
>
getPage
()
{
return
super
.
getPage
();
}
public
boolean
hasNext
()
{
return
iterator
.
hasNext
();
}
public
Notification
next
()
{
return
iterator
.
next
();
}
public
void
remove
()
{
iterator
.
remove
();
}
}
cmsWebApp/src/performa/intercom/resources/NotificationData.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Map
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
NotificationData
extends
TypedData
{
@JsonProperty
(
"type"
)
protected
String
type
;
@JsonProperty
private
Map
item
;
public
NotificationData
()
{
type
=
"notification_event_data"
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
Map
getItem
()
{
return
item
;
}
public
void
setItem
(
Map
item
)
{
this
.
item
=
item
;
}
@Override
public
int
hashCode
()
{
return
item
!=
null
?
item
.
hashCode
()
:
0
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
NotificationData
that
=
(
NotificationData
)
o
;
//noinspection RedundantIfStatement
if
(
item
!=
null
?
!
item
.
equals
(
that
.
item
)
:
that
.
item
!=
null
)
return
false
;
return
true
;
}
@Override
public
String
toString
()
{
return
"NotificationData{"
+
"type='"
+
type
+
'\''
+
", item="
+
item
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/NotificationError.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
public
class
NotificationError
extends
Notification
{
@JsonProperty
(
"http_request"
)
private
RequestResponseCapture
capture
;
public
RequestResponseCapture
getCapture
()
{
return
capture
;
}
public
void
setCapture
(
RequestResponseCapture
capture
)
{
this
.
capture
=
capture
;
}
@Override
public
String
toString
()
{
return
"NotificationError{"
+
"capture="
+
capture
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/NotificationErrorCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Iterator
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
NotificationErrorCollection
extends
TypedDataCollection
<
NotificationError
>
implements
Iterator
<
NotificationError
>
{
protected
TypedDataCollectionIterator
<
NotificationError
>
iterator
;
public
NotificationErrorCollection
()
{
type
=
"notification.list"
;
iterator
=
new
TypedDataCollectionIterator
<
NotificationError
>(
this
);
}
@SuppressWarnings
(
"EmptyMethod"
)
@JsonProperty
(
"notifications"
)
@Override
public
List
<
NotificationError
>
getPage
()
{
return
super
.
getPage
();
}
@Override
public
NotificationErrorCollection
nextPage
()
{
return
fetchNextPage
(
NotificationErrorCollection
.
class
);
}
public
boolean
hasNext
()
{
return
iterator
.
hasNext
();
}
public
NotificationError
next
()
{
return
iterator
.
next
();
}
public
void
remove
()
{
iterator
.
remove
();
}
}
cmsWebApp/src/performa/intercom/resources/RateLimitException.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
public
class
RateLimitException
extends
IntercomException
{
private
static
final
long
serialVersionUID
=
-
6100754169056165622L
;
private
int
rateLimit
;
private
int
remainingRequests
;
private
long
resetTime
;
public
RateLimitException
(
String
message
)
{
super
(
message
);
}
public
RateLimitException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
RateLimitException
(
ErrorCollection
errorCollection
)
{
super
(
errorCollection
);
}
public
RateLimitException
(
ErrorCollection
errorCollection
,
int
rateLimit
,
int
remainingRequests
,
long
resetTime
)
{
super
(
errorCollection
);
this
.
rateLimit
=
rateLimit
;
this
.
remainingRequests
=
remainingRequests
;
this
.
resetTime
=
resetTime
;
}
public
RateLimitException
(
ErrorCollection
errorCollection
,
Throwable
cause
)
{
super
(
errorCollection
,
cause
);
}
public
int
getRateLimit
()
{
return
rateLimit
;
}
public
void
setRateLimit
(
int
rateLimit
)
{
this
.
rateLimit
=
rateLimit
;
}
public
int
getRemainingRequests
()
{
return
remainingRequests
;
}
public
void
setRemainingRequests
(
int
remainingRequests
)
{
this
.
remainingRequests
=
remainingRequests
;
}
public
long
getResetTime
()
{
return
resetTime
;
}
public
void
setResetTime
(
long
resetTime
)
{
this
.
resetTime
=
resetTime
;
}
}
cmsWebApp/src/performa/intercom/resources/Replier.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
interface
Replier
{
String
getReplyType
();
}
cmsWebApp/src/performa/intercom/resources/Reply.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
class
Reply
<
T
extends
Replier
>
extends
TypedData
{
@JsonProperty
(
"message_type"
)
private
String
messageType
=
"comment"
;
@JsonProperty
(
"body"
)
private
String
body
;
@JsonProperty
(
"attachment_urls"
)
private
String
[]
attachmentUrls
;
@JsonProperty
(
"from"
)
T
from
;
Reply
()
{
}
@JsonProperty
(
"type"
)
String
getType
()
{
return
from
.
getReplyType
();
}
String
getBody
()
{
return
body
;
}
public
Reply
<
T
>
setBody
(
String
body
)
{
this
.
body
=
body
;
return
this
;
}
public
String
[]
getAttachmentUrls
()
{
return
attachmentUrls
;
}
public
Reply
<
T
>
setAttachmentUrls
(
String
[]
attachmentUrls
)
{
this
.
attachmentUrls
=
attachmentUrls
;
return
this
;
}
T
getFrom
()
{
return
from
;
}
@SuppressWarnings
(
"UnusedDeclaration"
)
public
Reply
<
T
>
setFrom
(
T
from
)
{
this
.
from
=
from
;
return
this
;
}
String
getMessageType
()
{
return
messageType
;
}
Reply
<
T
>
setMessageReplyType
(
String
messageType
)
{
this
.
messageType
=
messageType
;
return
this
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Reply
reply
=
(
Reply
)
o
;
if
(
body
!=
null
?
!
body
.
equals
(
reply
.
body
)
:
reply
.
body
!=
null
)
return
false
;
if
(
from
!=
null
?
!
from
.
equals
(
reply
.
from
)
:
reply
.
from
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(!
messageType
.
equals
(
reply
.
messageType
))
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
messageType
.
hashCode
();
result
=
31
*
result
+
(
body
!=
null
?
body
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
from
!=
null
?
from
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
String
toString
()
{
return
"Reply{"
+
"messageType='"
+
messageType
+
'\''
+
", body='"
+
body
+
'\''
+
", from="
+
from
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/RequestResponseCapture.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.collect.ImmutableMap
;
import
java.net.URI
;
import
java.util.Map
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
RequestResponseCapture
{
@JsonProperty
(
"request_method"
)
private
String
requestMethod
;
@JsonProperty
(
"request_uri"
)
private
URI
requestURI
;
@JsonProperty
(
"request_headers"
)
private
Map
<
String
,
String
>
requestHeaders
;
@JsonProperty
(
"response_status_code"
)
private
int
responseStatusCode
;
@JsonProperty
(
"response_headers"
)
private
Map
<
String
,
String
>
responseHeaders
;
@JsonProperty
(
"response_entity"
)
private
String
responseEntity
;
@JsonProperty
(
"request_entity"
)
private
String
requestEntity
;
public
RequestResponseCapture
()
{
}
public
String
getRequestMethod
()
{
return
requestMethod
;
}
public
URI
getRequestURI
()
{
return
requestURI
;
}
public
Map
<
String
,
String
>
getRequestHeaders
()
{
return
ImmutableMap
.<
String
,
String
>
builder
().
putAll
(
requestHeaders
).
build
();
}
public
int
getResponseStatusCode
()
{
return
responseStatusCode
;
}
public
Map
<
String
,
String
>
getResponseHeaders
()
{
return
ImmutableMap
.<
String
,
String
>
builder
().
putAll
(
responseHeaders
).
build
();
}
public
String
getResponseEntity
()
{
return
responseEntity
;
}
public
String
getRequestEntity
()
{
return
requestEntity
;
}
}
\ No newline at end of file
cmsWebApp/src/performa/intercom/resources/ScrollableCompanyCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.List
;
public
class
ScrollableCompanyCollection
extends
ScrollableTypedDataCollection
<
Company
>
{
@Override
public
ScrollableCompanyCollection
scroll
()
{
return
DataResource
.
scroll
(
getScrollParam
(),
"companies"
,
ScrollableCompanyCollection
.
class
);
}
@JsonProperty
(
"companies"
)
@Override
public
List
<
Company
>
getPage
()
{
return
super
.
getPage
();
}
}
cmsWebApp/src/performa/intercom/resources/ScrollableContactCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.List
;
public
class
ScrollableContactCollection
extends
ScrollableTypedDataCollection
<
Contact
>
{
@Override
public
ScrollableContactCollection
scroll
()
{
return
DataResource
.
scroll
(
getScrollParam
(),
"contacts"
,
ScrollableContactCollection
.
class
);
}
@JsonProperty
(
"contacts"
)
@Override
public
List
<
Contact
>
getPage
()
{
return
super
.
getPage
();
}
}
cmsWebApp/src/performa/intercom/resources/ScrollableTypedDataCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.collect.Lists
;
import
java.util.List
;
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
abstract
class
ScrollableTypedDataCollection
<
T
extends
TypedData
>
extends
TypedData
{
protected
List
<
T
>
page
=
Lists
.
newArrayList
();
@JsonProperty
(
"scroll_param"
)
protected
String
scrollParam
;
@JsonProperty
(
"type"
)
protected
String
type
;
public
String
getScrollParam
()
{
return
scrollParam
;
}
public
String
getType
()
{
return
type
;
}
public
abstract
ScrollableTypedDataCollection
<
T
>
scroll
();
public
List
<
T
>
getPage
()
{
return
page
;
}
}
cmsWebApp/src/performa/intercom/resources/ScrollableUserCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.List
;
public
class
ScrollableUserCollection
extends
ScrollableTypedDataCollection
<
User
>
{
@Override
public
ScrollableUserCollection
scroll
()
{
return
DataResource
.
scroll
(
getScrollParam
(),
"users"
,
ScrollableUserCollection
.
class
);
}
@JsonProperty
(
"users"
)
@Override
public
List
<
User
>
getPage
()
{
return
super
.
getPage
();
}
}
cmsWebApp/src/performa/intercom/resources/Segment.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.collect.Maps
;
import
java.util.HashMap
;
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
Segment
extends
TypedData
{
private
static
final
HashMap
<
String
,
String
>
SENTINEL
=
Maps
.
newHashMap
();
public
static
Segment
find
(
String
id
)
throws
InvalidException
,
AuthorizationException
{
final
HttpClient
resource
=
new
HttpClient
(
UriBuilder
.
newBuilder
().
path
(
"segments"
).
path
(
id
).
build
());
return
resource
.
get
(
Segment
.
class
);
}
public
static
SegmentCollection
list
()
throws
InvalidException
,
AuthorizationException
{
return
DataResource
.
list
(
SENTINEL
,
"segments"
,
SegmentCollection
.
class
);
}
public
static
Segment
update
(
Segment
segment
)
throws
InvalidException
,
AuthorizationException
{
if
(
segment
.
getId
()
==
null
)
{
throw
new
InvalidException
(
"segment updates must supply an id"
);
}
return
DataResource
.
update
(
segment
,
"segments"
,
Segment
.
class
);
}
@JsonProperty
(
"type"
)
private
final
String
type
=
"segment"
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"name"
)
private
String
name
;
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
(
"updated_at"
)
private
long
updatedAt
;
@SuppressWarnings
(
"WeakerAccess"
)
public
Segment
()
{
}
public
String
getType
()
{
return
type
;
}
public
String
getId
()
{
return
id
;
}
public
String
getName
()
{
return
name
;
}
public
Segment
setName
(
String
name
)
{
this
.
name
=
name
;
return
this
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
public
long
getUpdatedAt
()
{
return
updatedAt
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Segment
segment
=
(
Segment
)
o
;
if
(
createdAt
!=
segment
.
createdAt
)
return
false
;
if
(
updatedAt
!=
segment
.
updatedAt
)
return
false
;
if
(
id
!=
null
?
!
id
.
equals
(
segment
.
id
)
:
segment
.
id
!=
null
)
return
false
;
if
(
name
!=
null
?
!
name
.
equals
(
segment
.
name
)
:
segment
.
name
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(!
type
.
equals
(
segment
.
type
))
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
type
.
hashCode
();
result
=
31
*
result
+
(
id
!=
null
?
id
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
name
!=
null
?
name
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
int
)
(
createdAt
^
(
createdAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
updatedAt
^
(
updatedAt
>>>
32
));
return
result
;
}
@Override
public
String
toString
()
{
return
"Segment{"
+
"id='"
+
id
+
'\''
+
", name='"
+
name
+
'\''
+
", createdAt="
+
createdAt
+
", updatedAt="
+
updatedAt
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/SegmentCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Iterator
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
SegmentCollection
extends
TypedDataCollection
<
Segment
>
implements
Iterator
<
Segment
>
{
protected
TypedDataCollectionIterator
<
Segment
>
iterator
;
public
SegmentCollection
()
{
type
=
"segment.list"
;
iterator
=
new
TypedDataCollectionIterator
<
Segment
>(
this
);
}
@Override
public
SegmentCollection
nextPage
()
{
return
fetchNextPage
(
SegmentCollection
.
class
);
}
@SuppressWarnings
(
"EmptyMethod"
)
@JsonProperty
(
"segments"
)
@Override
public
List
<
Segment
>
getPage
()
{
return
super
.
getPage
();
}
public
boolean
hasNext
()
{
return
iterator
.
hasNext
();
}
public
Segment
next
()
{
return
iterator
.
next
();
}
public
void
remove
()
{
iterator
.
remove
();
}
@Override
public
String
toString
()
{
return
"SegmentCollection{"
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/ServerException.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
public
class
ServerException
extends
IntercomException
{
private
static
final
long
serialVersionUID
=
7823280575981918941L
;
public
ServerException
(
String
message
)
{
super
(
message
);
}
public
ServerException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
ServerException
(
ErrorCollection
errorCollection
)
{
super
(
errorCollection
);
}
public
ServerException
(
ErrorCollection
errorCollection
,
Throwable
cause
)
{
super
(
errorCollection
,
cause
);
}
}
cmsWebApp/src/performa/intercom/resources/SocialProfile.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.databind.annotation.JsonDeserialize
;
import
java.net.URI
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
SocialProfile
extends
TypedData
{
@JsonProperty
(
"type"
)
private
final
String
type
=
"social_profile"
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"name"
)
private
String
name
;
@JsonProperty
(
"username"
)
private
String
username
;
@JsonProperty
(
"url"
)
@JsonDeserialize
(
using
=
URIDeserializer
.
class
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
private
URI
url
;
public
SocialProfile
()
{
}
public
String
getType
()
{
return
type
;
}
public
String
getId
()
{
return
id
;
}
public
String
getName
()
{
return
name
;
}
public
String
getUsername
()
{
return
username
;
}
public
URI
getUrl
()
{
return
url
;
}
@Override
public
int
hashCode
()
{
int
result
=
id
!=
null
?
id
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
name
!=
null
?
name
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
username
!=
null
?
username
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
url
!=
null
?
url
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
SocialProfile
that
=
(
SocialProfile
)
o
;
if
(
id
!=
null
?
!
id
.
equals
(
that
.
id
)
:
that
.
id
!=
null
)
return
false
;
if
(
name
!=
null
?
!
name
.
equals
(
that
.
name
)
:
that
.
name
!=
null
)
return
false
;
if
(
url
!=
null
?
!
url
.
equals
(
that
.
url
)
:
that
.
url
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(
username
!=
null
?
!
username
.
equals
(
that
.
username
)
:
that
.
username
!=
null
)
return
false
;
return
true
;
}
@Override
public
String
toString
()
{
return
"SocialProfile{"
+
"type='"
+
type
+
'\''
+
", id='"
+
id
+
'\''
+
", name='"
+
name
+
'\''
+
", username='"
+
username
+
'\''
+
", url="
+
url
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/SocialProfileCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.Lists
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
SocialProfileCollection
extends
TypedData
{
@JsonProperty
(
"type"
)
private
String
type
=
"social_profile.list"
;
@JsonProperty
(
"social_profiles"
)
private
List
<
SocialProfile
>
socialProfiles
=
Lists
.
newArrayList
();
SocialProfileCollection
()
{
}
public
String
getType
()
{
return
type
;
}
public
List
<
SocialProfile
>
getSocialProfiles
()
{
return
socialProfiles
==
null
?
null
:
ImmutableList
.<
SocialProfile
>
builder
().
addAll
(
socialProfiles
).
build
();
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
SocialProfileCollection
that
=
(
SocialProfileCollection
)
o
;
if
(
socialProfiles
!=
null
?
!
socialProfiles
.
equals
(
that
.
socialProfiles
)
:
that
.
socialProfiles
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(
type
!=
null
?
!
type
.
equals
(
that
.
type
)
:
that
.
type
!=
null
)
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
type
!=
null
?
type
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
socialProfiles
!=
null
?
socialProfiles
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
String
toString
()
{
return
"SocialProfileCollection{"
+
"type='"
+
type
+
'\''
+
", socialProfiles="
+
socialProfiles
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/Subscription.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.base.Preconditions
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
java.net.URI
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.ArrayList
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
Subscription
extends
TypedData
{
private
static
final
HashMap
<
String
,
String
>
SENTINEL
=
Maps
.
newHashMap
();
public
static
Subscription
create
(
Subscription
subscription
)
throws
InvalidException
,
AuthorizationException
{
return
DataResource
.
create
(
subscription
,
"subscriptions"
,
Subscription
.
class
);
}
public
static
Subscription
update
(
Subscription
subscription
)
throws
InvalidException
,
AuthorizationException
{
return
DataResource
.
update
(
subscription
,
"subscriptions"
,
subscription
.
getId
(),
Subscription
.
class
);
}
public
static
Subscription
delete
(
Subscription
subscription
)
throws
InvalidException
,
AuthorizationException
{
return
DataResource
.
delete
(
subscription
.
getId
(),
"subscriptions"
,
Subscription
.
class
);
}
public
static
Subscription
find
(
String
id
)
throws
InvalidException
,
AuthorizationException
{
final
HttpClient
resource
=
new
HttpClient
(
UriBuilder
.
newBuilder
().
path
(
"subscriptions"
).
path
(
id
).
build
());
return
resource
.
get
(
Subscription
.
class
);
}
public
static
SubscriptionCollection
list
()
throws
InvalidException
,
AuthorizationException
{
return
DataResource
.
list
(
SENTINEL
,
"subscriptions"
,
SubscriptionCollection
.
class
);
}
public
static
NotificationCollection
sentFeed
(
String
id
)
throws
InvalidException
,
AuthorizationException
{
final
URI
feedURI
=
UriBuilder
.
newBuilder
()
.
path
(
"subscriptions"
)
.
path
(
id
)
.
path
(
"sent"
)
.
build
();
final
HttpClient
resource
=
new
HttpClient
(
feedURI
);
return
resource
.
get
(
NotificationCollection
.
class
);
}
public
static
NotificationErrorCollection
errorFeed
(
String
id
)
throws
InvalidException
,
AuthorizationException
{
final
URI
feedURI
=
UriBuilder
.
newBuilder
()
.
path
(
"subscriptions"
)
.
path
(
id
)
.
path
(
"error"
)
.
build
();
final
HttpClient
resource
=
new
HttpClient
(
feedURI
);
return
resource
.
get
(
NotificationErrorCollection
.
class
);
}
@SuppressWarnings
(
"UnusedDeclaration"
)
public
static
class
Topic
{
private
static
final
String
SUBTYPE_WILDCARD
=
"*"
;
private
static
final
String
TEXT
=
"text"
;
private
final
static
String
COMPANY_NAME
=
"company"
;
private
final
static
String
CONVERSATION_NAME
=
"conversation"
;
private
static
final
String
USER_NAME
=
"user"
;
public
static
final
Topic
PING
=
new
Topic
(
"ping"
,
SUBTYPE_WILDCARD
);
public
static
final
Topic
COMPANY
=
new
Topic
(
COMPANY_NAME
,
SUBTYPE_WILDCARD
);
public
static
final
Topic
COMPANY_CREATED
=
new
Topic
(
COMPANY_NAME
,
"created"
);
public
static
final
Topic
CONVERSATION
=
new
Topic
(
CONVERSATION_NAME
,
SUBTYPE_WILDCARD
);
public
static
final
Topic
CONVERSATION_USER_CREATED
=
new
Topic
(
CONVERSATION_NAME
,
"user.created"
);
public
static
final
Topic
CONVERSATION_USER_REPLY
=
new
Topic
(
CONVERSATION_NAME
,
"user.replied"
);
public
static
final
Topic
CONVERSATION_ADMIN_REPLY
=
new
Topic
(
CONVERSATION_NAME
,
"admin.replied"
);
public
static
final
Topic
CONVERSATION_ADMIN_ASSIGNED
=
new
Topic
(
CONVERSATION_NAME
,
"admin.assigned"
);
public
static
final
Topic
CONVERSATION_ADMIN_CLOSED
=
new
Topic
(
CONVERSATION_NAME
,
"admin.closed"
);
public
static
final
Topic
CONVERSATION_ADMIN_OPEN
=
new
Topic
(
CONVERSATION_NAME
,
"admin.open"
);
public
static
final
Topic
CONVERSATION_ADMIN_NOTED
=
new
Topic
(
CONVERSATION_NAME
,
"admin.noted"
);
public
static
final
Topic
USER
=
new
Topic
(
USER_NAME
,
SUBTYPE_WILDCARD
);
public
static
final
Topic
USER_CREATED
=
new
Topic
(
USER_NAME
,
"created"
);
public
static
final
Topic
USER_UNSUBSCRIBED
=
new
Topic
(
USER_NAME
,
"unsubscribed"
);
public
static
final
Topic
USER_TAG_CREATED
=
new
Topic
(
USER_NAME
,
"tag.created"
);
public
static
final
Topic
USER_TAG_DELETED
=
new
Topic
(
USER_NAME
,
"tag.deleted"
);
public
static
final
Topic
ALL_TOPIC
=
valueOf
(
"all"
);
public
static
Topic
valueOf
(
String
type
)
throws
IllegalArgumentException
{
if
(
type
.
contains
(
"."
))
{
final
String
[]
split
=
type
.
split
(
"\\."
,
2
);
// fragile: assume one dot
return
new
Topic
(
split
[
0
],
split
[
1
]);
}
else
{
return
new
Topic
(
type
);
}
}
private
String
type
;
private
String
subType
;
private
String
toString
;
public
Topic
(
String
type
)
{
this
(
type
,
SUBTYPE_WILDCARD
);
}
public
Topic
(
String
type
,
String
subType
)
{
Preconditions
.
checkArgument
(
type
!=
null
,
"type part cannot be null"
);
Preconditions
.
checkArgument
(
subType
!=
null
,
"subType part cannot be null"
);
this
.
type
=
type
;
this
.
subType
=
subType
;
// memo the string representation
if
(
SUBTYPE_WILDCARD
.
equals
(
subType
))
{
toString
=
type
;
}
else
{
toString
=
type
+
"."
+
subType
;
}
}
public
String
getType
()
{
return
type
;
}
public
String
getSubType
()
{
return
subType
;
}
public
boolean
isCompatible
(
String
type
)
{
return
this
.
isCompatible
(
valueOf
(
type
));
}
public
boolean
isCompatible
(
Topic
other
)
{
if
(
other
==
null
)
{
return
false
;
}
//noinspection SimplifiableIfStatement
if
(
type
.
equalsIgnoreCase
(
other
.
type
)
&&
(
subType
.
equals
(
SUBTYPE_WILDCARD
)
||
other
.
subType
.
equals
(
SUBTYPE_WILDCARD
)))
{
return
true
;
}
else
{
return
this
.
type
.
equalsIgnoreCase
(
other
.
type
)
&&
this
.
subType
.
equalsIgnoreCase
(
other
.
subType
);
}
}
@Override
public
int
hashCode
()
{
int
result
=
type
!=
null
?
type
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
subType
!=
null
?
subType
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
String
toString
()
{
return
toString
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
final
Topic
Topic
=
(
Topic
)
o
;
if
(
subType
!=
null
?
!
subType
.
equals
(
Topic
.
subType
)
:
Topic
.
subType
!=
null
)
{
return
false
;
}
//noinspection RedundantIfStatement
if
(
type
!=
null
?
!
type
.
equals
(
Topic
.
type
)
:
Topic
.
type
!=
null
)
{
return
false
;
}
return
true
;
}
}
@SuppressWarnings
(
"FieldCanBeLocal"
)
@JsonProperty
(
"type"
)
private
final
String
type
=
"notification_subscription"
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
(
"updated_at"
)
private
long
updatedAt
;
@JsonProperty
(
"service_type"
)
private
final
String
serviceType
=
"web"
;
@JsonProperty
(
"app_id"
)
private
String
appID
;
@JsonProperty
(
"url"
)
private
URI
url
;
@JsonProperty
(
"self"
)
private
URI
self
;
@JsonProperty
(
"topics"
)
private
List
<
Topic
>
topics
=
Lists
.
newArrayList
();
@JsonProperty
(
"metadata"
)
private
Map
<
String
,
ArrayList
<
String
>>
metadata
=
Maps
.
newHashMap
();
@JsonProperty
(
"active"
)
private
boolean
active
;
@JsonProperty
(
"hub_secret"
)
private
String
hubSecret
;
@JsonProperty
(
"mode"
)
private
String
mode
=
"point"
;
@JsonProperty
(
"links"
)
private
Map
<
String
,
URI
>
links
=
Maps
.
newHashMap
();
@JsonProperty
(
"notes"
)
private
List
<
String
>
notes
=
Lists
.
newArrayList
();
public
Subscription
()
{
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getType
()
{
return
type
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
public
long
getUpdatedAt
()
{
return
updatedAt
;
}
public
String
getServiceType
()
{
return
serviceType
;
}
public
String
getAppID
()
{
return
appID
;
}
public
void
setAppID
(
String
appID
)
{
this
.
appID
=
appID
;
}
public
URI
getUrl
()
{
return
url
;
}
public
void
setUrl
(
URI
url
)
{
this
.
url
=
url
;
}
public
URI
getSelf
()
{
return
self
;
}
public
List
<
Topic
>
getTopics
()
{
return
topics
;
}
public
void
setTopics
(
List
<
Topic
>
topics
)
{
this
.
topics
=
topics
;
}
public
void
addTopic
(
Topic
topic
)
{
this
.
topics
.
add
(
topic
);
}
public
boolean
getActive
()
{
return
active
;
}
public
void
setActive
(
boolean
active
)
{
this
.
active
=
active
;
}
public
Map
<
String
,
ArrayList
<
String
>>
getMetadata
()
{
return
metadata
;
}
public
void
setMetadata
(
Map
<
String
,
ArrayList
<
String
>>
metadata
)
{
this
.
metadata
=
metadata
;
}
public
String
getHubSecret
()
{
return
hubSecret
;
}
public
void
setHubSecret
(
String
hubSecret
)
{
this
.
hubSecret
=
hubSecret
;
}
public
String
getMode
()
{
return
mode
;
}
public
List
<
String
>
getNotes
()
{
return
notes
;
}
public
void
setNotes
(
List
<
String
>
notes
)
{
this
.
notes
=
notes
;
}
@JsonIgnore
public
String
getURLString
()
{
return
url
.
toASCIIString
();
}
@JsonIgnore
public
boolean
requiresSignature
()
{
return
getHubSecret
()
!=
null
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Subscription
that
=
(
Subscription
)
o
;
if
(
active
!=
that
.
active
)
return
false
;
if
(
createdAt
!=
that
.
createdAt
)
return
false
;
if
(
updatedAt
!=
that
.
updatedAt
)
return
false
;
if
(
appID
!=
null
?
!
appID
.
equals
(
that
.
appID
)
:
that
.
appID
!=
null
)
return
false
;
if
(
hubSecret
!=
null
?
!
hubSecret
.
equals
(
that
.
hubSecret
)
:
that
.
hubSecret
!=
null
)
return
false
;
if
(
id
!=
null
?
!
id
.
equals
(
that
.
id
)
:
that
.
id
!=
null
)
return
false
;
if
(
links
!=
null
?
!
links
.
equals
(
that
.
links
)
:
that
.
links
!=
null
)
return
false
;
if
(
metadata
!=
null
?
!
metadata
.
equals
(
that
.
metadata
)
:
that
.
metadata
!=
null
)
return
false
;
if
(
mode
!=
null
?
!
mode
.
equals
(
that
.
mode
)
:
that
.
mode
!=
null
)
return
false
;
if
(
notes
!=
null
?
!
notes
.
equals
(
that
.
notes
)
:
that
.
notes
!=
null
)
return
false
;
if
(
self
!=
null
?
!
self
.
equals
(
that
.
self
)
:
that
.
self
!=
null
)
return
false
;
if
(!
serviceType
.
equals
(
that
.
serviceType
))
return
false
;
if
(
topics
!=
null
?
!
topics
.
equals
(
that
.
topics
)
:
that
.
topics
!=
null
)
return
false
;
if
(!
type
.
equals
(
that
.
type
))
return
false
;
//noinspection RedundantIfStatement
if
(
url
!=
null
?
!
url
.
equals
(
that
.
url
)
:
that
.
url
!=
null
)
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
type
.
hashCode
();
result
=
31
*
result
+
(
id
!=
null
?
id
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
int
)
(
createdAt
^
(
createdAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
updatedAt
^
(
updatedAt
>>>
32
));
result
=
31
*
result
+
(
serviceType
.
hashCode
());
result
=
31
*
result
+
(
appID
!=
null
?
appID
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
url
!=
null
?
url
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
self
!=
null
?
self
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
topics
!=
null
?
topics
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
metadata
!=
null
?
metadata
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
active
?
1
:
0
);
result
=
31
*
result
+
(
hubSecret
!=
null
?
hubSecret
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
mode
!=
null
?
mode
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
links
!=
null
?
links
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
notes
!=
null
?
notes
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
String
toString
()
{
return
"Subscription{"
+
"id='"
+
id
+
'\''
+
", createdAt="
+
createdAt
+
", updatedAt="
+
updatedAt
+
", serviceType='"
+
serviceType
+
'\''
+
", appID='"
+
appID
+
'\''
+
", url="
+
url
+
", self="
+
self
+
", topics="
+
topics
+
", metadata="
+
metadata
+
", active="
+
active
+
", hubSecret='"
+
hubSecret
+
'\''
+
", mode='"
+
mode
+
'\''
+
", links="
+
links
+
", notes="
+
notes
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/SubscriptionCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Iterator
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
SubscriptionCollection
extends
TypedDataCollection
<
Subscription
>
implements
Iterator
<
Subscription
>
{
protected
TypedDataCollectionIterator
<
Subscription
>
iterator
;
public
SubscriptionCollection
()
{
iterator
=
new
TypedDataCollectionIterator
<
Subscription
>(
this
);
}
@Override
public
SubscriptionCollection
nextPage
()
{
return
fetchNextPage
(
SubscriptionCollection
.
class
);
}
@SuppressWarnings
(
"EmptyMethod"
)
@JsonProperty
(
"items"
)
@Override
public
List
<
Subscription
>
getPage
()
{
return
super
.
getPage
();
}
public
boolean
hasNext
()
{
return
iterator
.
hasNext
();
}
public
Subscription
next
()
{
return
iterator
.
next
();
}
public
void
remove
()
{
iterator
.
remove
();
}
@Override
public
String
toString
()
{
return
"SubscriptionCollection{"
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/Tag.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.annotations.VisibleForTesting
;
import
com.google.common.base.Strings
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
Tag
extends
TypedData
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
"intercom-java"
);
private
static
final
HashMap
<
String
,
String
>
SENTINEL
=
Maps
.
newHashMap
();
public
static
Tag
tag
(
Tag
tag
,
User
...
users
)
throws
InvalidException
,
AuthorizationException
{
return
tag
(
tag
,
new
UserCollection
(
Lists
.
newArrayList
(
users
)));
}
public
static
Tag
tag
(
Tag
tag
,
Company
...
companies
)
throws
InvalidException
,
AuthorizationException
{
return
tag
(
tag
,
new
CompanyCollection
(
Lists
.
newArrayList
(
companies
)));
}
static
Tag
tag
(
Tag
tag
,
UserCollection
users
)
throws
InvalidException
,
AuthorizationException
{
TaggableCollection
taggableCollection
=
createTagTypedCollection
(
tag
,
users
);
return
DataResource
.
create
(
taggableCollection
,
"tags"
,
Tag
.
class
);
}
static
Tag
tag
(
Tag
tag
,
CompanyCollection
companies
)
throws
InvalidException
,
AuthorizationException
{
TaggableCollection
taggableCollection
=
createTagTypedCollection
(
tag
,
companies
);
return
DataResource
.
create
(
taggableCollection
,
"tags"
,
Tag
.
class
);
}
public
static
Tag
create
(
Tag
tag
)
throws
InvalidException
,
AuthorizationException
{
return
DataResource
.
create
(
tag
,
"tags"
,
Tag
.
class
);
}
public
static
Tag
update
(
Tag
tag
)
throws
InvalidException
,
AuthorizationException
{
if
(
tag
.
getId
()
==
null
)
{
throw
new
InvalidException
(
"tag updates must supply an id"
);
}
return
DataResource
.
update
(
tag
,
"tags"
,
Tag
.
class
);
}
public
static
Tag
delete
(
String
id
)
throws
InvalidException
,
AuthorizationException
{
return
DataResource
.
delete
(
id
,
"tags"
,
Tag
.
class
);
}
public
static
Tag
delete
(
Tag
tag
)
throws
InvalidException
,
AuthorizationException
{
return
delete
(
tag
.
getId
());
}
public
static
TagCollection
list
()
throws
InvalidException
,
AuthorizationException
{
return
DataResource
.
list
(
SENTINEL
,
"tags"
,
TagCollection
.
class
);
}
@VisibleForTesting
static
TaggableCollection
createTagTypedCollection
(
Tag
tag
,
UserCollection
users
)
{
TaggableCollection
taggableCollection
=
new
TaggableCollection
();
taggableCollection
.
setName
(
tag
.
getName
());
taggableCollection
.
setId
(
tag
.
getId
());
final
List
<
Map
<
String
,
Object
>>
usersLite
=
Lists
.
newArrayList
();
final
List
<
User
>
pageItems
=
users
.
getPage
();
for
(
User
user
:
pageItems
)
{
Map
<
String
,
Object
>
userMap
=
Maps
.
newHashMap
();
final
String
id
=
user
.
getId
();
final
String
email
=
user
.
getEmail
();
final
String
userId
=
user
.
getUserId
();
if
(
user
.
isUntag
())
{
userMap
.
put
(
"untag"
,
true
);
}
if
(!
Strings
.
isNullOrEmpty
(
id
))
{
userMap
.
put
(
"id"
,
id
);
usersLite
.
add
(
userMap
);
}
else
if
(!
Strings
.
isNullOrEmpty
(
email
))
{
userMap
.
put
(
"email"
,
email
);
usersLite
.
add
(
userMap
);
}
else
if
(!
Strings
.
isNullOrEmpty
(
userId
))
{
userMap
.
put
(
"user_id"
,
userId
);
usersLite
.
add
(
userMap
);
}
else
{
logger
.
warn
(
"no identifiers found for user tag target, skipping ["
+
tag
+
"] ["
+
user
.
toString
()
+
"]"
);
}
}
taggableCollection
.
setUsers
(
usersLite
);
return
taggableCollection
;
}
@VisibleForTesting
static
TaggableCollection
createTagTypedCollection
(
Tag
tag
,
CompanyCollection
companies
)
{
TaggableCollection
taggableCollection
=
new
TaggableCollection
();
taggableCollection
.
setName
(
tag
.
getName
());
taggableCollection
.
setId
(
tag
.
getId
());
final
List
<
Map
<
String
,
Object
>>
companiesLite
=
Lists
.
newArrayList
();
final
List
<
Company
>
pageItems
=
companies
.
getPage
();
for
(
Company
company
:
pageItems
)
{
Map
<
String
,
Object
>
companyMap
=
Maps
.
newHashMap
();
final
String
companyID
=
company
.
getCompanyID
();
final
String
id
=
company
.
getId
();
final
String
name
=
company
.
getName
();
if
(
company
.
isUntag
())
{
companyMap
.
put
(
"untag"
,
true
);
}
if
(!
Strings
.
isNullOrEmpty
(
companyID
))
{
companyMap
.
put
(
"company_id"
,
companyID
);
companiesLite
.
add
(
companyMap
);
}
else
if
(!
Strings
.
isNullOrEmpty
(
id
))
{
companyMap
.
put
(
"id"
,
id
);
companiesLite
.
add
(
companyMap
);
}
else
if
(!
Strings
.
isNullOrEmpty
(
name
))
{
companyMap
.
put
(
"name"
,
name
);
companiesLite
.
add
(
companyMap
);
}
else
{
logger
.
warn
(
"no identifiers found for company tag target, skipping ["
+
tag
+
"] ["
+
company
.
toString
()
+
"]"
);
}
taggableCollection
.
setCompanies
(
companiesLite
);
}
return
taggableCollection
;
}
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
static
class
TaggableCollection
extends
Tag
{
@JsonProperty
(
"users"
)
private
List
<
Map
<
String
,
Object
>>
users
;
@JsonProperty
(
"companies"
)
private
List
<
Map
<
String
,
Object
>>
companies
;
public
List
<
Map
<
String
,
Object
>>
getUsers
()
{
return
users
;
}
public
void
setUsers
(
List
<
Map
<
String
,
Object
>>
usersLite
)
{
this
.
users
=
usersLite
;
}
public
List
<
Map
<
String
,
Object
>>
getCompanies
()
{
return
companies
;
}
public
void
setCompanies
(
List
<
Map
<
String
,
Object
>>
companies
)
{
this
.
companies
=
companies
;
}
}
@JsonProperty
(
"type"
)
private
final
String
type
=
"tag"
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"name"
)
private
String
name
;
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
(
"updated_at"
)
private
long
updatedAt
;
public
Tag
()
{
}
public
String
getType
()
{
return
type
;
}
public
String
getId
()
{
return
id
;
}
@SuppressWarnings
(
"UnusedReturnValue"
)
@VisibleForTesting
Tag
setId
(
String
id
)
{
this
.
id
=
id
;
return
this
;
}
public
String
getName
()
{
return
name
;
}
public
Tag
setName
(
String
name
)
{
this
.
name
=
name
;
return
this
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
public
long
getUpdatedAt
()
{
return
updatedAt
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
Tag
tag
=
(
Tag
)
o
;
if
(
createdAt
!=
tag
.
createdAt
)
return
false
;
if
(
updatedAt
!=
tag
.
updatedAt
)
return
false
;
if
(
id
!=
null
?
!
id
.
equals
(
tag
.
id
)
:
tag
.
id
!=
null
)
return
false
;
if
(
name
!=
null
?
!
name
.
equals
(
tag
.
name
)
:
tag
.
name
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(!
type
.
equals
(
tag
.
type
))
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
type
.
hashCode
();
result
=
31
*
result
+
(
id
!=
null
?
id
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
name
!=
null
?
name
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
int
)
(
createdAt
^
(
createdAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
updatedAt
^
(
updatedAt
>>>
32
));
return
result
;
}
@Override
public
String
toString
()
{
return
"Tag{"
+
"id='"
+
id
+
'\''
+
", name='"
+
name
+
'\''
+
", createdAt="
+
createdAt
+
", updatedAt="
+
updatedAt
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/TagCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Iterator
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
TagCollection
extends
TypedDataCollection
<
Tag
>
implements
Iterator
<
Tag
>
{
protected
TypedDataCollectionIterator
<
Tag
>
iterator
;
public
TagCollection
()
{
iterator
=
new
TypedDataCollectionIterator
<
Tag
>(
this
);
}
@Override
public
TagCollection
nextPage
()
{
return
fetchNextPage
(
TagCollection
.
class
);
}
@SuppressWarnings
(
"EmptyMethod"
)
@JsonProperty
(
"tags"
)
@Override
public
List
<
Tag
>
getPage
()
{
return
super
.
getPage
();
}
public
boolean
hasNext
()
{
return
iterator
.
hasNext
();
}
public
Tag
next
()
{
return
iterator
.
next
();
}
public
void
remove
()
{
iterator
.
remove
();
}
@Override
public
String
toString
()
{
return
"TagCollection{"
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/TopicDeserializer.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.core.JsonParser
;
import
com.fasterxml.jackson.databind.DeserializationContext
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.deser.std.StdDeserializer
;
import
com.fasterxml.jackson.databind.node.ValueNode
;
import
java.io.IOException
;
class
TopicDeserializer
extends
StdDeserializer
<
Subscription
.
Topic
>
{
private
static
final
long
serialVersionUID
=
7679767772794559452L
;
public
TopicDeserializer
()
{
super
(
CustomAttribute
.
class
);
}
@Override
public
Subscription
.
Topic
deserialize
(
JsonParser
jp
,
DeserializationContext
ctxt
)
throws
IOException
{
final
ObjectMapper
mapper
=
(
ObjectMapper
)
jp
.
getCodec
();
final
ValueNode
vNode
=
mapper
.
readTree
(
jp
);
return
Subscription
.
Topic
.
valueOf
(
vNode
.
asText
());
}
}
cmsWebApp/src/performa/intercom/resources/TopicSerializer.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.core.JsonGenerator
;
import
com.fasterxml.jackson.databind.SerializerProvider
;
import
com.fasterxml.jackson.databind.ser.std.StdSerializer
;
import
java.io.IOException
;
class
TopicSerializer
extends
StdSerializer
<
Subscription
.
Topic
>
{
public
TopicSerializer
()
{
super
(
Subscription
.
Topic
.
class
);
}
@Override
public
void
serialize
(
Subscription
.
Topic
value
,
JsonGenerator
jgen
,
SerializerProvider
provider
)
throws
IOException
{
jgen
.
writeObject
(
value
.
toString
());
}
}
cmsWebApp/src/performa/intercom/resources/TypedData.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
class
TypedData
{
String
getType
()
{
throw
new
UnsupportedOperationException
();
}
}
cmsWebApp/src/performa/intercom/resources/TypedDataCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
java.net.URI
;
import
java.util.List
;
import
java.util.Map
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
({
"page"
})
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
abstract
class
TypedDataCollection
<
T
extends
TypedData
>
extends
TypedData
{
public
static
final
String
NEXT_PAGE_REL
=
"next"
;
protected
List
<
T
>
page
=
Lists
.
newArrayList
();
@JsonProperty
(
"pages"
)
protected
Map
<
String
,
URI
>
pages
=
Maps
.
newHashMap
();
@JsonProperty
(
"type"
)
protected
String
type
;
public
abstract
TypedDataCollection
<
T
>
nextPage
();
public
boolean
hasNextPage
()
{
return
pages
.
containsKey
(
"next"
)
&&
pages
.
get
(
"next"
)
!=
null
;
}
public
List
<
T
>
getPage
()
{
return
ImmutableList
.<
T
>
builder
().
addAll
(
page
).
build
();
}
protected
<
C
extends
TypedDataCollection
<
T
>>
C
fetchNextPage
(
Class
<
C
>
typeReference
)
{
if
(
hasNextPage
())
{
final
URI
next
=
UriBuilder
.
newBuilder
(
pages
.
get
(
TypedDataCollection
.
NEXT_PAGE_REL
)).
build
();
final
HttpClient
resource
=
new
HttpClient
(
next
);
return
resource
.
get
(
typeReference
);
}
else
{
return
null
;
}
}
public
Map
<
String
,
URI
>
getPages
()
{
return
ImmutableMap
.<
String
,
URI
>
builder
().
putAll
(
pages
).
build
();
}
public
String
getType
()
{
return
type
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
TypedDataCollection
that
=
(
TypedDataCollection
)
o
;
if
(
page
!=
null
?
!
page
.
equals
(
that
.
page
)
:
that
.
page
!=
null
)
return
false
;
if
(
pages
!=
null
?
!
pages
.
equals
(
that
.
pages
)
:
that
.
pages
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(
type
!=
null
?
!
type
.
equals
(
that
.
type
)
:
that
.
type
!=
null
)
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
page
!=
null
?
page
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
pages
!=
null
?
pages
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
type
!=
null
?
type
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
String
toString
()
{
return
getType
()
+
"{"
+
"page="
+
page
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/TypedDataCollectionIterator.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
java.util.Iterator
;
import
java.util.NoSuchElementException
;
class
TypedDataCollectionIterator
<
T
extends
TypedData
>
implements
Iterator
<
T
>
{
private
TypedDataCollection
<
T
>
rollingCollection
;
private
int
pos
;
public
TypedDataCollectionIterator
(
TypedDataCollection
<
T
>
startingCollection
)
{
this
.
rollingCollection
=
startingCollection
;
this
.
pos
=
0
;
}
public
boolean
hasNext
()
{
if
(
pos
==
rollingCollection
.
getPage
().
size
())
{
if
(
rollingCollection
.
hasNextPage
())
{
rollingCollection
=
rollingCollection
.
nextPage
();
pos
=
0
;
if
(
rollingCollection
.
getPage
().
size
()
==
0
)
{
// if new page is empty
return
false
;
}
return
true
;
}
else
{
return
false
;
}
}
else
{
return
pos
<=
rollingCollection
.
getPage
().
size
();
}
}
public
T
next
()
{
iterate
();
final
T
t
=
rollingCollection
.
getPage
().
get
(
pos
);
pos
++;
return
t
;
}
private
void
iterate
()
{
if
(
pos
==
rollingCollection
.
getPage
().
size
())
{
if
(
rollingCollection
.
hasNextPage
())
{
rollingCollection
=
rollingCollection
.
nextPage
();
pos
=
0
;
}
else
{
throw
new
NoSuchElementException
();
}
}
}
public
void
remove
()
{
throw
new
UnsupportedOperationException
();
}
}
cmsWebApp/src/performa/intercom/resources/TypedMessage.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
abstract
class
TypedMessage
<
F
,
T
extends
TypedMessage
>
extends
TypedData
{
@SuppressWarnings
(
"FieldCanBeLocal"
)
@JsonProperty
(
"type"
)
protected
final
String
type
=
"user_message"
;
@JsonProperty
(
"message_type"
)
protected
String
messageType
;
@JsonProperty
(
"id"
)
protected
String
id
;
@JsonProperty
(
"body"
)
protected
String
body
;
@JsonProperty
(
"created_at"
)
protected
long
createdAt
;
protected
F
from
;
public
TypedMessage
()
{
}
public
String
getType
()
{
return
type
;
}
public
F
getFrom
()
{
return
from
;
}
public
T
setFrom
(
F
from
)
{
this
.
from
=
from
;
return
(
T
)
this
;
}
public
String
getMessageType
()
{
return
messageType
;
}
public
void
setMessageType
(
String
messageType
)
{
this
.
messageType
=
messageType
;
}
public
String
getId
()
{
return
id
;
}
public
String
getBody
()
{
return
body
;
}
public
T
setBody
(
String
body
)
{
this
.
body
=
body
;
return
(
T
)
this
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
public
T
setCreatedAt
(
long
createdAt
)
{
this
.
createdAt
=
createdAt
;
return
(
T
)
this
;
}
@Override
public
String
toString
()
{
return
"TypedMessage{"
+
"type='"
+
type
+
'\''
+
", messageType='"
+
messageType
+
'\''
+
", id='"
+
id
+
'\''
+
", body='"
+
body
+
'\''
+
", createdAt="
+
createdAt
+
", from="
+
from
+
"} "
+
super
.
toString
();
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
TypedMessage
<?,
?>
that
=
(
TypedMessage
<?,
?>)
o
;
if
(
createdAt
!=
that
.
createdAt
)
return
false
;
if
(
type
!=
null
?
!
type
.
equals
(
that
.
type
)
:
that
.
type
!=
null
)
return
false
;
if
(
messageType
!=
null
?
!
messageType
.
equals
(
that
.
messageType
)
:
that
.
messageType
!=
null
)
return
false
;
if
(
id
!=
null
?
!
id
.
equals
(
that
.
id
)
:
that
.
id
!=
null
)
return
false
;
if
(
body
!=
null
?
!
body
.
equals
(
that
.
body
)
:
that
.
body
!=
null
)
return
false
;
return
!(
from
!=
null
?
!
from
.
equals
(
that
.
from
)
:
that
.
from
!=
null
);
}
@Override
public
int
hashCode
()
{
int
result
=
type
!=
null
?
type
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
messageType
!=
null
?
messageType
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
id
!=
null
?
id
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
body
!=
null
?
body
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
int
)
(
createdAt
^
(
createdAt
>>>
32
));
result
=
31
*
result
+
(
from
!=
null
?
from
.
hashCode
()
:
0
);
return
result
;
}
}
cmsWebApp/src/performa/intercom/resources/URIDeserializer.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.core.JsonParser
;
import
com.fasterxml.jackson.databind.DeserializationContext
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.deser.std.StdDeserializer
;
import
com.fasterxml.jackson.databind.node.ValueNode
;
import
java.io.IOException
;
import
java.net.MalformedURLException
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.net.URL
;
class
URIDeserializer
extends
StdDeserializer
<
URI
>
{
public
URIDeserializer
()
{
super
(
URI
.
class
);
}
@Override
public
URI
deserialize
(
JsonParser
jp
,
DeserializationContext
ctxt
)
throws
IOException
{
final
ObjectMapper
mapper
=
(
ObjectMapper
)
jp
.
getCodec
();
final
ValueNode
vNode
=
mapper
.
readTree
(
jp
);
URI
uri
=
null
;
try
{
uri
=
new
URI
(
vNode
.
asText
());
}
catch
(
URISyntaxException
ignored
)
{
}
if
(
uri
==
null
)
{
try
{
final
URL
url
=
new
URL
(
vNode
.
asText
());
uri
=
new
URI
(
url
.
getProtocol
(),
url
.
getHost
(),
url
.
getPath
(),
url
.
getQuery
(),
url
.
getRef
());
}
catch
(
MalformedURLException
ignored
)
{
}
catch
(
URISyntaxException
ignored
)
{
}
}
return
uri
;
}
}
cmsWebApp/src/performa/intercom/resources/UriBuilder.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.google.common.base.Charsets
;
import
com.google.common.base.Joiner
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URI
;
import
java.net.URISyntaxException
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.TreeMap
;
class
UriBuilder
{
public
static
UriBuilder
newBuilder
()
{
return
new
UriBuilder
(
Intercom
.
getApiBaseURI
());
}
public
static
UriBuilder
newBuilder
(
String
uri
)
{
return
new
UriBuilder
(
uri
);
}
public
static
UriBuilder
newBuilder
(
URI
uri
)
{
return
new
UriBuilder
(
uri
);
}
private
StringBuilder
uri
;
private
TreeMap
<
String
,
String
>
paramsMap
;
// treemap to simplify testing
private
UriBuilder
(
String
uri
)
{
try
{
this
.
uri
=
new
StringBuilder
(
new
URI
(
uri
).
toASCIIString
());
}
catch
(
URISyntaxException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
private
UriBuilder
(
URI
uri
)
{
this
.
uri
=
new
StringBuilder
(
uri
.
toASCIIString
());
}
public
String
buildString
()
{
return
build
().
toASCIIString
();
}
public
URI
build
()
{
if
(
paramsMap
!=
null
)
{
uri
.
append
(
"?"
);
final
StringBuilder
sb
=
new
StringBuilder
();
for
(
Map
.
Entry
<
String
,
String
>
entry
:
paramsMap
.
entrySet
())
{
sb
.
append
(
entry
.
getKey
()).
append
(
"="
).
append
(
entry
.
getValue
()).
append
(
"&"
);
}
if
(
sb
.
lastIndexOf
(
"&"
)
==
sb
.
length
()
-
1
)
{
sb
.
deleteCharAt
(
sb
.
length
()
-
1
);
}
uri
.
append
(
sb
);
}
try
{
return
new
URI
(
uri
.
toString
());
}
catch
(
URISyntaxException
e
)
{
throw
new
IntercomException
(
"could not create api url"
,
e
);
}
}
public
UriBuilder
path
(
String
path
)
{
uri
.
append
(
"/"
).
append
(
urlEncode
(
path
));
return
this
;
}
public
UriBuilder
path
(
List
<
String
>
path
)
{
List
<
String
>
urlEncoded
=
Lists
.
newArrayList
();
for
(
String
s
:
path
)
{
urlEncoded
.
add
(
urlEncode
(
s
));
}
uri
.
append
(
"/"
).
append
(
Joiner
.
on
(
"/"
).
join
(
urlEncoded
));
return
this
;
}
public
UriBuilder
query
(
String
param
,
String
value
)
{
if
(
paramsMap
==
null
)
{
paramsMap
=
Maps
.
newTreeMap
();
}
paramsMap
.
put
(
urlEncode
(
param
),
urlEncode
(
value
));
return
this
;
}
public
UriBuilder
query
(
Map
<
String
,
String
>
params
)
{
for
(
Map
.
Entry
<
String
,
String
>
entry
:
params
.
entrySet
())
{
query
(
entry
.
getKey
(),
entry
.
getValue
());
}
return
this
;
}
private
String
urlEncode
(
String
param
)
{
try
{
// URLEncoder is a html forms encoder not a percent encoder
return
java
.
net
.
URLEncoder
.
encode
(
param
,
Charsets
.
UTF_8
.
name
()).
replaceAll
(
"\\+"
,
"%20"
);
}
catch
(
UnsupportedEncodingException
e
)
{
throw
new
IntercomException
(
"could not encode url param "
+
param
,
e
);
}
}
}
cmsWebApp/src/performa/intercom/resources/User.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
java.net.URI
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
public
class
User
extends
TypedData
implements
Replier
{
private
static
final
Map
<
String
,
String
>
SENTINEL
=
Maps
.
newHashMap
();
private
static
final
ArrayList
<
String
>
BULK_PATHS
=
Lists
.
newArrayListWithExpectedSize
(
2
);
static
{
BULK_PATHS
.
add
(
"bulk"
);
BULK_PATHS
.
add
(
"users"
);
}
private
static
List
<
CompanyWithStringPlan
>
buildUserUpdateCompanies
(
User
user
)
{
return
CompanyUpdateBuilder
.
buildUserUpdateCompanies
(
user
.
getCompanyCollection
(),
user
.
getRemoveCompanyCollection
());
}
public
static
User
find
(
String
id
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
final
URI
users
=
UriBuilder
.
newBuilder
().
path
(
"users"
).
path
(
id
).
build
();
final
HttpClient
resource
=
new
HttpClient
(
users
);
return
resource
.
get
(
User
.
class
);
}
public
static
User
find
(
Map
<
String
,
String
>
params
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
if
((!
params
.
containsKey
(
"email"
))
&&
(!
params
.
containsKey
(
"user_id"
)))
{
throw
new
InvalidException
(
"a user find must include an email or user_id parameter"
);
}
return
DataResource
.
find
(
params
,
"users"
,
User
.
class
);
}
public
static
User
create
(
User
user
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
create
(
UserUpdate
.
buildFrom
(
user
),
"users"
,
User
.
class
);
}
public
static
User
update
(
User
user
)
throws
InvalidException
,
AuthorizationException
{
// only send fields the server allows for update
return
DataResource
.
update
(
UserUpdate
.
buildFrom
(
user
),
"users"
,
User
.
class
);
}
public
static
User
delete
(
String
id
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
delete
(
id
,
"users"
,
User
.
class
);
}
public
static
UserCollection
list
(
Map
<
String
,
String
>
params
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
list
(
params
,
"users"
,
UserCollection
.
class
);
}
public
static
UserCollection
list
()
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
list
(
SENTINEL
,
"users"
,
UserCollection
.
class
);
}
public
static
ScrollableUserCollection
scroll
()
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
DataResource
.
scroll
(
null
,
"users"
,
ScrollableUserCollection
.
class
);
}
public
static
Job
submit
(
final
List
<
JobItem
<
User
>>
items
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
submit
(
items
,
null
);
}
public
static
Job
submit
(
final
List
<
JobItem
<
User
>>
items
,
Job
job
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
Job
.
submit
(
UserUpdate
.
validateAndConvertJobItems
(
items
),
job
,
BULK_PATHS
);
}
public
static
JobItemCollection
<
User
>
listJobErrorFeed
(
String
jobID
)
throws
AuthorizationException
,
ClientException
,
ServerException
,
InvalidException
,
RateLimitException
{
return
Job
.
listJobErrorFeed
(
jobID
,
User
.
class
);
}
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
static
class
UserUpdate
extends
TypedData
{
private
static
final
List
<
String
>
BULK_METHODS
=
Lists
.
newArrayList
(
"post"
,
"delete"
);
static
UserUpdate
buildFrom
(
User
user
)
{
final
UserUpdate
userUpdate
=
new
UserUpdate
();
userUpdate
.
userId
=
user
.
getUserId
();
userUpdate
.
email
=
user
.
getEmail
();
userUpdate
.
phone
=
user
.
getPhone
();
userUpdate
.
id
=
user
.
getId
();
userUpdate
.
remoteCreatedAt
=
user
.
getRemoteCreatedAt
();
userUpdate
.
name
=
user
.
getName
();
userUpdate
.
lastSeenIp
=
user
.
getLastSeenIp
();
userUpdate
.
customAttributes
=
user
.
getCustomAttributes
();
userUpdate
.
lastSeenUserAgent
=
user
.
getUserAgentData
();
if
(!
buildUserUpdateCompanies
(
user
).
isEmpty
())
{
userUpdate
.
companyCollection
=
buildUserUpdateCompanies
(
user
);
}
userUpdate
.
lastRequestAt
=
user
.
getLastRequestAt
();
userUpdate
.
signedUpAt
=
user
.
getSignedUpAt
();
userUpdate
.
unsubscribedFromEmails
=
user
.
getUnsubscribedFromEmails
();
userUpdate
.
updateLastRequestAt
=
user
.
isUpdateLastRequestAt
();
userUpdate
.
newSession
=
user
.
isNewSession
();
return
userUpdate
;
}
static
List
<
JobItem
<
UserUpdate
>>
validateAndConvertJobItems
(
List
<
JobItem
<
User
>>
items
)
{
final
List
<
JobItem
<
UserUpdate
>>
updateItems
=
Lists
.
newArrayList
();
final
JobSupport
jobSupport
=
new
JobSupport
();
for
(
JobItem
<
User
>
item
:
items
)
{
jobSupport
.
validateJobItem
(
item
,
BULK_METHODS
);
final
JobItem
<
UserUpdate
>
jobItem
=
new
JobItem
<
UserUpdate
>(
item
.
getMethod
(),
buildFrom
(
item
.
getData
()),
item
.
getData
().
getType
());
updateItems
.
add
(
jobItem
);
}
return
updateItems
;
}
@JsonProperty
(
"type"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
private
String
type
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"user_id"
)
private
String
userId
;
@JsonProperty
(
"email"
)
private
String
email
;
@JsonProperty
(
"phone"
)
private
String
phone
;
@JsonProperty
(
"remote_created_at"
)
private
long
remoteCreatedAt
;
@JsonProperty
(
"name"
)
private
String
name
;
@JsonProperty
(
"last_seen_ip"
)
private
String
lastSeenIp
;
@JsonIgnoreProperties
(
ignoreUnknown
=
false
)
@JsonProperty
(
"custom_attributes"
)
private
Map
<
String
,
CustomAttribute
>
customAttributes
=
Maps
.
newHashMap
();
@JsonProperty
(
"last_seen_user_agent"
)
private
String
lastSeenUserAgent
;
@JsonProperty
(
"companies"
)
private
List
<
CompanyWithStringPlan
>
companyCollection
;
@JsonProperty
(
"last_request_at"
)
private
long
lastRequestAt
;
@JsonProperty
(
"signed_up_at"
)
private
long
signedUpAt
;
/**
* Making this a Boolean allows us to send true or false as set
* values leaving null the ignored field for NON_DEFAULT. A
* primitive would result in false not being sent
*/
@JsonProperty
(
"unsubscribed_from_emails"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
private
Boolean
unsubscribedFromEmails
;
/**
* Making this a Boolean allows us to send true or false as set
* values leaving null the ignored field for NON_DEFAULT. A
* primitive would result in false not being sent
*/
@JsonProperty
(
"update_last_request_at"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
private
Boolean
updateLastRequestAt
;
/**
* Making this a Boolean allows us to send true or false as set
* values leaving null the ignored field for NON_DEFAULT. A
* primitive would result in false not being sent
*/
@JsonProperty
(
"new_session"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
private
Boolean
newSession
;
public
UserUpdate
()
{
}
public
String
getType
()
{
return
type
;
}
public
String
getId
()
{
return
id
;
}
public
String
getUserId
()
{
return
userId
;
}
public
String
getEmail
()
{
return
email
;
}
public
String
getPhone
()
{
return
phone
;
}
public
long
getRemoteCreatedAt
()
{
return
remoteCreatedAt
;
}
public
String
getName
()
{
return
name
;
}
public
String
getLastSeenIp
()
{
return
lastSeenIp
;
}
public
Map
<
String
,
CustomAttribute
>
getCustomAttributes
()
{
return
customAttributes
;
}
public
String
getLastSeenUserAgent
()
{
return
lastSeenUserAgent
;
}
public
List
<
CompanyWithStringPlan
>
getCompanyCollection
()
{
return
companyCollection
;
}
public
long
getLastRequestAt
()
{
return
lastRequestAt
;
}
public
long
getSignedUpAt
()
{
return
signedUpAt
;
}
public
Boolean
getUnsubscribedFromEmails
()
{
return
unsubscribedFromEmails
;
}
public
Boolean
isUpdateLastRequestAt
()
{
return
updateLastRequestAt
;
}
public
Boolean
isNewSession
()
{
return
newSession
;
}
}
@JsonProperty
(
"type"
)
@JsonInclude
(
JsonInclude
.
Include
.
ALWAYS
)
private
final
String
type
=
"user"
;
@JsonProperty
(
"id"
)
private
String
id
;
@JsonProperty
(
"name"
)
private
String
name
;
@JsonProperty
(
"email"
)
private
String
email
;
@JsonProperty
(
"phone"
)
private
String
phone
;
@JsonProperty
(
"user_id"
)
private
String
userId
;
@JsonProperty
(
"pseudonym"
)
private
String
pseudonym
;
@JsonProperty
(
"avatar"
)
private
Avatar
avatar
;
@JsonProperty
(
"created_at"
)
private
long
createdAt
;
@JsonProperty
(
"updated_at"
)
private
long
updatedAt
;
@JsonProperty
(
"remote_created_at"
)
private
long
remoteCreatedAt
;
@JsonProperty
(
"unsubscribed_from_emails"
)
private
Boolean
unsubscribedFromEmails
;
@JsonProperty
(
"session_count"
)
private
int
sessionCount
;
@JsonProperty
(
"last_request_at"
)
private
long
lastRequestAt
;
@JsonProperty
(
"signed_up_at"
)
private
long
signedUpAt
;
@JsonProperty
(
"last_seen_ip"
)
private
String
lastSeenIp
;
@JsonIgnoreProperties
(
ignoreUnknown
=
false
)
@JsonProperty
(
"custom_attributes"
)
private
Map
<
String
,
CustomAttribute
>
customAttributes
=
Maps
.
newHashMap
();
@JsonProperty
(
"user_agent_data"
)
private
String
userAgentData
;
@JsonProperty
(
"location_data"
)
private
LocationData
locationData
;
@JsonIgnoreProperties
(
ignoreUnknown
=
false
)
@JsonProperty
(
"companies"
)
private
CompanyCollection
companyCollection
=
new
CompanyCollection
();
@JsonProperty
(
"social_profiles"
)
private
SocialProfileCollection
socialProfileCollection
=
new
SocialProfileCollection
();
@JsonProperty
(
"segments"
)
private
SegmentCollection
segmentCollection
=
new
SegmentCollection
();
@JsonProperty
(
"tags"
)
private
TagCollection
tagCollection
=
new
TagCollection
();
@JsonProperty
(
"update_last_request_at"
)
private
Boolean
updateLastRequestAt
;
@JsonProperty
(
"new_session"
)
private
Boolean
newSession
;
private
Boolean
untag
;
private
CompanyCollection
removeCompanyCollection
=
new
CompanyCollection
();
public
User
()
{
}
public
User
untag
()
{
untag
=
Boolean
.
TRUE
;
return
this
;
}
boolean
isUntag
()
{
return
untag
==
null
?
false
:
untag
;
}
@JsonIgnore
public
String
getReplyType
()
{
return
getType
()
+
"_reply"
;
}
public
String
getType
()
{
return
type
;
}
public
String
getId
()
{
return
id
;
}
public
User
setId
(
String
id
)
{
this
.
id
=
id
;
return
this
;
}
public
String
getName
()
{
return
name
;
}
public
User
setName
(
String
name
)
{
this
.
name
=
name
;
return
this
;
}
public
String
getEmail
()
{
return
email
;
}
public
User
setEmail
(
String
email
)
{
this
.
email
=
email
;
return
this
;
}
public
String
getPhone
()
{
return
phone
;
}
public
User
setPhone
(
String
phone
)
{
this
.
phone
=
phone
;
return
this
;
}
public
String
getUserId
()
{
return
userId
;
}
public
User
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
return
this
;
}
public
String
getPseudonym
()
{
return
pseudonym
;
}
public
Avatar
getAvatar
()
{
return
avatar
;
}
public
long
getCreatedAt
()
{
return
createdAt
;
}
public
long
getUpdatedAt
()
{
return
updatedAt
;
}
public
long
getRemoteCreatedAt
()
{
return
remoteCreatedAt
;
}
public
User
setRemoteCreatedAt
(
long
remoteCreatedAt
)
{
this
.
remoteCreatedAt
=
remoteCreatedAt
;
return
this
;
}
public
Boolean
getUnsubscribedFromEmails
()
{
return
unsubscribedFromEmails
;
}
public
User
setUnsubscribedFromEmails
(
boolean
unsubscribedFromEmails
)
{
this
.
unsubscribedFromEmails
=
unsubscribedFromEmails
;
return
this
;
}
public
int
getSessionCount
()
{
return
sessionCount
;
}
public
long
getLastRequestAt
()
{
return
lastRequestAt
;
}
public
User
setLastRequestAt
(
long
lastRequestAt
)
{
this
.
lastRequestAt
=
lastRequestAt
;
return
this
;
}
public
long
getSignedUpAt
()
{
return
signedUpAt
;
}
public
User
setSignedUpAt
(
long
signedUpAt
)
{
this
.
signedUpAt
=
signedUpAt
;
return
this
;
}
public
String
getLastSeenIp
()
{
return
lastSeenIp
;
}
public
User
setLastSeenIp
(
String
lastSeenIp
)
{
this
.
lastSeenIp
=
lastSeenIp
;
return
this
;
}
public
Map
<
String
,
CustomAttribute
>
getCustomAttributes
()
{
return
customAttributes
;
}
public
User
setCustomAttributes
(
Map
<
String
,
CustomAttribute
>
customAttributes
)
{
this
.
customAttributes
=
customAttributes
;
return
this
;
}
public
User
addCustomAttribute
(
CustomAttribute
customAttribute
)
{
this
.
customAttributes
.
put
(
customAttribute
.
getName
(),
customAttribute
);
return
this
;
}
public
String
getUserAgentData
()
{
return
userAgentData
;
}
public
User
setUserAgentData
(
String
userAgentData
)
{
this
.
userAgentData
=
userAgentData
;
return
this
;
}
public
LocationData
getLocationData
()
{
return
locationData
;
}
public
CompanyCollection
getCompanyCollection
()
{
return
companyCollection
;
}
public
User
setCompanyCollection
(
CompanyCollection
companyCollection
)
{
this
.
companyCollection
=
companyCollection
;
return
this
;
}
public
User
addCompany
(
Company
company
)
{
// sneak past the immutable list
this
.
companyCollection
.
addCompany
(
company
);
return
this
;
}
public
User
removeCompany
(
Company
company
)
{
this
.
removeCompanyCollection
.
addCompany
(
company
);
return
this
;
}
public
SocialProfileCollection
getSocialProfileCollection
()
{
return
socialProfileCollection
;
}
public
SegmentCollection
getSegmentCollection
()
{
return
segmentCollection
;
}
public
TagCollection
getTagCollection
()
{
return
tagCollection
;
}
public
Boolean
isUpdateLastRequestAt
()
{
return
updateLastRequestAt
;
}
public
User
setUpdateLastRequestAt
(
boolean
updateLastRequestAt
)
{
this
.
updateLastRequestAt
=
updateLastRequestAt
;
return
this
;
}
public
Boolean
isNewSession
()
{
return
newSession
;
}
public
User
setNewSession
(
boolean
newSession
)
{
this
.
newSession
=
newSession
;
return
this
;
}
CompanyCollection
getRemoveCompanyCollection
()
{
return
removeCompanyCollection
;
}
void
setRemoveCompanyCollection
(
CompanyCollection
removeCompanyCollection
)
{
this
.
removeCompanyCollection
=
removeCompanyCollection
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
User
user
=
(
User
)
o
;
if
(
createdAt
!=
user
.
createdAt
)
return
false
;
if
(
lastRequestAt
!=
user
.
lastRequestAt
)
return
false
;
if
(
signedUpAt
!=
user
.
signedUpAt
)
return
false
;
if
(
newSession
!=
user
.
newSession
)
return
false
;
if
(
remoteCreatedAt
!=
user
.
remoteCreatedAt
)
return
false
;
if
(
sessionCount
!=
user
.
sessionCount
)
return
false
;
if
(
unsubscribedFromEmails
!=
user
.
unsubscribedFromEmails
)
return
false
;
if
(
updateLastRequestAt
!=
user
.
updateLastRequestAt
)
return
false
;
if
(
updatedAt
!=
user
.
updatedAt
)
return
false
;
if
(
avatar
!=
null
?
!
avatar
.
equals
(
user
.
avatar
)
:
user
.
avatar
!=
null
)
return
false
;
if
(
companyCollection
!=
null
?
!
companyCollection
.
equals
(
user
.
companyCollection
)
:
user
.
companyCollection
!=
null
)
return
false
;
if
(
customAttributes
!=
null
?
!
customAttributes
.
equals
(
user
.
customAttributes
)
:
user
.
customAttributes
!=
null
)
return
false
;
if
(
email
!=
null
?
!
email
.
equals
(
user
.
email
)
:
user
.
email
!=
null
)
return
false
;
if
(
phone
!=
null
?
!
phone
.
equals
(
user
.
phone
)
:
user
.
phone
!=
null
)
return
false
;
if
(
id
!=
null
?
!
id
.
equals
(
user
.
id
)
:
user
.
id
!=
null
)
return
false
;
if
(
lastSeenIp
!=
null
?
!
lastSeenIp
.
equals
(
user
.
lastSeenIp
)
:
user
.
lastSeenIp
!=
null
)
return
false
;
if
(
locationData
!=
null
?
!
locationData
.
equals
(
user
.
locationData
)
:
user
.
locationData
!=
null
)
return
false
;
if
(
name
!=
null
?
!
name
.
equals
(
user
.
name
)
:
user
.
name
!=
null
)
return
false
;
if
(
segmentCollection
!=
null
?
!
segmentCollection
.
equals
(
user
.
segmentCollection
)
:
user
.
segmentCollection
!=
null
)
return
false
;
if
(
socialProfileCollection
!=
null
?
!
socialProfileCollection
.
equals
(
user
.
socialProfileCollection
)
:
user
.
socialProfileCollection
!=
null
)
return
false
;
if
(
tagCollection
!=
null
?
!
tagCollection
.
equals
(
user
.
tagCollection
)
:
user
.
tagCollection
!=
null
)
return
false
;
if
(!
type
.
equals
(
user
.
type
))
return
false
;
if
(
untag
!=
null
?
!
untag
.
equals
(
user
.
untag
)
:
user
.
untag
!=
null
)
return
false
;
if
(
userAgentData
!=
null
?
!
userAgentData
.
equals
(
user
.
userAgentData
)
:
user
.
userAgentData
!=
null
)
return
false
;
//noinspection RedundantIfStatement
if
(
userId
!=
null
?
!
userId
.
equals
(
user
.
userId
)
:
user
.
userId
!=
null
)
return
false
;
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
type
!=
null
?
type
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
id
!=
null
?
id
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
name
!=
null
?
name
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
email
!=
null
?
email
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
phone
!=
null
?
phone
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
userId
!=
null
?
userId
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
pseudonym
!=
null
?
pseudonym
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
avatar
!=
null
?
avatar
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
int
)
(
createdAt
^
(
createdAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
updatedAt
^
(
updatedAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
remoteCreatedAt
^
(
remoteCreatedAt
>>>
32
));
result
=
31
*
result
+
(
unsubscribedFromEmails
!=
null
?
unsubscribedFromEmails
.
hashCode
()
:
0
);
result
=
31
*
result
+
sessionCount
;
result
=
31
*
result
+
(
int
)
(
lastRequestAt
^
(
lastRequestAt
>>>
32
));
result
=
31
*
result
+
(
int
)
(
signedUpAt
^
(
signedUpAt
>>>
32
));
result
=
31
*
result
+
(
lastSeenIp
!=
null
?
lastSeenIp
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
customAttributes
!=
null
?
customAttributes
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
userAgentData
!=
null
?
userAgentData
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
locationData
!=
null
?
locationData
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
companyCollection
!=
null
?
companyCollection
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
socialProfileCollection
!=
null
?
socialProfileCollection
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
segmentCollection
!=
null
?
segmentCollection
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
tagCollection
!=
null
?
tagCollection
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
updateLastRequestAt
!=
null
?
updateLastRequestAt
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
newSession
!=
null
?
newSession
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
untag
!=
null
?
untag
.
hashCode
()
:
0
);
return
result
;
}
@Override
public
String
toString
()
{
return
"User{"
+
"type='"
+
type
+
'\''
+
", id='"
+
id
+
'\''
+
", name='"
+
name
+
'\''
+
", email='"
+
email
+
'\''
+
", phone='"
+
phone
+
'\''
+
", userId='"
+
userId
+
'\''
+
", avatar="
+
avatar
+
", createdAt="
+
createdAt
+
", updatedAt="
+
updatedAt
+
", remoteCreatedAt="
+
remoteCreatedAt
+
", unsubscribedFromEmails="
+
unsubscribedFromEmails
+
", sessionCount="
+
sessionCount
+
", lastRequestAt="
+
lastRequestAt
+
", signedUpAt="
+
signedUpAt
+
", lastSeenIp='"
+
lastSeenIp
+
'\''
+
", customAttributes="
+
customAttributes
+
", userAgentData='"
+
userAgentData
+
'\''
+
", locationData="
+
locationData
+
", companyCollection="
+
companyCollection
+
", socialProfileCollection="
+
socialProfileCollection
+
", segmentCollection="
+
segmentCollection
+
", tagCollection="
+
tagCollection
+
", updateLastRequestAt="
+
updateLastRequestAt
+
", newSession="
+
newSession
+
", untag="
+
untag
+
"} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/UserCollection.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.Iterator
;
import
java.util.List
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
UserCollection
extends
TypedDataCollection
<
User
>
implements
Iterator
<
User
>
{
protected
TypedDataCollectionIterator
<
User
>
iterator
;
public
UserCollection
()
{
iterator
=
new
TypedDataCollectionIterator
<
User
>(
this
);
}
public
UserCollection
(
List
<
User
>
users
)
{
this
();
this
.
page
=
users
;
}
@SuppressWarnings
(
"EmptyMethod"
)
@JsonProperty
(
"users"
)
@Override
public
List
<
User
>
getPage
()
{
return
super
.
getPage
();
}
@Override
public
UserCollection
nextPage
()
{
return
fetchNextPage
(
UserCollection
.
class
);
}
public
boolean
hasNext
()
{
return
iterator
.
hasNext
();
}
public
User
next
()
{
return
iterator
.
next
();
}
public
void
remove
()
{
iterator
.
remove
();
}
}
cmsWebApp/src/performa/intercom/resources/UserMessage.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_DEFAULT
)
public
class
UserMessage
extends
TypedMessage
<
User
,
UserMessage
>
{
public
UserMessage
()
{
}
@JsonIgnore
@Deprecated
public
UserMessage
setUser
(
User
user
)
{
this
.
from
=
user
;
return
this
;
}
@Override
public
String
toString
()
{
return
"UserMessage{} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/resources/UserReply.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
resources
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
@SuppressWarnings
(
"UnusedDeclaration"
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
public
class
UserReply
extends
Reply
<
User
>
{
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_EMPTY
)
static
class
UserStringReply
{
private
UserReply
reply
;
public
UserStringReply
(
UserReply
reply
)
{
this
.
reply
=
reply
;
}
@JsonProperty
(
"type"
)
public
String
getType
()
{
return
reply
.
getType
();
}
@SuppressWarnings
(
"SameReturnValue"
)
@JsonProperty
(
"message_type"
)
public
String
getMessageType
()
{
return
"comment"
;
}
@JsonProperty
(
"body"
)
public
String
getBody
()
{
return
reply
.
getBody
();
}
@JsonProperty
(
"intercom_user_id"
)
public
String
getIntercomUserID
()
{
return
reply
.
getFrom
().
getId
();
}
@JsonProperty
(
"user_id"
)
public
String
getUserID
()
{
return
reply
.
getFrom
().
getUserId
();
}
@JsonProperty
(
"email"
)
public
String
getEmail
()
{
return
reply
.
getFrom
().
getEmail
();
}
@JsonProperty
(
"attachment_urls"
)
private
String
[]
getAttachmentUrls
()
{
return
reply
.
getAttachmentUrls
();
}
}
public
UserReply
(
User
user
)
{
this
.
from
=
user
;
}
@Override
public
String
toString
()
{
return
"UserReply{} "
+
super
.
toString
();
}
}
cmsWebApp/src/performa/intercom/utils/IntercomUtils.java
deleted
100644 → 0
View file @
9276a42b
package
performa
.
intercom
.
utils
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
oneit.logging.LogLevel
;
import
oneit.logging.LogMgr
;
import
oneit.logging.LoggingArea
;
import
oneit.objstore.StorageException
;
import
oneit.objstore.rdbms.filters.EqualsFilter
;
import
oneit.objstore.rdbms.filters.InFilter
;
import
oneit.objstore.utils.ObjstoreUtils
;
import
oneit.security.SecUser
;
import
oneit.utils.CollectionUtils
;
import
oneit.utils.ObjectTransform
;
import
oneit.utils.filter.CollectionFilter
;
import
oneit.utils.filter.Filter
;
import
performa.intercom.resources.AuthorizationException
;
import
performa.intercom.resources.ClientException
;
import
performa.intercom.resources.Company
;
import
performa.intercom.resources.CustomAttribute
;
import
performa.intercom.resources.Intercom
;
import
performa.intercom.resources.InvalidException
;
import
performa.intercom.resources.NotFoundException
;
import
performa.intercom.resources.RateLimitException
;
import
performa.intercom.resources.ServerException
;
import
performa.intercom.resources.User
;
import
performa.orm.Job
;
import
performa.orm.JobApplication
;
import
performa.orm.types.ApplicationStatus
;
import
performa.orm.types.JobStatus
;
import
performa.utils.Utils
;
public
class
IntercomUtils
{
static
{
Intercom
.
setToken
(
Utils
.
INTERCOM_TOKEN
);
Intercom
.
setAppID
(
Utils
.
INTERCOM_APP_ID
);
}
public
static
User
createIntercomUser
(
SecUser
secUser
,
String
role
,
Company
company
,
String
phone
)
{
try
{
User
user
=
new
User
();
user
.
setUserId
(
secUser
.
getIdentification
());
user
.
setEmail
(
secUser
.
getEmail
());
user
.
setName
(
secUser
.
getName
());
user
.
setPhone
(
phone
);
user
.
addCustomAttribute
(
CustomAttribute
.
newStringAttribute
(
"role"
,
role
));
if
(
company
!=
null
)
{
user
.
addCompany
(
company
);
}
User
.
create
(
user
);
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
"Created Intercom User: "
,
user
);
return
user
;
}
catch
(
AuthorizationException
|
ClientException
|
ServerException
|
InvalidException
|
RateLimitException
e
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
e
,
"Error while creating a user in intercom"
);
return
null
;
}
}
public
static
User
findUserByID
(
SecUser
secUser
)
{
try
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"user_id"
,
secUser
.
getIdentification
());
return
User
.
find
(
map
);
}
catch
(
AuthorizationException
|
ClientException
|
ServerException
|
InvalidException
|
RateLimitException
|
NotFoundException
e
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
e
,
"Error while fetching a user by id from intercom"
);
return
null
;
}
}
public
static
User
updateIntercomUser
(
SecUser
secUser
,
String
phone
)
{
try
{
User
user
=
findUserByID
(
secUser
);
if
(
user
!=
null
)
{
user
.
setEmail
(
secUser
.
getEmail
());
user
.
setName
(
secUser
.
getName
());
user
.
setPhone
(
phone
);
User
.
update
(
user
);
}
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
"Updated Intercom User: "
,
user
);
return
user
;
}
catch
(
InvalidException
|
AuthorizationException
e
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
e
,
"Error while updating a user in intercom"
);
return
null
;
}
}
public
static
Company
createIntercomCompany
(
performa
.
orm
.
Company
company
)
{
try
{
Company
intercomCompany
=
new
Company
();
setCompanyDetails
(
intercomCompany
,
company
);
Company
.
create
(
intercomCompany
);
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
"Created Intercom Company: "
,
intercomCompany
);
return
intercomCompany
;
}
catch
(
StorageException
|
InvalidException
|
AuthorizationException
e
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
e
,
"Error while creating a company in intercom"
);
return
null
;
}
}
private
static
void
setCompanyDetails
(
Company
intercomCompany
,
performa
.
orm
.
Company
company
)
throws
StorageException
{
intercomCompany
.
setName
(
company
.
getCompanyName
());
intercomCompany
.
setCompanyID
(
company
.
getID
().
toString
());
// job related custom attributes
Job
[]
jobs
=
Job
.
searchCompany
(
company
.
getTransaction
(),
company
);
Filter
draftFilter
=
Job
.
SearchByAll
().
andJobStatus
(
new
EqualsFilter
<>(
JobStatus
.
DRAFT
));
Collection
draftJobs
=
CollectionFilter
.
filter
(
Arrays
.
asList
(
jobs
),
draftFilter
);
Filter
filledFilter
=
Job
.
SearchByAll
().
andJobStatus
(
new
EqualsFilter
<>(
JobStatus
.
FILLED
));
Collection
filledJobs
=
CollectionFilter
.
filter
(
Arrays
.
asList
(
jobs
),
filledFilter
);
Filter
openFilter
=
Job
.
SearchByAll
().
andJobStatus
(
new
EqualsFilter
<>(
JobStatus
.
OPEN
));
Collection
openJobs
=
CollectionFilter
.
filter
(
Arrays
.
asList
(
jobs
),
openFilter
);
Filter
closedFilter
=
Job
.
SearchByAll
().
andJobStatus
(
new
EqualsFilter
<>(
JobStatus
.
COMPLETE
));
Collection
closedJobs
=
CollectionFilter
.
filter
(
Arrays
.
asList
(
jobs
),
closedFilter
);
Filter
manuallyFilter
=
Job
.
SearchByAll
().
andIsManuallyClosed
(
new
EqualsFilter
<>(
Boolean
.
TRUE
));
Collection
manuallyClosed
=
CollectionFilter
.
filter
(
closedJobs
,
manuallyFilter
);
intercomCompany
.
addCustomAttribute
(
CustomAttribute
.
newIntegerAttribute
(
"job-count"
,
jobs
!=
null
?
jobs
.
length
:
0
));
intercomCompany
.
addCustomAttribute
(
CustomAttribute
.
newIntegerAttribute
(
"draft-job-count"
,
draftJobs
.
size
()));
intercomCompany
.
addCustomAttribute
(
CustomAttribute
.
newIntegerAttribute
(
"filled_job_count"
,
filledJobs
.
size
()));
intercomCompany
.
addCustomAttribute
(
CustomAttribute
.
newIntegerAttribute
(
"open_job_count"
,
openJobs
.
size
()));
intercomCompany
.
addCustomAttribute
(
CustomAttribute
.
newIntegerAttribute
(
"manually_closed_job_count"
,
manuallyClosed
.
size
()));
intercomCompany
.
addCustomAttribute
(
CustomAttribute
.
newIntegerAttribute
(
"expired_job_count"
,
closedJobs
.
size
()
-
manuallyClosed
.
size
()));
// applicant related custom attributes
Filter
allApplicantFilter
=
JobApplication
.
SearchByAll
().
andApplicationStatus
(
new
InFilter
<>(
ApplicationStatus
.
SUBMITTED
,
ApplicationStatus
.
SHORTLISTED
,
ApplicationStatus
.
UNSUITABLE
));
Collection
applicants
=
Job
.
pipesJob
(
jobs
).
toJobApplications
(
allApplicantFilter
).
uniqueVals
();
Filter
shortlistedFilter
=
JobApplication
.
SearchByAll
().
andApplicationStatus
(
new
EqualsFilter
<>(
ApplicationStatus
.
SHORTLISTED
));
Collection
shortlistedApplicants
=
CollectionFilter
.
filter
(
applicants
,
shortlistedFilter
);
Filter
unsuitableFilter
=
JobApplication
.
SearchByAll
().
andApplicationStatus
(
new
EqualsFilter
<>(
ApplicationStatus
.
UNSUITABLE
));
Collection
unsuitableApplicants
=
CollectionFilter
.
filter
(
applicants
,
unsuitableFilter
);
intercomCompany
.
addCustomAttribute
(
CustomAttribute
.
newIntegerAttribute
(
"total_applicants"
,
applicants
.
size
()));
intercomCompany
.
addCustomAttribute
(
CustomAttribute
.
newIntegerAttribute
(
"total_shortlisted"
,
shortlistedApplicants
.
size
()));
intercomCompany
.
addCustomAttribute
(
CustomAttribute
.
newIntegerAttribute
(
"total_unsuitable"
,
unsuitableApplicants
.
size
()));
List
<
Job
>
sortedJobs
=
ObjstoreUtils
.
sort
(
Arrays
.
asList
(
jobs
),
new
ObjectTransform
[]{
Job
.
pipesJob
().
toObjectCreated
()},
new
Comparator
[]{
CollectionUtils
.
reverse
(
CollectionUtils
.
DEFAULT_COMPARATOR
)});
if
(
sortedJobs
.
size
()
>
0
)
{
intercomCompany
.
addCustomAttribute
(
CustomAttribute
.
newLongAttribute
(
"recent_job_created_at"
,
sortedJobs
.
get
(
0
).
getObjectCreated
().
getTime
()
/
1000
));
}
}
public
static
Company
findCompanyByID
(
performa
.
orm
.
Company
company
)
{
try
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"company_id"
,
company
.
getID
().
toString
());
return
Company
.
find
(
map
);
}
catch
(
InvalidException
|
AuthorizationException
|
NotFoundException
e
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
e
,
"Error while fetching a company by id from intercom"
);
return
null
;
}
}
public
static
void
updateCompany
(
performa
.
orm
.
Company
company
)
{
try
{
Company
intercomCompany
=
findCompanyByID
(
company
);
if
(
intercomCompany
==
null
)
{
createIntercomCompany
(
company
);
}
else
{
setCompanyDetails
(
intercomCompany
,
company
);
Company
.
update
(
intercomCompany
);
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
"Updated Intercom Company: "
,
intercomCompany
);
}
}
catch
(
Exception
e
)
{
LogMgr
.
log
(
LoggingArea
.
ALL
,
LogLevel
.
PROCESSING1
,
e
,
"Error while updating company in intercom"
);
}
}
public
static
Company
findOrCreateCompany
(
performa
.
orm
.
Company
company
)
{
Company
intercomCompany
=
findCompanyByID
(
company
);
if
(
intercomCompany
==
null
)
{
intercomCompany
=
createIntercomCompany
(
company
);
}
return
intercomCompany
;
}
// public static void createAccessedJobEvent(Job job, User user)
// {
// try
// {
// Map<String, CustomAttribute> customAttributes = user.getCustomAttributes();
// customAttributes.get("shortlisted-count");
// Event event = new Event();
//
// event.setEventName("accessed-job");
// event.putMetadata("applicant-count", job.getNoOfCandidatesApplied());
// event.putMetadata("shortlisted-count", job.getNoOfCandidatesShortlisted());
// event.setUserID(user.getUserId());
// event.setCreatedAt(currentTimeMillis()/1000L);
//
// Event.create(event);
// }
// catch (Exception e)
// {
// LogMgr.log(LoggingArea.ALL, LogLevel.PROCESSING1, e, "Error while creating accessed job event in intercom");
//
// }
// }
}
cmsWebApp/src/performa/utils/Utils.java
View file @
360576bf
...
@@ -44,8 +44,6 @@ public class Utils
...
@@ -44,8 +44,6 @@ public class Utils
public
static
final
String
PRIV_ACCESS_COMPANY_ADMIN
=
"TL_AccessCompanyAdmin"
;
public
static
final
String
PRIV_ACCESS_COMPANY_ADMIN
=
"TL_AccessCompanyAdmin"
;
public
static
final
String
PRIV_ACCESS_COMPANY
=
"TL_AccessCompany"
;
public
static
final
String
PRIV_ACCESS_COMPANY
=
"TL_AccessCompany"
;
public
static
final
String
HEAP_ANALYSIS_ID
=
ConfigMgr
.
getKeyfileString
(
"heap.analysis.id"
,
"3411110378"
);
public
static
final
String
HEAP_ANALYSIS_ID
=
ConfigMgr
.
getKeyfileString
(
"heap.analysis.id"
,
"3411110378"
);
public
static
final
String
INTERCOM_APP_ID
=
ConfigMgr
.
getKeyfileString
(
"intercom.appId"
,
""
);
public
static
final
String
INTERCOM_TOKEN
=
ConfigMgr
.
getKeyfileString
(
"intercom.token"
,
""
);
public
static
Role
getRole
(
String
role
,
ObjectTransaction
transaction
)
public
static
Role
getRole
(
String
role
,
ObjectTransaction
transaction
)
{
{
...
...
cmsWebApp/webroot/dynamic_content_core.jsp
View file @
360576bf
...
@@ -3,8 +3,6 @@
...
@@ -3,8 +3,6 @@
<%@ include file="inc/dynamic_content_core_top.jsp" %>
<%@ include file="inc/dynamic_content_core_top.jsp" %>
<%@ include file="/inc/stdimports50.jsp" %>
<%@ include file="/inc/stdimports50.jsp" %>
<%@ page import="performa.utils.*"%>
<%@ page import="performa.utils.*"%>
<%@ page import="performa.intercom.utils.*"%>
<%@ page import="performa.intercom.resources.User"%>
<%
<%
ORMProcessState process = (ORMProcessState)(ProcessDecorator.getDefaultProcess(request));
ORMProcessState process = (ORMProcessState)(ProcessDecorator.getDefaultProcess(request));
...
...
cmsWebApp/webroot/extensions/adminportal/inc/htmlheader.jsp
View file @
360576bf
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
Company
company =
clientUser
!=
null
&&
clientUser
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
)
!=
null
Company
company =
clientUser
!=
null
&&
clientUser
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
)
!=
null
?
clientUser
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
).
getCompany
()
:
null
;
?
clientUser
.
getExtension
(
CompanyUser
.
REFERENCE_CompanyUser
).
getCompany
()
:
null
;
CompanyUser
companyUser =
clientUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
CompanyUser
companyUser =
clientUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
User
intercomUser =
(User)session.getAttribute("IntercomUser");
HiringTeam
selectedTeam =
(HiringTeam)
session
.
getAttribute
("
SelectedHiringTeam
");
HiringTeam
selectedTeam =
(HiringTeam)
session
.
getAttribute
("
SelectedHiringTeam
");
String
gtmKey =
oneit.appservices.config.ConfigMgr.getKeyfileString("gtm.key","GTM-M6M4SW6");
String
gtmKey =
oneit.appservices.config.ConfigMgr.getKeyfileString("gtm.key","GTM-M6M4SW6");
...
@@ -27,11 +26,6 @@
...
@@ -27,11 +26,6 @@
selectedTeam =
selectedTeam.getInTransaction(objTran);
selectedTeam =
selectedTeam.getInTransaction(objTran);
}
}
if
(
intercomUser =
=
null
)
{
intercomUser =
IntercomUtils.findUserByID(clientUser);
session
.
setAttribute
("
IntercomUser
"
,
intercomUser
);
}
%
>
%
>
<title><
%=
"
Matchd
"
+
(
company
!=
null
?
"
-
"
+
company
.
getCompanyName
()
:
"")%
></title>
<title><
%=
"
Matchd
"
+
(
company
!=
null
?
"
-
"
+
company
.
getCompanyName
()
:
"")%
></title>
...
@@ -53,10 +47,6 @@
...
@@ -53,10 +47,6 @@
<!-- End Google Tag Manager -->
<!-- End Google Tag Manager -->
</head>
</head>
<script>
<script>
window
.
intercomSettings
=
{
app_id
:
"<%= Utils.INTERCOM_APP_ID %>"
,
user_id
:
"<%= clientUser.getID().toString() %>"
};
$
(
document
).
ready
(
function
(){
$
(
document
).
ready
(
function
(){
$
(
".oneit-radio input"
).
each
(
function
(){
$
(
".oneit-radio input"
).
each
(
function
(){
...
@@ -81,9 +71,7 @@
...
@@ -81,9 +71,7 @@
$
(
ele
).
closest
(
'.oneit-radio'
).
addClass
(
'checked'
);
$
(
ele
).
closest
(
'.oneit-radio'
).
addClass
(
'checked'
);
}
}
</script>
</script>
<script>
(
function
(){
var
w
=
window
;
var
ic
=
w
.
Intercom
;
if
(
typeof
ic
===
"function"
){
ic
(
'reattach_activator'
);
ic
(
'update'
,
intercomSettings
);}
else
{
var
d
=
document
;
var
i
=
function
(){
i
.
c
(
arguments
)};
i
.
q
=
[];
i
.
c
=
function
(
args
){
i
.
q
.
push
(
args
)};
w
.
Intercom
=
i
;
function
l
(){
var
s
=
d
.
createElement
(
'script'
);
s
.
type
=
'text/javascript'
;
s
.
async
=
true
;
s
.
src
=
'https://widget.intercom.io/widget/kqed9h3r'
;
var
x
=
d
.
getElementsByTagName
(
'script'
)[
0
];
x
.
parentNode
.
insertBefore
(
s
,
x
);}
if
(
w
.
attachEvent
){
w
.
attachEvent
(
'onload'
,
l
);}
else
{
w
.
addEventListener
(
'load'
,
l
,
false
);}}})()
</script>
<body>
<body>
<!-- Google Tag Manager (noscript) -->
<!-- Google Tag Manager (noscript) -->
<noscript><iframe
src=
"https://www.googletagmanager.com/ns.html?id=<%= gtmKey %>"
height=
"0"
width=
"0"
style=
"display:none;visibility:hidden"
></iframe></noscript>
<noscript><iframe
src=
"https://www.googletagmanager.com/ns.html?id=<%= gtmKey %>"
height=
"0"
width=
"0"
style=
"display:none;visibility:hidden"
></iframe></noscript>
...
...
cmsWebApp/webroot/extensions/performa/inc/stdimports.jsp
View file @
360576bf
<%@ page import="performa.orm.*, performa.orm.types.*, performa.form.*, performa.utils.*, performa.search.*"%>
<%@ page import="performa.orm.*, performa.orm.types.*, performa.form.*, performa.utils.*, performa.search.*"%>
<%@ page import="
performa.intercom.utils.*, performa.intercom.resources.User,
com.stripe.model.*"%>
<%@ page import="com.stripe.model.*"%>
<%@ page import="oneit.objstore.rdbms.filters.*, oneit.security.jsp.SecUserToNameTransform, oneit.servlets.utils.*, oneit.utils.image.*, oneit.objstore.utils.ObjstoreUtils "%>
<%@ page import="oneit.objstore.rdbms.filters.*, oneit.security.jsp.SecUserToNameTransform, oneit.servlets.utils.*, oneit.utils.image.*, oneit.objstore.utils.ObjstoreUtils "%>
<%@ page import="oneit.utils.text.FormatUtils, oneit.utils.math.*"%>
<%@ page import="oneit.utils.text.FormatUtils, oneit.utils.math.*"%>
<%@ page import="oneit.servlets.objstore.binary.*"%>
<%@ page import="oneit.servlets.objstore.binary.*"%>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment