-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into MODORDERS-1079
- Loading branch information
Showing
20 changed files
with
1,004 additions
and
21 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,47 @@ | ||
#%RAML 1.0 | ||
title: "RoutingList" | ||
baseUri: https://github.com/folio-org/mod-orders | ||
version: v1.0 | ||
|
||
documentation: | ||
- title: Routing lists | ||
content: <b>CRUD API to manage routing lists.</b> | ||
|
||
types: | ||
routing_list: !include acq-models/mod-orders-storage/schemas/routing_list.json | ||
routing_list_collection: !include acq-models/mod-orders-storage/schemas/routing_list_collection.json | ||
UUID: | ||
type: string | ||
pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$ | ||
|
||
traits: | ||
pageable: !include raml-util/traits/pageable.raml | ||
searchable: !include raml-util/traits/searchable.raml | ||
|
||
resourceTypes: | ||
collection: !include rtypes/collection-with-json-response.raml | ||
collection-item: !include rtypes/item-collection-with-json-response.raml | ||
|
||
/orders/routing-lists: | ||
type: | ||
collection: | ||
exampleCollection: !include acq-models/mod-orders-storage/examples/routing_list_collection.sample | ||
exampleItem: !include acq-models/mod-orders-storage/examples/routing_list_get.sample | ||
schemaCollection: routing_list_collection | ||
schemaItem: routing_list | ||
get: | ||
description: Get routing lists | ||
is: [ | ||
searchable: {description: "with valid searchable fields: for example routing list", example: "[\"routing_list\", \"ROUTING_LIST\", \"=\"]"}, | ||
pageable | ||
] | ||
post: | ||
description: Create routing lists | ||
|
||
/{id}/template: | ||
uriParameters: | ||
id: | ||
description: The UUID of a Title | ||
type: UUID | ||
get: | ||
description: Execute mod-template-engine to process templates with replaced token placeholders [update] |
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
135 changes: 135 additions & 0 deletions
135
src/main/java/org/folio/models/TemplateProcessingRequest.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,135 @@ | ||
package org.folio.models; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
import java.util.UUID; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import org.folio.rest.jaxrs.model.RoutingList; | ||
|
||
public class TemplateProcessingRequest { | ||
@JsonProperty | ||
private UUID templateId; | ||
@JsonProperty | ||
private String lang; | ||
@JsonProperty | ||
private String outputFormat; | ||
@JsonProperty | ||
private Context context; | ||
|
||
public UUID getTemplateId() { | ||
return templateId; | ||
} | ||
|
||
public String getLang() { | ||
return lang; | ||
} | ||
|
||
public String getOutputFormat() { | ||
return outputFormat; | ||
} | ||
|
||
public Context getContext() { | ||
return context; | ||
} | ||
|
||
public TemplateProcessingRequest withTemplateId(UUID templateId) { | ||
this.templateId = templateId; | ||
return this; | ||
} | ||
|
||
public TemplateProcessingRequest withLang(String lang) { | ||
this.lang = lang; | ||
return this; | ||
} | ||
|
||
public TemplateProcessingRequest withOutputFormat(String outputFormat) { | ||
this.outputFormat = outputFormat; | ||
return this; | ||
} | ||
|
||
public TemplateProcessingRequest withContext(Context context) { | ||
this.context = context; | ||
return this; | ||
} | ||
|
||
public static class Context { | ||
@JsonProperty | ||
@JsonInclude(JsonInclude.Include.NON_EMPTY) | ||
private RoutingList routingList; | ||
@JsonProperty | ||
private List<User> users; | ||
|
||
public RoutingList getRoutingList() { | ||
return routingList; | ||
} | ||
|
||
public List<User> getUsers() { | ||
return users; | ||
} | ||
|
||
public Context withRoutingList(RoutingList routingList) { | ||
this.routingList = routingList; | ||
return this; | ||
} | ||
|
||
public Context withUsers(List<User> users) { | ||
this.users = users; | ||
return this; | ||
} | ||
} | ||
|
||
public static class User { | ||
@JsonProperty | ||
private String lastName; | ||
@JsonProperty | ||
private String firstName; | ||
@JsonProperty | ||
private String routingAddress; | ||
|
||
public String getLastName() { | ||
return lastName; | ||
} | ||
|
||
public String getFirstName() { | ||
return firstName; | ||
} | ||
|
||
public String getRoutingAddress() { | ||
return routingAddress; | ||
} | ||
|
||
public User withLastName(String lastName) { | ||
this.lastName = lastName; | ||
return this; | ||
} | ||
|
||
public User withFirstName(String firstName) { | ||
this.firstName = firstName; | ||
return this; | ||
} | ||
|
||
public User withRoutingAddress(String routingAddress) { | ||
this.routingAddress = routingAddress; | ||
return this; | ||
} | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (!(o instanceof TemplateProcessingRequest that)) return false; | ||
return Objects.equals(templateId, that.templateId) | ||
&& Objects.equals(lang, that.lang) | ||
&& Objects.equals(outputFormat, that.outputFormat) | ||
&& Objects.equals(context, that.context); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(templateId, lang, outputFormat, context); | ||
} | ||
} | ||
|
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,76 @@ | ||
package org.folio.models; | ||
|
||
import java.util.List; | ||
import java.util.UUID; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class UserCollection { | ||
@JsonProperty | ||
private List<User> users; | ||
@JsonProperty | ||
private int totalRecords; | ||
|
||
public List<User> getUsers() { | ||
return users; | ||
} | ||
public int getTotalRecords() { | ||
return totalRecords; | ||
} | ||
|
||
public UserCollection withUsers(List<User> users) { | ||
this.users = users; | ||
return this; | ||
} | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public static class User { | ||
@JsonProperty | ||
private UUID id; | ||
@JsonProperty | ||
private Personal personal; | ||
|
||
public UUID getId () { | ||
return id; | ||
} | ||
public Personal getPersonal () { | ||
return personal; | ||
} | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public static class Personal { | ||
@JsonProperty | ||
private String firstName; | ||
@JsonProperty | ||
private String lastName; | ||
@JsonProperty | ||
private List<Address> addresses; | ||
|
||
public String getFirstName() { | ||
return firstName; | ||
} | ||
public String getLastName() { | ||
return lastName; | ||
} | ||
public List<Address> getAddresses() { | ||
return addresses; | ||
} | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public static class Address { | ||
@JsonProperty | ||
private String addressLine1; | ||
@JsonProperty | ||
private String addressTypeId; | ||
|
||
public String getAddressLine1() { | ||
return addressLine1; | ||
} | ||
public String getAddressTypeId() { | ||
return addressTypeId; | ||
} | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.