diff --git a/pom.xml b/pom.xml
index f9ca3882..822ea793 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.bullhorn
sdk-rest
- 2.3.1
+ 2.3.2
jar
Bullhorn REST SDK
diff --git a/src/main/java/com/bullhornsdk/data/api/BullhornData.java b/src/main/java/com/bullhornsdk/data/api/BullhornData.java
index 623d15f9..35dcac86 100644
--- a/src/main/java/com/bullhornsdk/data/api/BullhornData.java
+++ b/src/main/java/com/bullhornsdk/data/api/BullhornData.java
@@ -1,12 +1,5 @@
package com.bullhornsdk.data.api;
-import java.io.File;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.springframework.web.multipart.MultipartFile;
-
import com.bullhornsdk.data.api.helper.EntityIdBoundaries;
import com.bullhornsdk.data.api.helper.RestApiSession;
import com.bullhornsdk.data.exception.RestApiException;
@@ -56,6 +49,12 @@
import com.bullhornsdk.data.model.response.resume.ParsedResume;
import com.bullhornsdk.data.model.response.resume.ParsedResumeAsEntity;
import com.bullhornsdk.data.model.response.subscribe.SubscribeToEventsResponse;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* Core bullhorn data service, handles api calls and data mapping.
@@ -409,6 +408,13 @@ public > L qu
*/
public Map getSettings(Set settingSet, SettingsParams params);
+ /**
+ * Returns uniqueCallId used to identify rest requests.
+ *
+ * @return UniqueCallId
+ */
+ public String getUniqueCallId();
+
/**
* Returns a valid bhRestToken to be used in a bh rest api call.
*
diff --git a/src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java b/src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java
index 174d6bc3..d4ecadf2 100644
--- a/src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java
+++ b/src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java
@@ -1,37 +1,5 @@
package com.bullhornsdk.data.api;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.stream.Collectors;
-
-import com.bullhornsdk.data.model.response.single.StandardFileContentWrapper;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.client.SimpleClientHttpRequestFactory;
-import org.springframework.util.MultiValueMap;
-import org.springframework.web.client.HttpStatusCodeException;
-import org.springframework.web.client.RestTemplate;
-import org.springframework.web.multipart.MultipartFile;
-
import com.bullhornsdk.data.api.helper.EntityIdBoundaries;
import com.bullhornsdk.data.api.helper.EntityUpdateWorker;
import com.bullhornsdk.data.api.helper.FileWorker;
@@ -109,7 +77,6 @@
import com.bullhornsdk.data.model.response.file.FileWrapper;
import com.bullhornsdk.data.model.response.file.standard.StandardEntityMetaFiles;
import com.bullhornsdk.data.model.response.file.standard.StandardFileApiResponse;
-import com.bullhornsdk.data.model.response.file.standard.StandardFileContent;
import com.bullhornsdk.data.model.response.file.standard.StandardFileWrapper;
import com.bullhornsdk.data.model.response.list.FastFindListWrapper;
import com.bullhornsdk.data.model.response.list.IdListWrapper;
@@ -121,10 +88,42 @@
import com.bullhornsdk.data.model.response.resume.ParsedResumeAsEntity;
import com.bullhornsdk.data.model.response.resume.standard.StandardParsedResume;
import com.bullhornsdk.data.model.response.resume.standard.StandardParsedResumeAsEntity;
+import com.bullhornsdk.data.model.response.single.StandardFileContentWrapper;
import com.bullhornsdk.data.model.response.subscribe.SubscribeToEventsResponse;
import com.bullhornsdk.data.model.response.subscribe.UnsubscribeToEventsResponse;
import com.bullhornsdk.data.model.response.subscribe.standard.StandardSubscribeToEventsResponse;
import com.bullhornsdk.data.model.response.subscribe.standard.StandardUnsubscribeToEventsResponse;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.util.MultiValueMap;
+import org.springframework.web.client.HttpStatusCodeException;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.stream.Collectors;
/**
* Standard implementation of the BullhornData interface that manages all rest calls and data binding from/to json - java.
@@ -152,6 +151,8 @@ public class StandardBullhornData implements BullhornData {
protected final String restUrl;
+ protected final String uniqueCallId;
+
protected final RestJsonConverter restJsonConverter;
protected final RestUrlFactory restUrlFactory;
@@ -177,18 +178,18 @@ public class StandardBullhornData implements BullhornData {
protected Boolean executeFormTriggers = false;
public StandardBullhornData(BullhornRestCredentials bullhornRestCredentials) {
- this.restSession = new RestApiSession(bullhornRestCredentials);
- this.restTemplate = RestTemplateFactory.getInstance();
- this.restUrl = restSession.getRestUrl();
- this.restJsonConverter = new RestJsonConverter();
- this.restUrlFactory = new RestUrlFactory(restUrl);
- this.restFileManager = new RestFileManager();
- this.restUriVariablesFactory = new RestUriVariablesFactory(this, this.restFileManager);
- this.restErrorHandler = new RestErrorHandler();
- this.concurrencyService = new RestConcurrencyService();
+ this(new RestApiSession(bullhornRestCredentials), null);
}
public StandardBullhornData(RestApiSession restApiSession) {
+ this(restApiSession, null);
+ }
+
+ public StandardBullhornData(BullhornRestCredentials bullhornRestCredentials, String uniqueCallIdPrefix) {
+ this(new RestApiSession(bullhornRestCredentials), uniqueCallIdPrefix);
+ }
+
+ public StandardBullhornData(RestApiSession restApiSession, String uniqueCallIdPrefix) {
this.restSession = restApiSession;
this.restTemplate = RestTemplateFactory.getInstance();
this.restUrl = restSession.getRestUrl();
@@ -198,6 +199,11 @@ public StandardBullhornData(RestApiSession restApiSession) {
this.restUriVariablesFactory = new RestUriVariablesFactory(this, this.restFileManager);
this.restErrorHandler = new RestErrorHandler();
this.concurrencyService = new RestConcurrencyService();
+ if (StringUtils.isNotBlank(uniqueCallIdPrefix)) {
+ this.uniqueCallId = uniqueCallIdPrefix + "_" + UUID.randomUUID();
+ } else {
+ this.uniqueCallId = "CUSTOM_" + UUID.randomUUID();
+ }
}
public void setHttpRequestConnectTimeout(int connectTimeout) {
@@ -826,6 +832,14 @@ protected void setStart(AssociationParams params, int numberOfRecordsPulledAlrea
params.setStart(numberOfRecordsPulledAlready);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getUniqueCallId() {
+ return this.uniqueCallId;
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/src/main/java/com/bullhornsdk/data/api/helper/RestUriVariablesFactory.java b/src/main/java/com/bullhornsdk/data/api/helper/RestUriVariablesFactory.java
index 0f770c60..4cd1515c 100644
--- a/src/main/java/com/bullhornsdk/data/api/helper/RestUriVariablesFactory.java
+++ b/src/main/java/com/bullhornsdk/data/api/helper/RestUriVariablesFactory.java
@@ -61,6 +61,7 @@ public class RestUriVariablesFactory {
private static final String SETTINGS = "settings";
private static final String SUBSCRIPTION_ID = "subscriptionId";
private static final String WHERE = "where";
+ private static final String UNIQUE_CALL_ID = "uniqueCallId";
public RestUriVariablesFactory(BullhornData bullhornApiRest, RestFileManager restFileManager) {
super();
@@ -102,8 +103,8 @@ public Map getUriVariablesForMeta(BullhornEntityInfo entityInfo,
public Map getUriVariablesForMeta(String entityType, MetaParameter metaParameter, Set fieldSet, Integer privateLabelId) {
Map uriVariables = new LinkedHashMap();
- String bhRestToken = bullhornApiRest.getBhRestToken();
- uriVariables.put(BH_REST_TOKEN, bhRestToken);
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
+ uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
uriVariables.put(ENTITY_TYPE, entityType);
try {
@@ -282,6 +283,7 @@ public Map getUriVariablesForIdSearch(BullhornEntityInfo entityI
uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
uriVariables.put(ENTITY_TYPE, entityInfo.getName());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(QUERY, query);
return uriVariables;
@@ -301,9 +303,8 @@ public Map getUriVariablesForResumeFileParse(ResumeFileParsePara
}
Map uriVariables = params.getParameterMap();
-
- String bhRestToken = bullhornApiRest.getBhRestToken();
- uriVariables.put(BH_REST_TOKEN, bhRestToken);
+ uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(FORMAT, restFileManager.getFileParam(resume));
return uriVariables;
}
@@ -325,6 +326,7 @@ public Map getUriVariablesForResumeAsNewCandidate(ResumeAsNewEnt
String bhRestToken = bullhornApiRest.getBhRestToken();
uriVariables.put(BH_REST_TOKEN, bhRestToken);
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(FORMAT, restFileManager.getFileParam(resume));
return uriVariables;
}
@@ -343,8 +345,8 @@ public Map getUriVariablesForResumeTextParse(ResumeTextParsePara
Map uriVariables = params.getParameterMap();
- String bhRestToken = bullhornApiRest.getBhRestToken();
- uriVariables.put(BH_REST_TOKEN, bhRestToken);
+ uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
return uriVariables;
}
@@ -357,9 +359,9 @@ public Map getUriVariablesForResumeTextParse(ResumeTextParsePara
* @return
*/
public Map getUriVariablesForGetFile(BullhornEntityInfo entityInfo, Integer entityId, Integer fileId) {
- Map uriVariables = new LinkedHashMap();
- String bhRestToken = bullhornApiRest.getBhRestToken();
- uriVariables.put(BH_REST_TOKEN, bhRestToken);
+ Map uriVariables = new LinkedHashMap<>();
+ uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(ENTITY_TYPE, entityInfo.getName());
uriVariables.put(ENTITY_ID, entityId.toString());
uriVariables.put(FILE_ID, fileId.toString());
@@ -374,9 +376,9 @@ public Map getUriVariablesForGetFile(BullhornEntityInfo entityIn
* @return
*/
public Map getUriVariablesForGetEntityMetaFiles(BullhornEntityInfo entityInfo, Integer entityId) {
- Map uriVariables = new LinkedHashMap();
- String bhRestToken = bullhornApiRest.getBhRestToken();
- uriVariables.put(BH_REST_TOKEN, bhRestToken);
+ Map uriVariables = new LinkedHashMap<>();
+ uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(ENTITY_TYPE, entityInfo.getName());
uriVariables.put(ENTITY_ID, entityId.toString());
@@ -399,8 +401,8 @@ public Map getUriVariablesForAddFile(BullhornEntityInfo entityIn
Map uriVariables = params.getParameterMap();
- String bhRestToken = bullhornApiRest.getBhRestToken();
- uriVariables.put(BH_REST_TOKEN, bhRestToken);
+ uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(EXTERNAL_ID, externalId);
uriVariables.put(ENTITY_TYPE, entityInfo.getName());
uriVariables.put(ENTITY_ID, entityId.toString());
@@ -418,8 +420,8 @@ public Map getUriVariablesForAddFile(BullhornEntityInfo entityIn
public Map getUriVariablesForAddFile(BullhornEntityInfo entityInfo, Integer entityId, FileMeta fileMeta) {
Map uriVariables = fileMeta.getParameterMap();
- String bhRestToken = bullhornApiRest.getBhRestToken();
- uriVariables.put(BH_REST_TOKEN, bhRestToken);
+ uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(ENTITY_TYPE, entityInfo.getName());
uriVariables.put(ENTITY_ID, entityId.toString());
@@ -439,9 +441,10 @@ public Map getUriVariablesForAddFile(BullhornEntityInfo entityIn
* @return
*/
public Map getUriVariablesDeleteFile(BullhornEntityInfo entityInfo, Integer entityId, Integer fileId) {
- Map uriVariables = new LinkedHashMap();
- String bhRestToken = bullhornApiRest.getBhRestToken();
- uriVariables.put(BH_REST_TOKEN, bhRestToken);
+ Map uriVariables = new LinkedHashMap<>();
+
+ uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(ENTITY_TYPE, entityInfo.getName());
uriVariables.put(ENTITY_ID, entityId.toString());
uriVariables.put(FILE_ID, fileId.toString());
@@ -450,9 +453,10 @@ public Map getUriVariablesDeleteFile(BullhornEntityInfo entityIn
public Map getUriVariablesForAssociateWithEntity(BullhornEntityInfo entityInfo,
Integer entityId, AssociationField associationName, Set associationIds) {
- Map uriVariables = new LinkedHashMap();
- String bhRestToken = bullhornApiRest.getBhRestToken();
- uriVariables.put(BH_REST_TOKEN, bhRestToken);
+ Map uriVariables = new LinkedHashMap<>();
+
+ uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(ENTITY_TYPE, entityInfo.getName());
uriVariables.put(ENTITY_ID, entityId.toString());
uriVariables.put(ACCOCIATION_NAME, associationName.getAssociationFieldName());
@@ -488,8 +492,8 @@ public Map getUriVariablesForCorpNotes(Integer clientCorporation
Map uriVariables = params.getParameterMap();
- String bhRestToken = bullhornApiRest.getBhRestToken();
- uriVariables.put(BH_REST_TOKEN, bhRestToken);
+ uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
String fields = this.convertFieldSetToString(fieldSet);
uriVariables.put(FIELDS, fields);
uriVariables.put(CLIENT_CORP_ID, clientCorporationID.toString());
@@ -504,9 +508,9 @@ public Map getUriVariablesForCorpNotes(Integer clientCorporation
* @param entityInfo
*/
public void addCommonUriVariables(Set fieldSet, BullhornEntityInfo entityInfo, Map uriVariables) {
- String bhRestToken = bullhornApiRest.getBhRestToken();
String fields = convertFieldSetToString(fieldSet);
- uriVariables.put(BH_REST_TOKEN, bhRestToken);
+ uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(FIELDS, fields);
uriVariables.put(ENTITY_TYPE, entityInfo.getName());
}
@@ -520,8 +524,8 @@ public void addCommonUriVariables(Set fieldSet, BullhornEntityInfo entit
* @param entityInfo The bullhorn entity that is being modified by this call
*/
private void addModifyingUriVariables(Map uriVariables, BullhornEntityInfo entityInfo) {
- String bhRestToken = bullhornApiRest.getBhRestToken();
- uriVariables.put(BH_REST_TOKEN, bhRestToken);
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
+ uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
uriVariables.put(ENTITY_TYPE, entityInfo.getName());
uriVariables.put(EXECUTE_FORM_TRIGGERS, bullhornApiRest.getExecuteFormTriggers() ? "true" : "false");
}
@@ -559,6 +563,7 @@ public Map getUriVariablesForFastFind(String query, FastFindPara
Map uriVariables = params.getParameterMap();
uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(QUERY, query);
return uriVariables;
@@ -569,6 +574,7 @@ public Map getUriVariablesForSettings(Set settingSet, Se
Map uriVariables = params.getParameterMap();
uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
try {
uriVariables.put(SETTINGS, convertFieldSetToString(settingSet));
@@ -584,6 +590,7 @@ public Map getUriVariablesForGetLastRequestId(String subscriptio
Map uriVariables = new LinkedHashMap();
uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(SUBSCRIPTION_ID, subscriptionId);
return uriVariables;
@@ -594,6 +601,7 @@ public Map getUriVariablesForGetEvents(String subscriptionId, In
Map uriVariables = new LinkedHashMap();
uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(MAX_EVENTS, maxEvents.toString());
uriVariables.put(SUBSCRIPTION_ID, subscriptionId);
@@ -605,6 +613,7 @@ public Map getUriVariablesForRegetEvents(String subscriptionId,
Map uriVariables = new LinkedHashMap();
uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(REQUEST_ID, requestId.toString());
uriVariables.put(SUBSCRIPTION_ID, subscriptionId);
@@ -636,6 +645,7 @@ public Map getUriVariablesForSubscribeToEvents(String subscripti
List entityEventTypes){
Map uriVariables = new LinkedHashMap<>();
uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(SUBSCRIPTION_ID, subscriptionId);
uriVariables.put("type", eventType.typeValue());
if (EventType.ENTITY == eventType && entityClasses != null){
@@ -649,6 +659,7 @@ public Map getUriVariablesForSubscribeToEvents(String subscripti
public Map getUriVariablesForUnsubscribeToEvents(String subscriptionId){
Map uriVariables = new LinkedHashMap<>();
uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(SUBSCRIPTION_ID, subscriptionId);
return uriVariables;
}
@@ -659,6 +670,7 @@ public Map getUriVariablesForOptions(BullhornEntityInfo entityIn
}
Map uriVariables = params.getParameterMap();
uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(ENTITY_TYPE, entityInfo.getName());
return uriVariables;
}
@@ -669,6 +681,7 @@ public Map getUriVariablesForOptionsWithIds(BullhornEntityInfo e
}
Map uriVariables = params.getParameterMap();
uriVariables.put(BH_REST_TOKEN, bullhornApiRest.getBhRestToken());
+ uriVariables.put(UNIQUE_CALL_ID, bullhornApiRest.getUniqueCallId());
uriVariables.put(ENTITY_TYPE, entityInfo.getName());
uriVariables.put(OPTIONS_IDS, StringUtils.join(optionsIds, ","));
return uriVariables;
diff --git a/src/main/java/com/bullhornsdk/data/api/helper/RestUrlFactory.java b/src/main/java/com/bullhornsdk/data/api/helper/RestUrlFactory.java
index 5a34ae32..52be4548 100644
--- a/src/main/java/com/bullhornsdk/data/api/helper/RestUrlFactory.java
+++ b/src/main/java/com/bullhornsdk/data/api/helper/RestUrlFactory.java
@@ -27,7 +27,8 @@ public RestUrlFactory(String restUrl) {
*/
public String assembleEntityUrl(EntityParams params) {
- return restUrl + "entity/{entityType}/{id}?fields={fields}&BhRestToken={bhRestToken}" + params.getUrlString();
+ return restUrl + "entity/{entityType}/{id}?fields={fields}&BhRestToken={bhRestToken}" +
+ "&uniqueCallId={uniqueCallId}" + params.getUrlString();
}
/**
@@ -36,7 +37,8 @@ public String assembleEntityUrl(EntityParams params) {
* @return
*/
public String assembleEntityDeleteUrl() {
- return restUrl + "entity/{entityType}/{id}?BhRestToken={bhRestToken}&executeFormTriggers={executeFormTriggers}";
+ return restUrl + "entity/{entityType}/{id}?BhRestToken={bhRestToken}&executeFormTriggers={executeFormTriggers}" +
+ "&uniqueCallId={uniqueCallId}";
}
/**
@@ -45,7 +47,8 @@ public String assembleEntityDeleteUrl() {
* @return
*/
public String assembleEntityUrlForUpdate() {
- return restUrl + "entity/{entityType}/{id}?BhRestToken={bhRestToken}&executeFormTriggers={executeFormTriggers}";
+ return restUrl + "entity/{entityType}/{id}?BhRestToken={bhRestToken}&executeFormTriggers={executeFormTriggers}" +
+ "&uniqueCallId={uniqueCallId}";
}
/**
@@ -54,7 +57,8 @@ public String assembleEntityUrlForUpdate() {
* @return
*/
public String assembleEntityUrlForInsert() {
- return restUrl + "entity/{entityType}?BhRestToken={bhRestToken}&executeFormTriggers={executeFormTriggers}";
+ return restUrl + "entity/{entityType}?BhRestToken={bhRestToken}&executeFormTriggers={executeFormTriggers}" +
+ "&uniqueCallId={uniqueCallId}";
}
/**
@@ -65,7 +69,8 @@ public String assembleEntityUrlForInsert() {
* @return the full url to use in the api call with {fieldName} type placeholders for the uriVariables
*/
public String assembleQueryUrl(QueryParams params) {
- return restUrl + "query/{entityType}?where={where}&fields={fields}&BhRestToken={bhRestToken}" + params.getUrlString();
+ return restUrl + "query/{entityType}?where={where}&fields={fields}&BhRestToken={bhRestToken}" +
+ "&uniqueCallId={uniqueCallId}" + params.getUrlString();
}
/**
@@ -76,7 +81,8 @@ public String assembleQueryUrl(QueryParams params) {
* @return the full url to use in the api call with {fieldName} type placeholders for the uriVariables
*/
public String assembleQueryUrlWithPost(QueryParams params) {
- return restUrl + "query/{entityType}?fields={fields}&BhRestToken={bhRestToken}" + params.getUrlString();
+ return restUrl + "query/{entityType}?fields={fields}&BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}"
+ + params.getUrlString();
}
/**
@@ -87,7 +93,8 @@ public String assembleQueryUrlWithPost(QueryParams params) {
* @return the full url to use in the api call with {fieldName} type placeholders for the uriVariables
*/
public String assembleSearchUrl(SearchParams params) {
- return restUrl + "search/{entityType}?query={query}&fields={fields}&BhRestToken={bhRestToken}" + params.getUrlString();
+ return restUrl + "search/{entityType}?query={query}&fields={fields}&BhRestToken={bhRestToken}" +
+ "&uniqueCallId={uniqueCallId}" + params.getUrlString();
}
/**
@@ -98,7 +105,8 @@ public String assembleSearchUrl(SearchParams params) {
* @return the full url to use in the api call with {fieldName} type placeholders for the uriVariables
*/
public String assembleSearchUrlWithPost(SearchParams params) {
- return restUrl + "search/{entityType}?fields={fields}&BhRestToken={bhRestToken}" + params.getUrlString();
+ return restUrl + "search/{entityType}?fields={fields}&BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}"
+ + params.getUrlString();
}
/**
@@ -110,7 +118,8 @@ public String assembleSearchUrlWithPost(SearchParams params) {
*/
public static String assembleIdSearchUrl(String restUrl,
SearchParams params) {
- return restUrl + "search/{entityType}?query={query}&BhRestToken={bhRestToken}" + params.getUrlString();
+ return restUrl + "search/{entityType}?query={query}&BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}"
+ + params.getUrlString();
}
/**
@@ -120,10 +129,12 @@ public static String assembleIdSearchUrl(String restUrl,
*/
public String assembleEntityUrlForMeta(Integer privateLabelId) {
if(privateLabelId == null) {
- return restUrl + "meta/{entityType}?fields={fields}&BhRestToken={bhRestToken}&meta={meta}";
+ return restUrl + "meta/{entityType}?fields={fields}&BhRestToken={bhRestToken}&meta={meta}" +
+ "&uniqueCallId={uniqueCallId}";
}
- return restUrl + "meta/{entityType}?fields={fields}&BhRestToken={bhRestToken}&meta={meta}&privateLabelId={privateLabelId}";
+ return restUrl + "meta/{entityType}?fields={fields}&BhRestToken={bhRestToken}&meta={meta}&privateLabelId={privateLabelId}" +
+ "&uniqueCallId={uniqueCallId}";
}
/**
@@ -133,7 +144,8 @@ public String assembleEntityUrlForMeta(Integer privateLabelId) {
* @return
*/
public String assembleParseResumeFileUrl(ResumeFileParseParams params) {
- return restUrl + "resume/parseToCandidate?format={format}&BhRestToken={bhRestToken}" + params.getUrlString();
+ return restUrl + "resume/parseToCandidate?format={format}&BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}"
+ + params.getUrlString();
}
/**
@@ -143,7 +155,8 @@ public String assembleParseResumeFileUrl(ResumeFileParseParams params) {
* @return
*/
public String assembleParseResumeAsNewEntityUrl(ResumeAsNewEntityParams params) {
- return restUrl + "services/ParseAs/newEntity?format={format}&BhRestToken={bhRestToken}" + params.getUrlString();
+ return restUrl + "services/ParseAs/newEntity?format={format}&BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}"
+ + params.getUrlString();
}
/**
@@ -153,7 +166,8 @@ public String assembleParseResumeAsNewEntityUrl(ResumeAsNewEntityParams params)
* @return
*/
public String assembleParseResumeTextUrl(ResumeTextParseParams params) {
- return restUrl + "resume/parseToCandidateViaJson?BhRestToken={bhRestToken}" + params.getUrlString();
+ return restUrl + "resume/parseToCandidateViaJson?BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}"
+ + params.getUrlString();
}
/**
@@ -163,7 +177,7 @@ public String assembleParseResumeTextUrl(ResumeTextParseParams params) {
*/
public String assemblePutFileUrl() {
- return restUrl + "file/{entityType}/{entityId}?BhRestToken={bhRestToken}";
+ return restUrl + "file/{entityType}/{entityId}?BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}";
}
/**
@@ -173,7 +187,7 @@ public String assemblePutFileUrl() {
*/
public String assembleGetFileUrl() {
- return restUrl + "file/{entityType}/{entityId}/{fileId}?BhRestToken={bhRestToken}";
+ return restUrl + "file/{entityType}/{entityId}/{fileId}?BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}";
}
/**
@@ -182,7 +196,7 @@ public String assembleGetFileUrl() {
* @return
*/
public String assembleGetEntityMetaFilesUrl() {
- return restUrl + "entityFiles/{entityType}/{entityId}?BhRestToken={bhRestToken}";
+ return restUrl + "entityFiles/{entityType}/{entityId}?BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}";
}
/**
@@ -192,7 +206,8 @@ public String assembleGetEntityMetaFilesUrl() {
* @return
*/
public String assembleAddFileUrl(FileParams params) {
- return restUrl + "file/{entityType}/{entityId}/raw?BhRestToken={bhRestToken}&externalID={externalID}"
+ return restUrl + "file/{entityType}/{entityId}/raw?BhRestToken={bhRestToken}&externalID={externalID}" +
+ "&uniqueCallId={uniqueCallId}"
+ params.getUrlString();
}
@@ -203,7 +218,7 @@ public String assembleAddFileUrl(FileParams params) {
* @return
*/
public String assembleAddFileUrl(FileMeta fileMeta) {
- return restUrl + "file/{entityType}/{entityId}/raw?BhRestToken={bhRestToken}"
+ return restUrl + "file/{entityType}/{entityId}/raw?BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}"
+ fileMeta.getUrlString();
}
@@ -213,28 +228,32 @@ public String assembleAddFileUrl(FileMeta fileMeta) {
* @return
*/
public String assembleDeleteFileUrl() {
- return restUrl + "file/{entityType}/{entityId}/{fileId}?BhRestToken={bhRestToken}";
+ return restUrl + "file/{entityType}/{entityId}/{fileId}?BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}";
}
public String assembleEntityUrlForAssociateWithEntity() {
- return restUrl + "entity/{entityType}/{entityId}/{associationName}/{associationIds}?BhRestToken={bhRestToken}";
+ return restUrl + "entity/{entityType}/{entityId}/{associationName}/{associationIds}?BhRestToken={bhRestToken}" +
+ "&uniqueCallId={uniqueCallId}";
}
public String assembleGetLastRequstIdUrl() {
- return restUrl+"event/subscription/{subscriptionId}/lastRequestId?BhRestToken={bhRestToken}";
+ return restUrl+"event/subscription/{subscriptionId}/lastRequestId?BhRestToken={bhRestToken}" +
+ "&uniqueCallId={uniqueCallId}";
}
public String assembleGetEventsUrl() {
- return restUrl+"event/subscription/{subscriptionId}?maxEvents={maxEvents}&BhRestToken={bhRestToken}";
+ return restUrl+"event/subscription/{subscriptionId}?maxEvents={maxEvents}&BhRestToken={bhRestToken}" +
+ "&uniqueCallId={uniqueCallId}";
}
public String assembleRegetEventsUrl() {
- return restUrl+"event/subscription/{subscriptionId}?requestId={requestId}&BhRestToken={bhRestToken}";
+ return restUrl+"event/subscription/{subscriptionId}?requestId={requestId}&BhRestToken={bhRestToken}" +
+ "&uniqueCallId={uniqueCallId}";
}
public String assembleGetAssociationUrl(AssociationParams params) {
- return restUrl + "entity/{entityType}/{entityId}/{associationName}?fields={fields}&BhRestToken={bhRestToken}&showTotalMatched=true"
- + params.getUrlString();
+ return restUrl + "entity/{entityType}/{entityId}/{associationName}?fields={fields}&BhRestToken={bhRestToken}" +
+ "&uniqueCallId={uniqueCallId}&showTotalMatched=true" + params.getUrlString();
}
/**
@@ -244,8 +263,8 @@ public String assembleGetAssociationUrl(AssociationParams params) {
* @return
*/
public String assembleCorpNotesUrl(CorpNotesParams params) {
- return restUrl + "allCorpNotes?fields={fields}&BhRestToken={bhRestToken}&clientCorpId={clientCorpId}"
- + params.getUrlString();
+ return restUrl + "allCorpNotes?fields={fields}&BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}" +
+ "&clientCorpId={clientCorpId}" + params.getUrlString();
}
/**
@@ -256,24 +275,25 @@ public String assembleCorpNotesUrl(CorpNotesParams params) {
* @return the full url to use in the api call with {fieldName} type placeholders for the uriVariables
*/
public String assembleFastFindUrl(FastFindParams params) {
- return restUrl + "find?query={query}&BhRestToken={bhRestToken}" + params.getUrlString();
+ return restUrl + "find?query={query}&BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}" + params.getUrlString();
}
public String assembleUrlForSettings(SettingsParams params) {
- return restUrl + "settings/{settings}?BhRestToken={bhRestToken}" + params.getUrlString();
+ return restUrl + "settings/{settings}?BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}" + params.getUrlString();
}
public String assembleSubscribeToEventsUrl(boolean withNames) {
- return restUrl + "event/subscription/{subscriptionId}?type={type}&eventTypes={eventTypes}&BhRestToken={bhRestToken}"
- + (withNames ? "&names={names}" : "");
+ return restUrl + "event/subscription/{subscriptionId}?type={type}&eventTypes={eventTypes}" +
+ "&BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}" + (withNames ? "&names={names}" : "");
}
public String assembleUnsubscribeToEventsUrl(){
- return restUrl + "event/subscription/{subscriptionId}?BhRestToken={bhRestToken}";
+ return restUrl + "event/subscription/{subscriptionId}?BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}";
}
public String assembleOptionsUrl(OptionsParams params) {
- return restUrl + "options/{entityType}/{optionsIds}?BhRestToken={bhRestToken}"+ params.getUrlString();
+ return restUrl + "options/{entityType}/{optionsIds}?BhRestToken={bhRestToken}&uniqueCallId={uniqueCallId}"
+ + params.getUrlString();
}
}
diff --git a/src/main/java/com/bullhornsdk/data/api/mock/MockBullhornData.groovy b/src/main/java/com/bullhornsdk/data/api/mock/MockBullhornData.groovy
index f10c1a03..33f03583 100644
--- a/src/main/java/com/bullhornsdk/data/api/mock/MockBullhornData.groovy
+++ b/src/main/java/com/bullhornsdk/data/api/mock/MockBullhornData.groovy
@@ -241,6 +241,11 @@ public class MockBullhornData implements BullhornData {
return mockDataHandler.getSettingsObjectData(settingSet);
}
+ @Override
+ public String getUniqueCallId() {
+ return "mock-unique-call-id";
+ }
+
@Override
public String getBhRestToken() {
return "mock-bh-rest-token";
diff --git a/src/main/java/com/bullhornsdk/data/model/parameter/RequestParameters.java b/src/main/java/com/bullhornsdk/data/model/parameter/RequestParameters.java
index c5fc9855..f41a2dfa 100644
--- a/src/main/java/com/bullhornsdk/data/model/parameter/RequestParameters.java
+++ b/src/main/java/com/bullhornsdk/data/model/parameter/RequestParameters.java
@@ -4,26 +4,25 @@
/**
* Represents a type of parameter used for api calls.
- *
+ *
* @author magnus.palm
- *
+ *
*/
-
public interface RequestParameters {
/**
* Returns a url String in the format &fieldName1={fieldName1}&fieldName2={fieldName2}. Fields that are null will not be
* included in the url string.
- *
+ *
* @return
*/
public String getUrlString();
/**
* Returns parameters needed for this particular api call.
- *
+ *
* Adds the parameters to a map in format key:value = fieldName:fieldValue and returns that map.
- *
+ *
* @return
*/
public Map getParameterMap();
diff --git a/src/main/java/com/bullhornsdk/data/model/parameter/standard/StandardEntityParams.java b/src/main/java/com/bullhornsdk/data/model/parameter/standard/StandardEntityParams.java
index 5858abb8..11f07510 100644
--- a/src/main/java/com/bullhornsdk/data/model/parameter/standard/StandardEntityParams.java
+++ b/src/main/java/com/bullhornsdk/data/model/parameter/standard/StandardEntityParams.java
@@ -1,17 +1,16 @@
package com.bullhornsdk.data.model.parameter.standard;
+import com.bullhornsdk.data.model.parameter.EntityParams;
+
import java.util.LinkedHashMap;
import java.util.Map;
-import com.bullhornsdk.data.model.parameter.EntityParams;
-
public class StandardEntityParams implements EntityParams {
private boolean showEditable;
private StandardEntityParams() {
super();
-
this.showEditable = false;
}
@@ -20,17 +19,16 @@ public static StandardEntityParams getInstance() {
return params;
}
-
+
public void setShowEditable(boolean showEditable) {
this.showEditable = showEditable;
-
}
@Override
public String getUrlString() {
StringBuilder url = new StringBuilder();
- if (showEditable != false) {
+ if (showEditable) {
url.append("&showEditable={showEditable}");
}
@@ -41,8 +39,8 @@ public String getUrlString() {
public Map getParameterMap() {
Map uriVariables = new LinkedHashMap();
- if (showEditable != false) {
- uriVariables.put("showEditable", "" + showEditable);
+ if (showEditable) {
+ uriVariables.put("showEditable", "" + true);
}
return uriVariables;