-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb01b92
commit 59ff6db
Showing
11 changed files
with
492 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"title": "Circulation Setting Schema", | ||
"description": "Circulation setting", | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"description": "ID of the circulation setting", | ||
"type": "string", | ||
"$ref": "raml-util/schemas/uuid.schema" | ||
}, | ||
"name": { | ||
"description": "Circulation setting name", | ||
"type": "string" | ||
}, | ||
"value": { | ||
"description": "Circulation setting", | ||
"type": "object", | ||
"additionalProperties": true | ||
}, | ||
"metadata": { | ||
"description": "Metadata about creation and changes, provided by the server (client should not provide)", | ||
"type": "object", | ||
"$ref": "raml-util/schemas/metadata.schema" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": [ | ||
"id", | ||
"name", | ||
"value" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"description": "Collection of Circulation settings", | ||
"type": "object", | ||
"properties": { | ||
"circulationSettings": { | ||
"description": "List of circulation settings", | ||
"id": "circulationSettings", | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"$ref": "circulation-setting.json" | ||
} | ||
}, | ||
"totalRecords": { | ||
"type": "integer" | ||
} | ||
}, | ||
"required": [ | ||
"circulationSettings", | ||
"totalRecords" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#%RAML 1.0 | ||
title: Circulation Settings | ||
version: v1.0 | ||
protocols: [ HTTP, HTTPS ] | ||
baseUri: http://localhost:9130 | ||
|
||
documentation: | ||
- title: Circulation Settings API | ||
content: <b>API for circulation settings</b> | ||
|
||
traits: | ||
language: !include raml-util/traits/language.raml | ||
pageable: !include raml-util/traits/pageable.raml | ||
searchable: !include raml-util/traits/searchable.raml | ||
validate: !include raml-util/traits/validation.raml | ||
|
||
types: | ||
circulation-setting: !include circulation-setting.json | ||
circulation-settings: !include circulation-settings.json | ||
errors: !include raml-util/schemas/errors.schema | ||
parameters: !include raml-util/schemas/parameters.schema | ||
|
||
resourceTypes: | ||
collection: !include raml-util/rtypes/collection.raml | ||
collection-item: !include raml-util/rtypes/item-collection.raml | ||
|
||
/circulation/settings: | ||
type: | ||
collection: | ||
exampleCollection: !include examples/circulation-settings.json | ||
exampleItem: !include examples/circulation-setting.json | ||
schemaCollection: circulation-settings | ||
schemaItem: circulation-setting | ||
post: | ||
is: [validate] | ||
description: Create a new circulation setting | ||
body: | ||
application/json: | ||
type: circulation-setting | ||
responses: | ||
201: | ||
description: "Circulation setting has been created" | ||
body: | ||
application/json: | ||
type: circulation-setting | ||
500: | ||
description: "Internal server error" | ||
body: | ||
text/plain: | ||
example: "Internal server error" | ||
get: | ||
is: [validate, pageable, searchable: { description: "with valid searchable fields", example: "id=497f6eca-6276-4993-bfeb-98cbbbba8f79" }] | ||
description: Get all circulation settings | ||
responses: | ||
200: | ||
description: "Circulation settings successfully retreived" | ||
body: | ||
application/json: | ||
type: circulation-settings | ||
500: | ||
description: "Internal server error" | ||
body: | ||
text/plain: | ||
example: "Internal server error" | ||
/{circulationSettingId}: | ||
type: | ||
collection-item: | ||
exampleItem: !include examples/circulation-setting.json | ||
schema: circulation-setting | ||
get: | ||
responses: | ||
200: | ||
description: "Circulation setting successfully retreived" | ||
body: | ||
application/json: | ||
type: circulation-setting | ||
500: | ||
description: "Internal server error" | ||
body: | ||
text/plain: | ||
example: "Internal server error" | ||
put: | ||
is: [ validate ] | ||
body: | ||
application/json: | ||
type: circulation-setting | ||
responses: | ||
204: | ||
description: "Circulation settings have been saved." | ||
500: | ||
description: "Internal server error" | ||
body: | ||
text/plain: | ||
example: "Internal server error" | ||
delete: | ||
is: [ validate ] | ||
responses: | ||
204: | ||
description: "Circulation settings deleted" | ||
500: | ||
description: "Internal server error" | ||
body: | ||
text/plain: | ||
example: "Internal server error" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f09", | ||
"name": "Sample settings", | ||
"value": { | ||
"org.folio.circulation.settings": "true" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"circulationSettings": [ | ||
{ | ||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f09", | ||
"name": "Sample settings", | ||
"value": { | ||
"org.folio.circulation.settings": "true" | ||
} | ||
} | ||
], | ||
"totalRecords": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/org/folio/circulation/domain/CirculationSetting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.folio.circulation.domain; | ||
|
||
import static lombok.AccessLevel.PRIVATE; | ||
import static org.folio.circulation.support.json.JsonPropertyFetcher.getObjectProperty; | ||
import static org.folio.circulation.support.json.JsonPropertyFetcher.getProperty; | ||
|
||
import io.vertx.core.json.JsonObject; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
@AllArgsConstructor(access = PRIVATE) | ||
@ToString(onlyExplicitlyIncluded = true) | ||
public class CirculationSetting { | ||
@ToString.Include | ||
@Getter | ||
private final JsonObject representation; | ||
|
||
@Getter | ||
private final String id; | ||
|
||
@Getter | ||
private final String name; | ||
|
||
@Getter | ||
private final JsonObject value; | ||
|
||
public static CirculationSetting from(JsonObject representation) { | ||
return new CirculationSetting(representation, getProperty(representation, "id"), | ||
getProperty(representation, "name"), getObjectProperty(representation, "value")); | ||
} | ||
} |
Oops, something went wrong.