{"id":343161,"date":"2022-12-26T15:01:35","date_gmt":"2022-12-26T15:01:35","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=343161"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2022-12-26T15:01:35","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=343161","title":{"rendered":"<span>Spring Data Specification: \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 spring data<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b91\/e87\/952\/b91e87952b81a68a66a7edba57285bc7.png\" width=\"780\" height=\"439\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b91\/e87\/952\/b91e87952b81a68a66a7edba57285bc7.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041a\u043e\u043b\u043b\u0435\u0433\u0438, \u0434\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c. \u0412\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 \u0431\u0435\u043a\u0435\u043d\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Spring Data \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043f\u043b\u044e\u0448\u043a\u0430\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432. \u0422\u0430\u043a\u0436\u0435 \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0431\u0435\u043a\u0435\u043d\u0434\u0443 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0442 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e: \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u043c\u0430\u0433\u0430\u0437\u0438\u043d. \u0421\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b UI \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u0442\u043e\u0432\u0430\u0440\u043e\u0432, \u0437\u0430\u0434\u0430\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430:<\/p>\n<ul>\n<li>\n<p>\u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u043a\u043d\u0438\u0433\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u043a\u043d\u0438\u0433\u0438, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0436\u0430\u043d\u0440 &#8212; \u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u043a\u0430 <strong>\u0438<\/strong> \u0438\u043c\u044f \u0430\u0432\u0442\u043e\u0440\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u201c\u0430\u0431\u0432\u201d.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u043a\u043d\u0438\u0433\u0438 \u0441 \u043e\u0431\u043b\u043e\u0436\u043a\u043e\u0439 \u0436\u0435\u043b\u0442\u043e\u0433\u043e <strong>\u0438\u043b\u0438 <\/strong>\u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0431\u0435\u043a\u0435\u043d\u0434\u0430 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u041a\u043d\u0438\u0433\u0430, \u0416\u0430\u043d\u0440, \u0410\u0432\u0442\u043e\u0440 \u0438 \u0422\u0435\u0433 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 <strong>\u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445<\/strong> \u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e <strong>foreign key.<\/strong> \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0438 Entity.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0431\u0435\u043a\u0435\u043d\u0434 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043e\u0442 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u043e\u0438\u0441\u043a, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043d\u0438\u043c\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u043d\u0443\u0436\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/p>\n<\/li>\n<li>\n<p>\u043d\u0443\u0436\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432 \u044d\u0442\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c join, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u043f\u043e\u043b\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430:<\/strong> \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0445 json-\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432, \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c sql-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c \u043f\u043e \u043f\u043e\u043b\u044f\u043c, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0432 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0445.<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043f\u0440\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 Specification \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 <a href=\"https:\/\/www.baeldung.com\/rest-api-search-language-spring-data-specifications\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, \u0442\u043e <strong>Specification <\/strong>\u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u043d\u0430\u043b\u043e\u0436\u0438\u0442\u044c \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0444\u0438\u043b\u044c\u0442\u0440\u044b \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 spring data.<\/p>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442 \u0444\u0438\u043b\u044c\u0442\u0440\u0430, \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0441 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430:<\/p>\n<pre><code class=\"java\">@Data @Builder @NoArgsConstructor @AllArgsConstructor public class SearchCriteria implements Filter { private final String type = \"SEARCH\"; \/** * \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438\u0449\u0435\u043c (\u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u043f\u043e\u043b\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0411\u0414) *\/ @ApiModelProperty(value = \"\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438\u0449\u0435\u043c (\u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u043f\u043e\u043b\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0411\u0414)\") private String key; \/** * \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c (\u0434\u043b\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c author) *\/ @ApiModelProperty(value = \"\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c (\u0434\u043b\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c author)\") private String table; \/** * \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 (EQ, GR, LO, IN) *\/ @ApiModelProperty(value = \"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 (EQ, GR, LO, IN)\") private String operation; \/** * \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438\u0449\u0435\u043c *\/ @ApiModelProperty(value = \"\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438\u0449\u0435\u043c\") private Object value; } <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u043e\u0438\u0441\u043a \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0435 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443, \u0430 \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043f\u043e\u043b\u044f\u043c \u0441\u0440\u0430\u0437\u0443,<\/p>\n<p>\u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0434\u043b\u044f OR \u0438 AND, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432:<\/p>\n<pre><code class=\"java\">@JsonTypeInfo( use = JsonTypeInfo.Id.NAME, property = \"type\", include = JsonTypeInfo.As.EXISTING_PROPERTY ) @JsonSubTypes({ @JsonSubTypes.Type(value = OrFilter.class, name = \"OR\"), @JsonSubTypes.Type(value = AndFilter.class, name = \"AND\"), @JsonSubTypes.Type(value = SearchCriteria.class, name = \"SEARCH\") }) public interface Filter { } @Data public class AndFilter implements Filter { private final String type = \"AND\"; \/** * \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438\u0449\u0435\u043c *\/ @ApiModelProperty(value = \"\u041d\u0430\u0431\u043e\u0440 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\") private List&lt;Filter> value; } @Data public class OrFilter implements Filter { private final String type = \"OR\"; \/** * \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438\u0449\u0435\u043c *\/ @ApiModelProperty(value = \"\u041d\u0430\u0431\u043e\u0440 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\") private List&lt;Filter> value; } <\/code><\/pre>\n<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0431\u044b\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0441 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u0438\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u0441\u0435\u0440\u0432\u0438\u0441, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 Specification:<\/p>\n<pre><code>Specification&lt;Workspace> specification = SpecificationCreator.create(filter); Page&lt;Workspace> results = workspaceRepository.findAll(specification, pageable);<\/code><\/pre>\n<p>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 filter \u0432 specification \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 <strong>SpecificationCreator<\/strong>:<\/p>\n<pre><code class=\"java\">@UtilityClass public class SpecificationCreator { public Specification&lt;Workspace> create(Filter filter) { if (filter instanceof OrFilter) { OrFilter orFilter = (OrFilter) filter; List&lt;Specification&lt;Workspace>> specs = createInnerSpecifications(orFilter.getValue()); return createOrSpecification(specs); } else if (filter instanceof AndFilter) { AndFilter andFilter = (AndFilter) filter; List&lt;Specification&lt;Workspace>> specs = createInnerSpecifications(andFilter.getValue()); return createAndSpecification(specs); } else if (filter instanceof SearchCriteria) { SearchCriteria searchCriteria = (SearchCriteria) filter;  return createSearhSpecification(searchCriteria); } return null; } private List&lt;Specification&lt;Workspace>> createInnerSpecifications(List&lt;Filter> value) { List&lt;Specification&lt;Workspace>> specs = Lists.newArrayList(); if (value != null &amp;&amp; !value.isEmpty()) { value.forEach(f -> { Specification&lt;Workspace> specification = create(f); specs.add(specification); }); } return specs; } private Specification&lt;Workspace> createAndSpecification(List&lt;Specification&lt;Workspace>> specs) { Specification&lt;Workspace> orSpecification = Specification.where(specs.get(0)); for (int i = 1; i &lt; specs.size(); i++) { orSpecification = specs.get(i).or(orSpecification); } return orSpecification; } private Specification&lt;Workspace> createOrSpecification(List&lt;Specification&lt;Workspace>> specs) { Specification&lt;Workspace> andSpecification = Specification.where(specs.get(0)); for (int i = 1; i &lt; specs.size(); i++) { andSpecification = specs.get(i).and(andSpecification); } return andSpecification; } private Specification&lt;Workspace> createSearhSpecification(SearchCriteria searchCriteria) { return new WorkspaceSpecification(searchCriteria); } } <\/code><\/pre>\n<p>\u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u043f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e <strong>AND <\/strong>\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430<strong> and()<\/strong> \u0438 \u043f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e <strong>OR <\/strong>\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <strong>or()<\/strong>.<\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u043c <strong>WorkspaceSpecification<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 <strong>Specification&lt;E> <\/strong>:\u00a0<\/p>\n<pre><code class=\"java\">@RequiredArgsConstructor public class WorkspaceSpecification implements Specification&lt;Workspace> { private final SearchCriteria criteria; @Override public Predicate toPredicate(Root&lt;Workspace> root, CriteriaQuery&lt;?> query,  CriteriaBuilder builder) { Join&lt;Object, Object> join = null; if (criteria.getTable() != null) { join = root.join(criteria.getTable()); } if (Operation.GR.name() .equalsIgnoreCase(criteria.getOperation())) { return builder.greaterThanOrEqualTo( root.&lt;String> get(criteria.getKey()), criteria.getValue().toString()); } else if (Operation.LO.name() .equalsIgnoreCase(criteria.getOperation())) { return builder.lessThanOrEqualTo( root.&lt;String> get(criteria.getKey()), criteria.getValue().toString()); } else if (Operation.EQ.name() .equalsIgnoreCase(criteria.getOperation())) { if (criteria.getTable() != null) { if (join.get(criteria.getKey()).getJavaType() == String.class) { return builder.like( builder.lower(join.get(criteria.getKey())), \"%\" + criteria.getValue().toString().toLowerCase() + \"%\"); } else { return builder.equal(join.get(criteria.getKey()), criteria.getValue()); } } else { if (root.get(criteria.getKey()).getJavaType() == String.class) { return builder.like( builder.lower(root.get(criteria.getKey())), \"%\" + criteria.getValue().toString().toLowerCase() + \"%\"); } else { return builder.equal(root.get(criteria.getKey()), criteria.getValue()); } } } else if (Operation.IN.name() .equalsIgnoreCase(criteria.getOperation())) { List&lt;String> values = Lists.newArrayList((List&lt;String>)criteria.getValue()); if (criteria.getTable() != null) { return join.get(criteria.getKey()).in(values); } else { return root.get(criteria.getKey()).in(values); } } return null; } }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0430, \u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 <strong>JpaSpecificationExecutor&lt;Workspace><\/strong>:<\/p>\n<pre><code class=\"java\">public interface WorkspaceRepository extends  JpaRepository&lt;Workspace, String>, JpaSpecificationExecutor&lt;Workspace> { }<\/code><\/pre>\n<h3>\u041f\u043e\u0434\u0432\u0435\u0434\u0435\u043c \u0438\u0442\u043e\u0433\u0438<\/h3>\n<p><strong>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Specification:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 ui-\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442\u0441\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 &#8212; \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b<\/p>\n<\/li>\n<li>\n<p>\u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0432\u044b\u0431\u043e\u0440\u0430 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0441\u043b\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0447\u0442\u043e\u0431\u044b Entity \u0438 Repository \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>\u043d\u0443\u0436\u0435\u043d \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e entity \u0432 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 response.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0445\u043e\u0447\u0443 \u043f\u043e\u0437\u0434\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435\u0445 \u0441 \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u043c \u043d\u043e\u0432\u044b\u043c \u0433\u043e\u0434\u043e\u043c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u043d\u0430 <a href=\"https:\/\/otus.pw\/tkiH\/\">\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0432\u0435\u0431\u0438\u043d\u0430\u0440<\/a>, \u0433\u0434\u0435 \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e SpringBoot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0441 \u0434\u0432\u0443\u043c\u044f \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e SpringData-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438.<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/otus.pw\/tkiH\/\">\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0432\u0435\u0431\u0438\u043d\u0430\u0440<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/707724\/\"> https:\/\/habr.com\/ru\/company\/otus\/blog\/707724\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u043e\u043b\u043b\u0435\u0433\u0438, \u0434\u043e\u0431\u0440\u044b\u0439 \u0434\u0435\u043d\u044c. \u0412\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 \u0431\u0435\u043a\u0435\u043d\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Spring Data \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043f\u043b\u044e\u0448\u043a\u0430\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432. \u0422\u0430\u043a\u0436\u0435 \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e \u0431\u0435\u043a\u0435\u043d\u0434\u0443 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u043c, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0442 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e: \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u043c\u0430\u0433\u0430\u0437\u0438\u043d. \u0421\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b UI \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0438\u0441\u043a \u0442\u043e\u0432\u0430\u0440\u043e\u0432, \u0437\u0430\u0434\u0430\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430:<\/p>\n<ul>\n<li>\n<p>\u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u043a\u043d\u0438\u0433\u0438 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u043a\u043d\u0438\u0433\u0438, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0436\u0430\u043d\u0440 &#8212; \u0444\u0430\u043d\u0442\u0430\u0441\u0442\u0438\u043a\u0430 <strong>\u0438<\/strong> \u0438\u043c\u044f \u0430\u0432\u0442\u043e\u0440\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u201c\u0430\u0431\u0432\u201d.<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u043a\u043d\u0438\u0433\u0438 \u0441 \u043e\u0431\u043b\u043e\u0436\u043a\u043e\u0439 \u0436\u0435\u043b\u0442\u043e\u0433\u043e <strong>\u0438\u043b\u0438 <\/strong>\u043a\u0440\u0430\u0441\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u0431\u0435\u043a\u0435\u043d\u0434\u0430 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u041a\u043d\u0438\u0433\u0430, \u0416\u0430\u043d\u0440, \u0410\u0432\u0442\u043e\u0440 \u0438 \u0422\u0435\u0433 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 <strong>\u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u0445<\/strong> \u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e <strong>foreign key.<\/strong> \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0438 Entity.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0431\u0435\u043a\u0435\u043d\u0434 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043e\u0442 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043f\u043e\u0438\u0441\u043a, \u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043d\u0438\u043c\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u043d\u0443\u0436\u043d\u044b\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/p>\n<\/li>\n<li>\n<p>\u043d\u0443\u0436\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432 \u044d\u0442\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c join, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u043f\u043e\u043b\u044e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0417\u0430\u0434\u0430\u0447\u0430:<\/strong> \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0445 json-\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432, \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0441 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c sql-\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c \u043f\u043e \u043f\u043e\u043b\u044f\u043c, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0432 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0445.<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043f\u0440\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 Specification \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 <a href=\"https:\/\/www.baeldung.com\/rest-api-search-language-spring-data-specifications\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e, \u0442\u043e <strong>Specification <\/strong>\u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u043d\u0430\u043b\u043e\u0436\u0438\u0442\u044c \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0444\u0438\u043b\u044c\u0442\u0440\u044b \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 spring data.<\/p>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442 \u0444\u0438\u043b\u044c\u0442\u0440\u0430, \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0441 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430:<\/p>\n<pre><code class=\"java\">@Data @Builder @NoArgsConstructor @AllArgsConstructor public class SearchCriteria implements Filter { private final String type = \"SEARCH\"; \/** * \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438\u0449\u0435\u043c (\u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u043f\u043e\u043b\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0411\u0414) *\/ @ApiModelProperty(value = \"\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438\u0449\u0435\u043c (\u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u043f\u043e\u043b\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0411\u0414)\") private String key; \/** * \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c (\u0434\u043b\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c author) *\/ @ApiModelProperty(value = \"\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c (\u0434\u043b\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c author)\") private String table; \/** * \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 (EQ, GR, LO, IN) *\/ @ApiModelProperty(value = \"\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 (EQ, GR, LO, IN)\") private String operation; \/** * \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438\u0449\u0435\u043c *\/ @ApiModelProperty(value = \"\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438\u0449\u0435\u043c\") private Object value; } <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u043e\u0438\u0441\u043a \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0435 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443, \u0430 \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043f\u043e\u043b\u044f\u043c \u0441\u0440\u0430\u0437\u0443,<\/p>\n<p>\u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0434\u043b\u044f OR \u0438 AND, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0449\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432:<\/p>\n<pre><code class=\"java\">@JsonTypeInfo( use = JsonTypeInfo.Id.NAME, property = \"type\", include = JsonTypeInfo.As.EXISTING_PROPERTY ) @JsonSubTypes({ @JsonSubTypes.Type(value = OrFilter.class, name = \"OR\"), @JsonSubTypes.Type(value = AndFilter.class, name = \"AND\"), @JsonSubTypes.Type(value = SearchCriteria.class, name = \"SEARCH\") }) public interface Filter { } @Data public class AndFilter implements Filter { private final String type = \"AND\"; \/** * \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438\u0449\u0435\u043c *\/ @ApiModelProperty(value = \"\u041d\u0430\u0431\u043e\u0440 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\") private List&lt;Filter> value; } @Data public class OrFilter implements Filter { private final String type = \"OR\"; \/** * \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438\u0449\u0435\u043c *\/ @ApiModelProperty(value = \"\u041d\u0430\u0431\u043e\u0440 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\") private List&lt;Filter> value; } <\/code><\/pre>\n<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0431\u044b\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u0441 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u0438\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 \u0441\u0435\u0440\u0432\u0438\u0441, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 Specification:<\/p>\n<pre><code>Specification&lt;Workspace> specification = SpecificationCreator.create(filter); Page&lt;Workspace> results = workspaceRepository.findAll(specification, pageable);<\/code><\/pre>\n<p>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 filter \u0432 specification \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 <strong>SpecificationCreator<\/strong>:<\/p>\n<pre><code class=\"java\">@UtilityClass public class SpecificationCreator { public Specification&lt;Workspace> create(Filter filter) { if (filter instanceof OrFilter) { OrFilter orFilter = (OrFilter) filter; List&lt;Specification&lt;Workspace>> specs = createInnerSpecifications(orFilter.getValue()); return createOrSpecification(specs); } else if (filter instanceof AndFilter) { AndFilter andFilter = (AndFilter) filter; List&lt;Specification&lt;Workspace>> specs = createInnerSpecifications(andFilter.getValue()); return createAndSpecification(specs); } else if (filter instanceof SearchCriteria) { SearchCriteria searchCriteria = (SearchCriteria) filter;  return createSearhSpecification(searchCriteria); } return null; } private List&lt;Specification&lt;Workspace>> createInnerSpecifications(List&lt;Filter> value) { List&lt;Specification&lt;Workspace>> specs = Lists.newArrayList(); if (value != null &amp;&amp; !value.isEmpty()) { value.forEach(f -> { Specification&lt;Workspace> specification = create(f); specs.add(specification); }); } return specs; } private Specification&lt;Workspace> createAndSpecification(List&lt;Specification&lt;Workspace>> specs) { Specification&lt;Workspace> orSpecification = Specification.where(specs.get(0)); for (int i = 1; i &lt; specs.size(); i++) { orSpecification = specs.get(i).or(orSpecification); } return orSpecification; } private Specification&lt;Workspace> createOrSpecification(List&lt;Specification&lt;Workspace>> specs) { Specification&lt;Workspace> andSpecification = Specification.where(specs.get(0)); for (int i = 1; i &lt; specs.size(); i++) { andSpecification = specs.get(i).and(andSpecification); } return andSpecification; } private Specification&lt;Workspace> createSearhSpecification(SearchCriteria searchCriteria) { return new WorkspaceSpecification(searchCriteria); } } <\/code><\/pre>\n<p>\u0421\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u043f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e <strong>AND <\/strong>\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430<strong> and()<\/strong> \u0438 \u043f\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u044e <strong>OR <\/strong>\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <strong>or()<\/strong>.<\/p>\n<p>\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u043c <strong>WorkspaceSpecification<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 <strong>Specification&lt;E> <\/strong>:\u00a0<\/p>\n<pre><code class=\"java\">@RequiredArgsConstructor public class WorkspaceSpecification implements Specification&lt;Workspace> { private final SearchCriteria criteria; @Override public Predicate toPredicate(Root&lt;Workspace> root, CriteriaQuery&lt;?> query,  CriteriaBuilder builder) { Join&lt;Object, Object> join = null; if (criteria.getTable() != null) { join = root.join(criteria.getTable()); } if (Operation.GR.name() .equalsIgnoreCase(criteria.getOperation())) { return builder.greaterThanOrEqualTo( root.&lt;String> get(criteria.getKey()), criteria.getValue().toString()); } else if (Operation.LO.name() .equalsIgnoreCase(criteria.getOperation())) { return builder.lessThanOrEqualTo( root.&lt;String> get(criteria.getKey()), criteria.getValue().toString()); } else if (Operation.EQ.name() .equalsIgnoreCase(criteria.getOperation())) { if (criteria.getTable() != null) { if (join.get(criteria.getKey()).getJavaType() == String.class) { return builder.like( builder.lower(join.get(criteria.getKey())), \"%\" + criteria.getValue().toString().toLowerCase() + \"%\"); } else { return builder.equal(join.get(criteria.getKey()), criteria.getValue()); } } else { if (root.get(criteria.getKey()).getJavaType() == String.class) { return builder.like( builder.lower(root.get(criteria.getKey())), \"%\" + criteria.getValue().toString().toLowerCase() + \"%\"); } else { return builder.equal(root.get(criteria.getKey()), criteria.getValue()); } } } else if (Operation.IN.name() .equalsIgnoreCase(criteria.getOperation())) { List&lt;String> values = Lists.newArrayList((List&lt;String>)criteria.getValue()); if (criteria.getTable() != null) { return join.get(criteria.getKey()).in(values); } else { return root.get(criteria.getKey()).in(values); } } return null; } }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0430, \u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 <strong>JpaSpecificationExecutor&lt;Workspace><\/strong>:<\/p>\n<pre><code class=\"java\">public interface WorkspaceRepository extends  JpaRepository&lt;Workspace, String>, JpaSpecificationExecutor&lt;Workspace> { }<\/code><\/pre>\n<h3>\u041f\u043e\u0434\u0432\u0435\u0434\u0435\u043c \u0438\u0442\u043e\u0433\u0438<\/h3>\n<p><strong>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Specification:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 ui-\u0444\u0438\u043b\u044c\u0442\u0440\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0442\u0441\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 &#8212; \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b<\/p>\n<\/li>\n<li>\n<p>\u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0432\u044b\u0431\u043e\u0440\u0430 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f:<\/strong><\/p>\n<ul>\n<li>\n<p>\u0441\u043b\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0447\u0442\u043e\u0431\u044b Entity \u0438 Repository \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>\u043d\u0443\u0436\u0435\u043d \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e entity \u0432 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 response.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0445\u043e\u0447\u0443 \u043f\u043e\u0437\u0434\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0441\u0435\u0445 \u0441 \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u043c \u043d\u043e\u0432\u044b\u043c \u0433\u043e\u0434\u043e\u043c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u043d\u0430 <a href=\"https:\/\/otus.pw\/tkiH\/\">\u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0432\u0435\u0431\u0438\u043d\u0430\u0440<\/a>, \u0433\u0434\u0435 \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e SpringBoot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0441 \u0434\u0432\u0443\u043c\u044f \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0440\u0435\u043b\u044f\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u0442\u0430\u043a \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e SpringData-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438.<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/otus.pw\/tkiH\/\">\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0432\u0435\u0431\u0438\u043d\u0430\u0440<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/707724\/\"> https:\/\/habr.com\/ru\/company\/otus\/blog\/707724\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-343161","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=343161"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/343161\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=343161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=343161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=343161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}