Skip to content

Commit

Permalink
Add effectiveOn support (#461)
Browse files Browse the repository at this point in the history
* Add effectiveOn support

* Return access level to private
  • Loading branch information
scriptom authored Jul 29, 2024
1 parent 640c7f3 commit 7c20c9a
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 34 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.bullhorn</groupId>
<artifactId>sdk-rest</artifactId>
<version>2.3.11</version>
<version>2.3.12</version>
<packaging>jar</packaging>

<name>Bullhorn REST SDK</name>
Expand Down
46 changes: 24 additions & 22 deletions src/main/java/com/bullhornsdk/data/api/BullhornData.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,7 @@
import com.bullhornsdk.data.model.enums.MetaParameter;
import com.bullhornsdk.data.model.enums.SettingsFields;
import com.bullhornsdk.data.model.file.FileMeta;
import com.bullhornsdk.data.model.parameter.AssociationParams;
import com.bullhornsdk.data.model.parameter.CorpNotesParams;
import com.bullhornsdk.data.model.parameter.FastFindParams;
import com.bullhornsdk.data.model.parameter.FileParams;
import com.bullhornsdk.data.model.parameter.OptionsParams;
import com.bullhornsdk.data.model.parameter.QueryParams;
import com.bullhornsdk.data.model.parameter.ResumeAsNewEntityParams;
import com.bullhornsdk.data.model.parameter.ResumeFileParseParams;
import com.bullhornsdk.data.model.parameter.ResumeTextParseParams;
import com.bullhornsdk.data.model.parameter.SearchParams;
import com.bullhornsdk.data.model.parameter.SettingsParams;
import com.bullhornsdk.data.model.parameter.*;
import com.bullhornsdk.data.model.parameter.standard.ParamFactory;
import com.bullhornsdk.data.model.response.crud.CrudResponse;
import com.bullhornsdk.data.model.response.edithistory.EditHistoryListWrapper;
Expand Down Expand Up @@ -73,19 +63,31 @@ public interface BullhornData {
*/
public <T extends BullhornEntity, L extends ListWrapper<T>> L findMultipleEntity(Class<T> type, Set<Integer> idList, Set<String> fieldSet);

/**
* Returns the entity of passed in type with the passed in id, fields to get are specifed by the fieldSet.
*
* @param type type of BullhornEntity
* @param id id of BullhornEntity
* @param fieldSet fields to query for
*
* @throws RestApiException when the api call fails
/**
* Returns the entity of passed in type with the passed in id, fields to get are specifed by the fieldSet.
*
* @return an entity of type T, or null if an error occurred
*/
public <T extends BullhornEntity> T findEntity(Class<T> type, Integer id, Set<String> fieldSet);
* @param type type of BullhornEntity
* @param id id of BullhornEntity
* @param fieldSet fields to query for
* @return an entity of type T, or null if an error occurred
* @throws RestApiException when the api call fails
*/
public default <T extends BullhornEntity> T findEntity(Class<T> type, Integer id, Set<String> fieldSet) {
return findEntity(type, id, fieldSet, ParamFactory.entityParams());
}

/**
* Returns the entity of passed in type with the passed in id, fields to get are specifed by the fieldSet.
*
* @param type type of BullhornEntity
* @param id id of BullhornEntity
* @param fieldSet fields to query for
* @param entityParams extra parameters for query
* @throws RestApiException when the api call fails
*
* @return an entity of type T, or null if an error occurred
*/
public <T extends BullhornEntity> T findEntity(Class<T> type, Integer id, Set<String> fieldSet, EntityParams entityParams);
/**
* Queries for QueryEntity of type T and returns a List<T>.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ public void setHttpRequestReadTimeout(int readTimeout) {
* {@inheritDoc}
*/
@Override
public <T extends BullhornEntity> T findEntity(Class<T> type, Integer id, Set<String> fieldSet) {
return this.handleGetEntity(type, id, fieldSet, ParamFactory.entityParams());
public <T extends BullhornEntity> T findEntity(Class<T> type, Integer id, Set<String> fieldSet, EntityParams entityParams) {
return this.handleGetEntity(type, id, fieldSet, entityParams);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class MockBullhornData implements BullhornData {
}

@Override
public <T extends BullhornEntity> T findEntity(Class<T> type, Integer id, Set<String> fieldSet) {
public <T extends BullhornEntity> T findEntity(Class<T> type, Integer id, Set<String> fieldSet, EntityParams entityParams) {
return mockDataHandler.findEntity(type, id, fieldSet);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,40 @@
package com.bullhornsdk.data.model.parameter;

import java.time.LocalDate;

/**
* Optional parameters for the "entity" api call.
*
*
* @author magnus.palm
*
*/
public interface EntityParams extends RequestParameters {

/**
* Returns whether to show the _editable field in responses.
*
* @return the flag value
*/
Boolean getShowEditable();

/**
* Whether to show the _editable field in responses. The _editable field indicates whether an entity is editable.
* Setting showEditable to true results in slower performance; use this setting sparingly and only when needed.
*
* @param showEditable the flag value
*/
void setShowEditable(Boolean showEditable);

/**
* Returns the date limitation query on an effective-dated entity.
*
* @return The date limit
*/
LocalDate getEffectiveOn();

/**
* Limit the request to a specific date. Only works on <a href=https://bullhorn.github.io/rest-api-docs/index.html#effective-dated-entity>Effective-Dated entities</a>
*
* @param effectiveOn The date limitation
*/
void setEffectiveOn(LocalDate effectiveOn);
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package com.bullhornsdk.data.model.parameter.standard;

import com.bullhornsdk.data.model.parameter.EntityParams;
import lombok.Data;

import java.time.LocalDate;
import java.util.LinkedHashMap;
import java.util.Map;

@Data
public class StandardEntityParams implements EntityParams {

private boolean showEditable;
private Boolean showEditable;
private LocalDate effectiveOn;

private StandardEntityParams() {
super();
Expand All @@ -19,11 +23,6 @@ public static StandardEntityParams getInstance() {
return params;
}


public void setShowEditable(boolean showEditable) {
this.showEditable = showEditable;
}

@Override
public String getUrlString() {
StringBuilder url = new StringBuilder();
Expand All @@ -32,6 +31,10 @@ public String getUrlString() {
url.append("&showEditable={showEditable}");
}

if (effectiveOn != null) {
url.append("&effectiveOn={effectiveOn}");
}

return url.toString();
}

Expand All @@ -43,6 +46,10 @@ public Map<String, String> getParameterMap() {
uriVariables.put("showEditable", "" + true);
}

if (effectiveOn != null) {
uriVariables.put("effectiveOn", effectiveOn.toString());
}

return uriVariables;
}

Expand Down

0 comments on commit 7c20c9a

Please sign in to comment.