Skip to content

Commit

Permalink
Merge pull request #177 from TAMULib/sprint9-staging
Browse files Browse the repository at this point in the history
Sprint9 staging
  • Loading branch information
jcreel committed Feb 8, 2022
2 parents cf9e0dd + 87b6cde commit 5d184d6
Show file tree
Hide file tree
Showing 13 changed files with 196 additions and 21 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>edu.tamu.weaver</groupId>
<artifactId>webservice-parent</artifactId>
<version>2.1.0</version>
<version>2.1.1-RC1</version>
</parent>

<modules>
Expand Down
2 changes: 1 addition & 1 deletion service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<dependency>
<groupId>edu.tamu.weaver</groupId>
<artifactId>core</artifactId>
<version>2.0.4</version>
<version>2.1.1-RC1</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,18 @@ public List<LoanItem> getLoanItems(String uin) throws Exception {
Iterator<JsonNode> iter = loans.elements();

Map<String, JsonNode> loanIdToPartialLoan = new HashMap<>();
Map<String, JsonNode> instanceIdToPartialLoan = new HashMap<>();
Map<String, JsonNode> itemIdToPartialLoan = new HashMap<>();
Map<String, String> instanceIdToLoanId = new HashMap<>();
Map<String, String> itemIdToLoanId = new HashMap<>();

while (iter.hasNext()) {
JsonNode partialLoan = iter.next();
String loanId = getText(partialLoan, "/id");
String instanceId = getText(partialLoan, "/item/instanceId");
String itemId = getText(partialLoan, "/item/itemId");

loanIdToPartialLoan.put(loanId, partialLoan);
instanceIdToPartialLoan.put(instanceId, partialLoan);
itemIdToPartialLoan.put(itemId, partialLoan);
instanceIdToLoanId.put(instanceId, loanId);
itemIdToLoanId.put(itemId, loanId);
}

Map<String, JsonNode> loanIdToLoan = new HashMap<>();
Expand All @@ -222,18 +223,19 @@ public List<LoanItem> getLoanItems(String uin) throws Exception {
loanIdToLoan.put(loanId, loan);
}

for (JsonNode instance : getInstances(instanceIdToPartialLoan.keySet())) {
for (JsonNode instance : getInstances(instanceIdToLoanId.keySet())) {
String instanceId = getText(instance, "/id");
instanceIdToInstance.put(instanceId, instance);
}

for (JsonNode item : getItems(itemIdToPartialLoan.keySet())) {
for (JsonNode item : getItems(itemIdToLoanId.keySet())) {
String itemId = getText(item, "/id");
itemIdToItem.put(itemId, item);
}

for (JsonNode partialLoan : instanceIdToPartialLoan.values()) {
String loanId = getText(partialLoan, "/id");
for (String loanId : itemIdToLoanId.values()) {
JsonNode partialLoan = loanIdToPartialLoan.get(loanId);

String instanceId = getText(partialLoan, "/item/instanceId");
String itemId = getText(partialLoan, "/item/itemId");

Expand All @@ -242,7 +244,6 @@ public List<LoanItem> getLoanItems(String uin) throws Exception {
JsonNode item = itemIdToItem.get(itemId);

String locationId = getText(item, "/effectiveLocation/id");

String loanPolicyName = getText(loan, "/loanPolicy/name");

JsonNode loanPolicy = getLoanPolicy(loanPolicyName);
Expand All @@ -262,7 +263,7 @@ public List<LoanItem> getLoanItems(String uin) throws Exception {

if (StringUtils.isNotEmpty(locationId)) {
JsonNode location = getLocation(locationId);
builder.location(getText(location, "/name"))
builder.location(getText(location, "/discoveryDisplayName"))
.locationCode(getText(location, "/code"));
}

Expand Down
2 changes: 1 addition & 1 deletion service/src/main/resources/catalogs/evans.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "evans",
"type": "voyager",
"baseUrl": "http://surprise.tamu.edu:7014/vxws/",
"baseUrl": "",
"sidPrefix": "libcat"
}
6 changes: 3 additions & 3 deletions service/src/main/resources/catalogs/folio.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "folio",
"type": "folio",
"baseOkapiUrl": "https://folio-okapi-q3.library.tamu.edu/",
"baseEdgeUrl": "https://folio-edge.library.tamu.edu/",
"baseOkapiUrl": "",
"baseEdgeUrl": "",
"tenant": "tamu",
"credentials": {
"username": "",
"password": ""
},
"edgeApiKey": "",
"repositoryBaseUrl": "folio-edge.library.tamu.edu",
"repositoryBaseUrl": "",
"cancelHoldReasonId": "75187e8d-e25a-47a7-89ad-23ba612338de"
}
2 changes: 1 addition & 1 deletion service/src/main/resources/catalogs/msl.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "msl",
"type": "voyager",
"baseUrl": "http://surprise.tamu.edu:7414/vxws/",
"baseUrl": "",
"sidPrefix": "chiron"
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class PatronControllerTestBase extends AbstractTestRestController {
protected static String holdRequestPayload;
protected static String servicePointPayload;
protected static String locationPayload;
protected static String locationsPayload;
protected static String loanPolicyPayload;
protected static String blUserResponsePayload;
protected static String blUserBadUUIDErrorPayload;
Expand Down Expand Up @@ -102,6 +103,7 @@ public static void setupStatic() throws IOException {
loanPayload = loadPayload("mock/response/loans/loan.json");
loansPayload = loadPayload("mock/response/loans/loans.json");
locationPayload = loadPayload("mock/response/locations/location.json");
locationsPayload = loadPayload("mock/response/locations/locations.json");
loanPolicyPayload = loadPayload("mock/response/loanPolicies/loanPolicy.json");

finesCatalogPayload = loadPayload("mock/response/catalog/fines.json");
Expand Down
8 changes: 4 additions & 4 deletions service/src/test/resources/mock/response/catalog/loans.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"title": "Philosophy of logic / [by] W. V. Quine.",
"author": "Quine, W. V. (Willard Van Orman)",
"locationCode": "stk",
"location": "Evans stk",
"location": "Evans Library Stacks",
"canRenew": true
},
{
Expand All @@ -26,7 +26,7 @@
"title": "Military economics : the interaction of power and money / Ron Smith.",
"author": "Smith, Ron, 1946 September 2-",
"locationCode": "stk",
"location": "Evans stk",
"location": "Evans Library Stacks",
"canRenew": true
},
{
Expand All @@ -41,7 +41,7 @@
"title": "Rising strong / Brené Brown.",
"author": "Brown, Brené,",
"locationCode": "stk",
"location": "Evans stk",
"location": "Evans Library Stacks",
"canRenew": true
},
{
Expand All @@ -56,7 +56,7 @@
"title": "Spam nation : the inside story of organized cybercrime--from global epidemic to your front door / Brian Krebs.",
"author": "Krebs, Brian,",
"locationCode": "stk",
"location": "Evans stk",
"location": "Evans Library Stacks",
"canRenew": true
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"source": "MARC",
"title": "Spam nation : the inside story of organized cybercrime--from global epidemic to your front door / Brian Krebs.",
"indexTitle": "Spam nation : the inside story of organized cybercrime--from global epidemic to your front door /",
"parentInstances": [],
"childInstances": [],
"alternativeTitles": [],
"isBoundWith": false,
"editions": [],
"series": [],
"identifiers": [
Expand Down Expand Up @@ -92,6 +95,7 @@
}
],
"modeOfIssuanceId": "9d18a02f-5897-4c31-9106-c9abb5c7ae8b",
"previouslyHeld" : true,
"discoverySuppress": false,
"statisticalCodeIds": [],
"statusId": "c8d51dc6-2f84-4220-8aef-3c4894d53b93",
Expand All @@ -105,6 +109,8 @@
"tagList": []
},
"natureOfContentTermIds": [],
"precedingTitles": [],
"succeedingTitles": [],
"links": {
"self": "http://folio-okapi-q3.library.tamu.edu/inventory/instances/829fecd3-67c3-3ca2-b9d4-281227690e0f"
}
Expand Down
24 changes: 24 additions & 0 deletions service/src/test/resources/mock/response/instances/instances.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"source": "MARC",
"title": "Philosophy of logic / [by] W. V. Quine.",
"indexTitle": "Philosophy of logic /",
"parentInstances": [],
"childInstances": [],
"alternativeTitles": [],
"isBoundWith": false,
"editions": [],
"series": [
"Prentice-Hall foundations of philosophy series."
Expand Down Expand Up @@ -73,6 +76,7 @@
}
],
"modeOfIssuanceId": "9d18a02f-5897-4c31-9106-c9abb5c7ae8b",
"previouslyHeld" : true,
"discoverySuppress": false,
"statisticalCodeIds": [],
"statusId": "c8d51dc6-2f84-4220-8aef-3c4894d53b93",
Expand All @@ -86,6 +90,8 @@
"tagList": []
},
"natureOfContentTermIds": [],
"precedingTitles": [],
"succeedingTitles": [],
"links": {
"self": "http://folio-okapi-q3.library.tamu.edu/inventory/instances/a0480d3f-181e-3abd-a091-288e1cfc05ab"
}
Expand All @@ -97,7 +103,10 @@
"source": "MARC",
"title": "Spam nation : the inside story of organized cybercrime--from global epidemic to your front door / Brian Krebs.",
"indexTitle": "Spam nation : the inside story of organized cybercrime--from global epidemic to your front door /",
"parentInstances": [],
"childInstances": [],
"alternativeTitles": [],
"isBoundWith": false,
"editions": [],
"series": [],
"identifiers": [
Expand Down Expand Up @@ -184,6 +193,7 @@
}
],
"modeOfIssuanceId": "9d18a02f-5897-4c31-9106-c9abb5c7ae8b",
"previouslyHeld" : true,
"discoverySuppress": false,
"statisticalCodeIds": [],
"statusId": "c8d51dc6-2f84-4220-8aef-3c4894d53b93",
Expand All @@ -197,6 +207,8 @@
"tagList": []
},
"natureOfContentTermIds": [],
"precedingTitles": [],
"succeedingTitles": [],
"links": {
"self": "http://folio-okapi-q3.library.tamu.edu/inventory/instances/829fecd3-67c3-3ca2-b9d4-281227690e0f"
}
Expand All @@ -208,7 +220,10 @@
"source": "MARC",
"title": "Military economics : the interaction of power and money / Ron Smith.",
"indexTitle": "Military economics : the interaction of power and money /",
"parentInstances": [],
"childInstances": [],
"alternativeTitles": [],
"isBoundWith": false,
"editions": [],
"series": [],
"identifiers": [
Expand Down Expand Up @@ -286,6 +301,7 @@
}
],
"modeOfIssuanceId": "9d18a02f-5897-4c31-9106-c9abb5c7ae8b",
"previouslyHeld" : true,
"discoverySuppress": false,
"statisticalCodeIds": [],
"statusId": "c8d51dc6-2f84-4220-8aef-3c4894d53b93",
Expand All @@ -299,6 +315,8 @@
"tagList": []
},
"natureOfContentTermIds": [],
"precedingTitles": [],
"succeedingTitles": [],
"links": {
"self": "http://folio-okapi-q3.library.tamu.edu/inventory/instances/f29d73fc-b4ef-3616-be63-cacf0b853c3e"
}
Expand All @@ -310,7 +328,10 @@
"source": "MARC",
"title": "Rising strong / Brené Brown.",
"indexTitle": "Rising strong /",
"parentInstances": [],
"childInstances": [],
"alternativeTitles": [],
"isBoundWith": false,
"editions": [
"First edition."
],
Expand Down Expand Up @@ -403,6 +424,7 @@
}
],
"modeOfIssuanceId": "9d18a02f-5897-4c31-9106-c9abb5c7ae8b",
"previouslyHeld" : true,
"discoverySuppress": false,
"statisticalCodeIds": [],
"statusId": "c8d51dc6-2f84-4220-8aef-3c4894d53b93",
Expand All @@ -416,6 +438,8 @@
"tagList": []
},
"natureOfContentTermIds": [],
"precedingTitles": [],
"succeedingTitles": [],
"links": {
"self": "http://folio-okapi-q3.library.tamu.edu/inventory/instances/69dd6864-4d52-387c-b5b2-8db1ce8f5013"
}
Expand Down
1 change: 1 addition & 0 deletions service/src/test/resources/mock/response/loans/loan.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"loanDate": "2017-06-01T17:03:37.000+00:00",
"dueDate": "2021-10-08T23:00:00.000+00:00",
"action": "dueDateChanged",
"actionComment" : "",
"renewalCount": 7,
"loanPolicyId": "168d255c-7f8e-4b53-a775-ae344f8ae48e",
"checkoutServicePointId": "3b80cfdf-438b-48c1-aadc-57965a0d7680",
Expand Down
4 changes: 4 additions & 0 deletions service/src/test/resources/mock/response/loans/loans.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"loanDate": "2017-06-01T17:03:37.000+00:00",
"dueDate": "2021-10-08T23:00:00.000+00:00",
"action": "dueDateChanged",
"actionComment" : "",
"renewalCount": 7,
"loanPolicyId": "168d255c-7f8e-4b53-a775-ae344f8ae48e",
"checkoutServicePointId": "3b80cfdf-438b-48c1-aadc-57965a0d7680",
Expand Down Expand Up @@ -90,6 +91,7 @@
"loanDate": "2016-02-09T22:19:07.000+00:00",
"dueDate": "2021-10-09T02:00:00.000+00:00",
"action": "dueDateChanged",
"actionComment" : "",
"renewalCount": 8,
"loanPolicyId": "168d255c-7f8e-4b53-a775-ae344f8ae48e",
"checkoutServicePointId": "3b80cfdf-438b-48c1-aadc-57965a0d7680",
Expand Down Expand Up @@ -169,6 +171,7 @@
"loanDate": "2011-01-25T19:35:18.000+00:00",
"dueDate": "2021-10-09T02:00:00.000+00:00",
"action": "dueDateChanged",
"actionComment" : "",
"renewalCount": 18,
"loanPolicyId": "168d255c-7f8e-4b53-a775-ae344f8ae48e",
"checkoutServicePointId": "3b80cfdf-438b-48c1-aadc-57965a0d7680",
Expand Down Expand Up @@ -248,6 +251,7 @@
"loanDate": "2018-05-10T22:00:40.000+00:00",
"dueDate": "2021-10-09T02:00:00.000+00:00",
"action": "dueDateChanged",
"actionComment" : "",
"renewalCount": 5,
"loanPolicyId": "168d255c-7f8e-4b53-a775-ae344f8ae48e",
"checkoutServicePointId": "3b80cfdf-438b-48c1-aadc-57965a0d7680",
Expand Down

0 comments on commit 5d184d6

Please sign in to comment.