Search in sources :

Example 1 with PackagePutDataAttributes

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

the class PackageRequestConverter method convertToRMAPICustomPackagePutRequest.

public PackagePut convertToRMAPICustomPackagePutRequest(PackagePutRequest request) {
    PackagePutDataAttributes attributes = request.getData().getAttributes();
    PackagePut.PackagePutBuilder builder = convertCommonAttributesToPackagePutRequest(attributes);
    builder.packageName(attributes.getName());
    Integer contentType = contentTypeToRMAPICode.get(attributes.getContentType());
    builder.contentType(contentType != null ? contentType : 6);
    return builder.build();
}
Also used : PackagePutDataAttributes(org.folio.rest.jaxrs.model.PackagePutDataAttributes) PackagePut(org.folio.holdingsiq.model.PackagePut)

Example 2 with PackagePutDataAttributes

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

the class PackageRequestConverterTest method shouldCreateRequestToChangeCustomPackageCoverageDatesToEmpty.

@Test
public void shouldCreateRequestToChangeCustomPackageCoverageDatesToEmpty() {
    PackagePut packagePut = packagesConverter.convertToRMAPICustomPackagePutRequest(PackagesTestData.getPackagePutRequest(new PackagePutDataAttributes().withCustomCoverage(new Coverage().withBeginCoverage("").withEndCoverage(""))));
    assertEquals("", packagePut.getCustomCoverage().getBeginCoverage());
    assertEquals("", packagePut.getCustomCoverage().getEndCoverage());
}
Also used : PackagePutDataAttributes(org.folio.rest.jaxrs.model.PackagePutDataAttributes) PackagePut(org.folio.holdingsiq.model.PackagePut) Coverage(org.folio.rest.jaxrs.model.Coverage) Test(org.junit.Test)

Example 3 with PackagePutDataAttributes

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

the class PackageRequestConverterTest method shouldCreateRequestToChangeCustomPackageCoverageDates.

@Test
public void shouldCreateRequestToChangeCustomPackageCoverageDates() {
    PackagePut packagePut = packagesConverter.convertToRMAPICustomPackagePutRequest(PackagesTestData.getPackagePutRequest(new PackagePutDataAttributes().withCustomCoverage(new Coverage().withBeginCoverage("2003-01-01").withEndCoverage("2004-01-01"))));
    assertEquals("2003-01-01", packagePut.getCustomCoverage().getBeginCoverage());
    assertEquals("2004-01-01", packagePut.getCustomCoverage().getEndCoverage());
}
Also used : PackagePutDataAttributes(org.folio.rest.jaxrs.model.PackagePutDataAttributes) PackagePut(org.folio.holdingsiq.model.PackagePut) Coverage(org.folio.rest.jaxrs.model.Coverage) Test(org.junit.Test)

Example 4 with PackagePutDataAttributes

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

the class PackageRequestConverterTest method shouldCreateRequestToAddCustomCoverage.

@Test
public void shouldCreateRequestToAddCustomCoverage() {
    PackagePut packagePut = packagesConverter.convertToRMAPIPackagePutRequest(PackagesTestData.getPackagePutRequest(new PackagePutDataAttributes().withIsSelected(true).withCustomCoverage(new Coverage().withBeginCoverage("2000-10-10").withEndCoverage("2000-11-10"))));
    assertEquals("2000-10-10", packagePut.getCustomCoverage().getBeginCoverage());
    assertEquals("2000-11-10", packagePut.getCustomCoverage().getEndCoverage());
}
Also used : PackagePutDataAttributes(org.folio.rest.jaxrs.model.PackagePutDataAttributes) PackagePut(org.folio.holdingsiq.model.PackagePut) Coverage(org.folio.rest.jaxrs.model.Coverage) Test(org.junit.Test)

Example 5 with PackagePutDataAttributes

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

the class PackageRequestConverterTest method shouldCreateRequestToChangeCustomPackageContentType.

@Test
public void shouldCreateRequestToChangeCustomPackageContentType() {
    PackagePut packagePut = packagesConverter.convertToRMAPICustomPackagePutRequest(PackagesTestData.getPackagePutRequest(new PackagePutDataAttributes().withContentType(ContentType.STREAMING_MEDIA)));
    Integer aggregatedFullTextContentTypeCode = 8;
    assertEquals(aggregatedFullTextContentTypeCode, packagePut.getContentType());
}
Also used : PackagePutDataAttributes(org.folio.rest.jaxrs.model.PackagePutDataAttributes) PackagePut(org.folio.holdingsiq.model.PackagePut) Test(org.junit.Test)

Aggregations

PackagePutDataAttributes (org.folio.rest.jaxrs.model.PackagePutDataAttributes)14 PackagePut (org.folio.holdingsiq.model.PackagePut)11 Test (org.junit.Test)10 Coverage (org.folio.rest.jaxrs.model.Coverage)3 InputValidationException (org.folio.rest.exception.InputValidationException)2 VisibilityData (org.folio.rest.jaxrs.model.VisibilityData)2 TokenInfo (org.folio.holdingsiq.model.TokenInfo)1 ContentType (org.folio.rest.jaxrs.model.ContentType)1