Search in sources :

Example 1 with Proxy

use of org.folio.rest.jaxrs.model.Proxy in project mod-kb-ebsco-java by folio-org.

the class ProviderConverter method convert.

@Override
public Provider convert(@NonNull VendorResult result) {
    VendorById vendor = result.getVendor();
    org.folio.holdingsiq.model.Packages packages = result.getPackages();
    TokenInfo vendorToken = vendor.getVendorByIdToken();
    Provider provider = new Provider().withData(new ProviderData().withId(String.valueOf(vendor.getVendorId())).withType(PROVIDERS_TYPE).withAttributes(new ProviderGetDataAttributes().withName(vendor.getVendorName()).withPackagesTotal(vendor.getPackagesTotal()).withPackagesSelected(vendor.getPackagesSelected()).withSupportsCustomPackages(vendor.isCustomer()).withProviderToken(tokenInfoConverter.convert(vendorToken)).withProxy(new Proxy().withId(vendor.getProxy().getId()).withInherited(vendor.getProxy().getInherited())).withTags(result.getTags())).withRelationships(createEmptyProviderRelationships())).withJsonapi(RestConstants.JSONAPI);
    if (packages != null) {
        provider.withIncluded(packagesConverter.convert(packages).getData()).getData().withRelationships(new Relationships().withPackages(new Packages().withMeta(new MetaDataIncluded().withIncluded(true)).withData(convertPackagesRelationship(packages))));
    }
    return provider;
}
Also used : ProviderData(org.folio.rest.jaxrs.model.ProviderData) Proxy(org.folio.rest.jaxrs.model.Proxy) ProviderConverterUtils.createEmptyProviderRelationships(org.folio.rest.converter.providers.ProviderConverterUtils.createEmptyProviderRelationships) Relationships(org.folio.rest.jaxrs.model.Relationships) MetaDataIncluded(org.folio.rest.jaxrs.model.MetaDataIncluded) VendorById(org.folio.holdingsiq.model.VendorById) Packages(org.folio.rest.jaxrs.model.Packages) TokenInfo(org.folio.holdingsiq.model.TokenInfo) ProviderGetDataAttributes(org.folio.rest.jaxrs.model.ProviderGetDataAttributes) Provider(org.folio.rest.jaxrs.model.Provider)

Example 2 with Proxy

use of org.folio.rest.jaxrs.model.Proxy in project mod-kb-ebsco-java by folio-org.

the class ResourceRequestConverterTest method shouldCreateRequestToUpdateProxyForCustomResource.

@Test
public void shouldCreateRequestToUpdateProxyForCustomResource() {
    ResourcePut resourcePut = resourcesConverter.convertToRMAPICustomResourcePutRequest(ResourcesTestData.getResourcePutRequest(new ResourcePutDataAttributes().withIsSelected(true).withProxy(new Proxy().withId("test-proxy-id"))), resourceData);
    assertEquals("test-proxy-id", resourcePut.getProxy().getId());
}
Also used : Proxy(org.folio.rest.jaxrs.model.Proxy) ResourcePutDataAttributes(org.folio.rest.jaxrs.model.ResourcePutDataAttributes) ResourcePut(org.folio.holdingsiq.model.ResourcePut) Test(org.junit.Test)

Example 3 with Proxy

use of org.folio.rest.jaxrs.model.Proxy in project mod-kb-ebsco-java by folio-org.

the class ResourceRequestConverterTest method shouldCreateRequestToUpdateProxyForManagedResource.

@Test
public void shouldCreateRequestToUpdateProxyForManagedResource() {
    ResourcePut resourcePut = resourcesConverter.convertToRMAPIResourcePutRequest(ResourcesTestData.getResourcePutRequest(new ResourcePutDataAttributes().withIsSelected(true).withProxy(new Proxy().withId("test-proxy-id"))), resourceData);
    assertEquals("test-proxy-id", resourcePut.getProxy().getId());
}
Also used : Proxy(org.folio.rest.jaxrs.model.Proxy) ResourcePutDataAttributes(org.folio.rest.jaxrs.model.ResourcePutDataAttributes) ResourcePut(org.folio.holdingsiq.model.ResourcePut) Test(org.junit.Test)

Aggregations

Proxy (org.folio.rest.jaxrs.model.Proxy)3 ResourcePut (org.folio.holdingsiq.model.ResourcePut)2 ResourcePutDataAttributes (org.folio.rest.jaxrs.model.ResourcePutDataAttributes)2 Test (org.junit.Test)2 TokenInfo (org.folio.holdingsiq.model.TokenInfo)1 VendorById (org.folio.holdingsiq.model.VendorById)1 ProviderConverterUtils.createEmptyProviderRelationships (org.folio.rest.converter.providers.ProviderConverterUtils.createEmptyProviderRelationships)1 MetaDataIncluded (org.folio.rest.jaxrs.model.MetaDataIncluded)1 Packages (org.folio.rest.jaxrs.model.Packages)1 Provider (org.folio.rest.jaxrs.model.Provider)1 ProviderData (org.folio.rest.jaxrs.model.ProviderData)1 ProviderGetDataAttributes (org.folio.rest.jaxrs.model.ProviderGetDataAttributes)1 Relationships (org.folio.rest.jaxrs.model.Relationships)1