Skip to content

Commit

Permalink
PR-1709 Make valid response with all mandatory fields (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
JanisSaldabols authored May 21, 2024
1 parent 58df013 commit fd42add
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/org/folio/ncip/FolioNcipHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.extensiblecatalog.ncip.v2.common.Translator;
import org.extensiblecatalog.ncip.v2.common.TranslatorFactory;
import org.extensiblecatalog.ncip.v2.service.BibliographicRecordIdentifierCode;
import org.extensiblecatalog.ncip.v2.service.LocationType;
import org.extensiblecatalog.ncip.v2.service.NCIPInitiationData;
import org.extensiblecatalog.ncip.v2.service.NCIPResponseData;
import org.extensiblecatalog.ncip.v2.service.RequestScopeType;
Expand Down Expand Up @@ -93,10 +94,12 @@ private Future<Void> initToolkitDefaults() {
}

private void setUpMapping(){
SchemeValuePair.allowNullScheme(RequestType.class.getName(), RequestScopeType.class.getName(), BibliographicRecordIdentifierCode.class.getName());
SchemeValuePair.allowNullScheme(RequestType.class.getName(), RequestScopeType.class.getName(),
BibliographicRecordIdentifierCode.class.getName(), LocationType.class.getName());
SchemeValuePair.mapBehavior(RequestType.class.getName(), SchemeValueBehavior.ALLOW_ANY);
SchemeValuePair.mapBehavior(RequestScopeType.class.getName(), SchemeValueBehavior.ALLOW_ANY);
SchemeValuePair.mapBehavior(BibliographicRecordIdentifierCode.class.getName(), SchemeValueBehavior.ALLOW_ANY);
SchemeValuePair.mapBehavior(LocationType.class.getName(), SchemeValueBehavior.ALLOW_ANY);
}

public InputStream ncipProcess(RoutingContext context) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.extensiblecatalog.ncip.v2.service.Location;
import org.extensiblecatalog.ncip.v2.service.LocationName;
import org.extensiblecatalog.ncip.v2.service.LocationNameInstance;
import org.extensiblecatalog.ncip.v2.service.LocationType;
import org.extensiblecatalog.ncip.v2.service.Problem;
import org.extensiblecatalog.ncip.v2.service.ProblemType;
import org.extensiblecatalog.ncip.v2.service.RequestId;
Expand All @@ -26,6 +27,7 @@
import org.folio.ncip.FolioNcipException;
import org.folio.ncip.FolioRemoteServiceManager;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -93,9 +95,12 @@ public RequestItemResponseData performService(RequestItemInitiationData initData
ItemIdentifierType itemIdentifierType = new ItemIdentifierType(Constants.SCHEME, Constants.ITEM_BARCODE);
RequestIdentifierType requestIdentifierType = new RequestIdentifierType(Constants.SCHEME,Constants.REQUEST_ID);
Location location = new Location();
LocationType locationType = new LocationType(Constants.SCHEME, Constants.ITEM);
LocationName locationName = new LocationName();
locationNameInstance.setLocationNameLevel(BigDecimal.ONE);
locationName.setLocationNameInstances(List.of(locationNameInstance));
location.setLocationName(locationName);
location.setLocationType(locationType);
ItemOptionalFields itemOptionalFields = new ItemOptionalFields();
itemOptionalFields.setItemDescription(itemDescription);
itemOptionalFields.setLocations(List.of(location));
Expand Down

0 comments on commit fd42add

Please sign in to comment.