Skip to content

Commit

Permalink
Merge pull request #29 from TAMULib/bound-with-workaround
Browse files Browse the repository at this point in the history
[28] Add workaround for folio boundwith holdings
  • Loading branch information
jsavell authored Nov 16, 2021
2 parents f766c68 + 359ccdc commit 548b9ae
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/java/edu/tamu/app/service/GetItForMeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public class GetItForMeService {
@Value("${app.buttons.locationsOverride:#{null}}")
private String[] locationsOverride;

@Value("${app.boundWith.locations}")
private String boundWithLocations;

@Autowired
Environment environment;

Expand Down Expand Up @@ -225,6 +228,23 @@ public Map<String,ButtonPresentation> getButtonDataByBibId(String catalogName, S
// users can see that the MFHD was tested
presentableHoldings.put(holding.getMfhd(), null);
List<Map<String,String>> holdingButtons = new ArrayList<Map<String, String>>();

//temporary workaround for FOLIO 'boundwith' records whose holdings have 0 items
//we'll fake an item with the properties we want
if (catalogName.equals("folio") && holding.getCatalogItems().size() == 0 && this.boundWithLocations.length() > 0) {
List<String> boundWithLocationsList = Arrays.asList(this.boundWithLocations.split(";"));
if (boundWithLocationsList.contains(holding.getFallbackLocationCode())) {
logger.debug("Using BoundWith override");
HashMap<String,String> syntheticItem = new HashMap<String,String>();
syntheticItem.put("hrid", "bound-with-item");
syntheticItem.put("status", "Available");
syntheticItem.put("typeDesc", "normal");
HashMap<String,Map<String,String>> syntheticItemsMap = new HashMap<String,Map<String,String>>();
syntheticItemsMap.put(syntheticItem.get("hrid"), syntheticItem);
holding.setCatalogItems(syntheticItemsMap);
}
}

//Path 1: if the holding has no items, check for an itemless button
if (holding.getCatalogItems().size() == 0) {
for (GetItForMeButton button : this.getRegisteredButtons(catalogName)) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ app.defaultButton.text: Get It: 4 days
app.defaultButton.action: https://getitforme.library.tamu.edu/illiad/EvansLocal/openurl.asp
app.defaultButton.threshold: 200
################################################################
################################################################
# Configuration for FOLIO Bound With workaround
app.boundWith.locations: stk;blcc,stk;BookStacks;psel,stk

################################################################
# Configuration for the buttons kill switch
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ app.defaultButton.text: Get It: 4 days
app.defaultButton.action: https://getitforme.library.tamu.edu/illiad/EvansLocal/openurl.asp
app.defaultButton.threshold: 200
################################################################
################################################################
# Configuration for FOLIO Bound With workaround
app.boundWith.locations: stk;blcc,stk;BookStacks;psel,stk

################################################################
# Configuration for the buttons kill switch
Expand Down

0 comments on commit 548b9ae

Please sign in to comment.