FOLIO mod-circulation-storage
Java RAML Shell Python
Clone or download
marcjohnson-kint Merge pull request #88 from folio-org/CIRCSTORE-67-fix-loan-policy-sa…
…mple-data

Fix incorrect period intervals in sample loan policy CIRCSTORE-67
Latest commit 5aa7ea6 Jul 19, 2018
Permalink
Failed to load latest commit information.
database-setup Separate demo database creation and removal Mar 6, 2017
descriptors Added publicDescription field to cancellation-reasons Jul 17, 2018
docker Remove trailing spaces (FOLIO-351) Apr 3, 2017
okapi-registration/managed-deployment Use un-register python script when stopping managed demo Jan 5, 2018
okapi-setup Use module specific environment variables so can combine demos withou… Mar 6, 2017
ramls Added publicDescription field to cancellation-reasons Jul 17, 2018
reference-data Fix incorrect period intervals in sample loan policy CIRCSTORE-67 Jul 19, 2018
sample-data Remove request status for delivery fulfilment request (coming later) Feb 13, 2018
scripts Ensure bash 4+ Apr 12, 2018
src Added publicDescription field to cancellation-reasons Jul 17, 2018
.editorconfig Add python editor config for using 4 spaces Jan 5, 2018
.eslintrc Initial loan API description Mar 2, 2017
.gitignore Initial loan API description Mar 2, 2017
.gitmodules Move raml-util to ramls/raml-util RMB-30 Aug 9, 2017
CONTRIBUTING.md Fix dev URLs FOLIO-1179 Apr 16, 2018
Dockerfile switch to fabric8-based docker base image Dec 19, 2017
Jenkinsfile update Jenkinsfile to use newer pipeline libs Nov 20, 2017
LICENSE Loan storage module is distributed under the Apache license Feb 28, 2017
NEWS.md Added publicDescription field to cancellation-reasons Jul 17, 2018
README.MD Add needed PostgreSQL extensions to readme Apr 30, 2018
build-docker-image.sh Change maven artefact name to circulation storage Apr 26, 2017
clean.sh Introduce clean script to generated code, recompile and reset local d… Feb 12, 2018
create-tenant.sh Create a tenant for a local demo Mar 3, 2017
delete-sample-data.sh Add script to delete sample records CIRCSTORE-36 Feb 13, 2018
delete-tenant.sh Create a tenant for a local demo Mar 3, 2017
destroy-demo-and-test-dbs.sh Add a script to delete demo and test databases together Sep 5, 2017
destroy-demo-db.sh Adjust database name to match changed module name Sep 6, 2017
destroy-test-db.sh Adjust database name to match changed module name Sep 6, 2017
full-build.sh Introduce clean script to generated code, recompile and reset local d… Feb 12, 2018
import-reference-data.sh Split reference and sample records CIRCSTORE-36 Feb 13, 2018
import-sample-data.sh Split reference and sample records CIRCSTORE-36 Feb 13, 2018
pom.xml Add metadata to loans-policy object Jul 11, 2018
quick-test.sh Remove target directory before running quick test Sep 27, 2017
reset-db.sh Add script to reset demo and test database Oct 23, 2017
set-demo-okapi-environment-variables.sh Use module specific environment variables so can combine demos withou… Mar 6, 2017
setup-demo-db.sh Separate demo database creation and removal Mar 6, 2017
setup-test-db.sh Separate demo database creation and removal Mar 6, 2017
start-managed-demo.sh Use generated Descriptors FOLIO-701 Aug 29, 2017
stop-managed-demo.sh Use un-register python script when stopping managed demo Jan 5, 2018

README.MD

mod-circulation-storage

Copyright (C) 2017-2018 The Open Library Foundation

This software is distributed under the terms of the Apache License, Version 2.0. See the file "LICENSE" for more information.

Goal

FOLIO compatible persistent storage of loans, loan policies, loan rules, requests, and fixed due date schedules

API

Where the API code lives

The implementation java files live in the /src/main/java/org/folio/rest/impl package. These implement the actual java interfaces, to be found in the /src/main/java/org/folio/rest/jaxrs/resource package, which are automatically generated from the raml files in /ramls/.

Corresponding API tests can be found in the /src/test/java/org/folio/rest/api package.

API documentation

The API documentation generated from the *.raml files can be found online at https://dev.folio.org/reference/api/#mod-circulation-storage

Implementation Specific Behaviours

As a FOLIO interface is limited to describing the protocol (HTTP endpoints and the structure of expected requests and responses) between the client and server there are behaviors which go beyond this definition and are implementation specific, some of which are noted below.

Only one Open Loan per Item

This implementation introduces the constraint that only one loan can be open for a given item. Requests (either POST or PUT) which could result in two loans with the same itemId and the status of Open should be rejected with a error (422) response

Prerequisites

Required

  • Java 8 JDK
  • Maven 3.3.9
  • PostgreSQL 9.6.1 (running and listening on the default port, logged in user must have admin rights), with the following extensions
    • pgcrpyto
    • unaccent
    • pg_trgm

Optional

  • Python 3.6.0 (for un-registering module during managed deployment scripts)

Preparation

Git Submodules

There are some common RAML definitions that are shared between FOLIO projects via Git submodules.

To initialise these please run git submodule init && git submodule update in the root directory.

If these are not initialised, the inventory-storage module will fail to build correctly, and other operations may also fail.

More information is available on the developer site.

PostgreSQL

Run the setup-test-db.sh script in the inventory-storage directory to setup Postgres with a database to be used in tests. This is only required to run tests against an external Postgres instance, the default is to use an embedded Postgres instance.

Common activities

Checking the RAML and JSON.Schema definitions

run ./scripts/lint-raml-cop.sh to validate the RAML and JSON.Schema descriptions of the API.

Frequently Asked Questions

Dates and times

A loan has the date and time when and item was leant to a user and when it was returned. The module expects them to be represented in RFC3339 format.

At the moment, the JSON.schema for loan does provide validation for these (it will eventually use the date-time format included in the standard when this is supported by the RAML module builder).

Additional Information

Other modules.

See project CIRCSTORE at the FOLIO issue tracker.

Other FOLIO Developer documentation is at dev.folio.org