diff --git a/agrest-engine/src/main/java/io/agrest/runtime/constraints/ReadConstraints.java b/agrest-engine/src/main/java/io/agrest/runtime/constraints/ReadPropertyFilter.java similarity index 97% rename from agrest-engine/src/main/java/io/agrest/runtime/constraints/ReadConstraints.java rename to agrest-engine/src/main/java/io/agrest/runtime/constraints/ReadPropertyFilter.java index 49c66f160..0f1e4cf3c 100644 --- a/agrest-engine/src/main/java/io/agrest/runtime/constraints/ReadConstraints.java +++ b/agrest-engine/src/main/java/io/agrest/runtime/constraints/ReadPropertyFilter.java @@ -11,9 +11,9 @@ import java.util.ArrayList; import java.util.List; -class ReadConstraints { +class ReadPropertyFilter { - private static final Logger LOGGER = LoggerFactory.getLogger(ReadConstraints.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ReadPropertyFilter.class); static void apply(ResourceEntity entity) { diff --git a/agrest-engine/src/main/java/io/agrest/runtime/constraints/SelectConstraints.java b/agrest-engine/src/main/java/io/agrest/runtime/constraints/SelectConstraints.java index df305ce7f..5effb36e4 100644 --- a/agrest-engine/src/main/java/io/agrest/runtime/constraints/SelectConstraints.java +++ b/agrest-engine/src/main/java/io/agrest/runtime/constraints/SelectConstraints.java @@ -8,7 +8,7 @@ public class SelectConstraints { public void apply(SelectContext context) { - ReadConstraints.apply(context.getEntity()); - SizeConstraints.apply(context.getEntity(), context.getSizeConstraints()); + ReadPropertyFilter.apply(context.getEntity()); + SizeFilter.apply(context.getEntity(), context.getSizeConstraints()); } } diff --git a/agrest-engine/src/main/java/io/agrest/runtime/constraints/SizeConstraints.java b/agrest-engine/src/main/java/io/agrest/runtime/constraints/SizeFilter.java similarity index 86% rename from agrest-engine/src/main/java/io/agrest/runtime/constraints/SizeConstraints.java rename to agrest-engine/src/main/java/io/agrest/runtime/constraints/SizeFilter.java index 5fc679268..356058135 100644 --- a/agrest-engine/src/main/java/io/agrest/runtime/constraints/SizeConstraints.java +++ b/agrest-engine/src/main/java/io/agrest/runtime/constraints/SizeFilter.java @@ -1,14 +1,15 @@ package io.agrest.runtime.constraints; import io.agrest.ResourceEntity; +import io.agrest.SizeConstraints; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -class SizeConstraints { +class SizeFilter { - private static final Logger LOGGER = LoggerFactory.getLogger(SizeConstraints.class); + private static final Logger LOGGER = LoggerFactory.getLogger(SizeFilter.class); - public static void apply(ResourceEntity entity, io.agrest.SizeConstraints constraints) { + public static void apply(ResourceEntity entity, SizeConstraints constraints) { if (constraints != null) { // fetchOffset - do not exceed source offset diff --git a/agrest-engine/src/main/java/io/agrest/runtime/constraints/UpdateConstraints.java b/agrest-engine/src/main/java/io/agrest/runtime/constraints/UpdateConstraints.java index 388690618..aacb59def 100644 --- a/agrest-engine/src/main/java/io/agrest/runtime/constraints/UpdateConstraints.java +++ b/agrest-engine/src/main/java/io/agrest/runtime/constraints/UpdateConstraints.java @@ -8,7 +8,7 @@ public class UpdateConstraints { public void apply(UpdateContext context) { - WriteConstraints.apply(context.getEntity(), context.getUpdates()); - ReadConstraints.apply(context.getEntity()); + WritePropertyFilter.apply(context.getEntity(), context.getUpdates()); + ReadPropertyFilter.apply(context.getEntity()); } } diff --git a/agrest-engine/src/main/java/io/agrest/runtime/constraints/WriteConstraints.java b/agrest-engine/src/main/java/io/agrest/runtime/constraints/WritePropertyFilter.java similarity index 98% rename from agrest-engine/src/main/java/io/agrest/runtime/constraints/WriteConstraints.java rename to agrest-engine/src/main/java/io/agrest/runtime/constraints/WritePropertyFilter.java index 5c34d3ad0..ca13402dd 100644 --- a/agrest-engine/src/main/java/io/agrest/runtime/constraints/WriteConstraints.java +++ b/agrest-engine/src/main/java/io/agrest/runtime/constraints/WritePropertyFilter.java @@ -16,9 +16,9 @@ import java.util.Set; import java.util.function.Consumer; -class WriteConstraints { +class WritePropertyFilter { - private static final Logger LOGGER = LoggerFactory.getLogger(WriteConstraints.class); + private static final Logger LOGGER = LoggerFactory.getLogger(WritePropertyFilter.class); public static void apply(ResourceEntity entity, Collection> updates) { diff --git a/agrest-engine/src/test/java/io/agrest/runtime/constraints/ReadConstraintsTest.java b/agrest-engine/src/test/java/io/agrest/runtime/constraints/ReadPropertyFilterTest.java similarity index 95% rename from agrest-engine/src/test/java/io/agrest/runtime/constraints/ReadConstraintsTest.java rename to agrest-engine/src/test/java/io/agrest/runtime/constraints/ReadPropertyFilterTest.java index dad6faba6..fc6f25350 100644 --- a/agrest-engine/src/test/java/io/agrest/runtime/constraints/ReadConstraintsTest.java +++ b/agrest-engine/src/test/java/io/agrest/runtime/constraints/ReadPropertyFilterTest.java @@ -15,7 +15,7 @@ import static org.junit.jupiter.api.Assertions.*; -public class ReadConstraintsTest { +public class ReadPropertyFilterTest { static final AgSchema schema = new LazySchema(List.of(new AnnotationsAgEntityCompiler(Map.of()))); @@ -28,7 +28,7 @@ public void constrainResponse_Default() { te1.ensureAttribute("a", false); te1.ensureAttribute("b", false); - ReadConstraints.apply(te1); + ReadPropertyFilter.apply(te1); assertEquals(1, te1.getBaseProjection().getAttributes().size()); assertNotNull(te1.getBaseProjection().getAttribute("a")); assertTrue(te1.getChildren().isEmpty()); @@ -43,7 +43,7 @@ public void constrainResponse_None() { te1.ensureAttribute("m", false); te1.ensureAttribute("n", false); - ReadConstraints.apply(te1); + ReadPropertyFilter.apply(te1); assertEquals(2, te1.getBaseProjection().getAttributes().size()); assertNotNull(te1.getBaseProjection().getAttribute("m")); assertNotNull(te1.getBaseProjection().getAttribute("n")); diff --git a/agrest-engine/src/test/java/io/agrest/runtime/constraints/SizeConstraintsTest.java b/agrest-engine/src/test/java/io/agrest/runtime/constraints/SizeFilterTest.java similarity index 87% rename from agrest-engine/src/test/java/io/agrest/runtime/constraints/SizeConstraintsTest.java rename to agrest-engine/src/test/java/io/agrest/runtime/constraints/SizeFilterTest.java index 55718a09c..7acc7547b 100644 --- a/agrest-engine/src/test/java/io/agrest/runtime/constraints/SizeConstraintsTest.java +++ b/agrest-engine/src/test/java/io/agrest/runtime/constraints/SizeFilterTest.java @@ -2,6 +2,7 @@ import io.agrest.ResourceEntity; import io.agrest.RootResourceEntity; +import io.agrest.SizeConstraints; import io.agrest.annotation.AgAttribute; import io.agrest.annotation.AgId; import io.agrest.annotation.AgRelationship; @@ -18,7 +19,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; -public class SizeConstraintsTest { +public class SizeFilterTest { private static AgSchema schema; @@ -33,30 +34,30 @@ public void fetchOffset() { AgEntity entity = schema.getEntity(Tr.class); - io.agrest.SizeConstraints s1 = new io.agrest.SizeConstraints().fetchOffset(5); - io.agrest.SizeConstraints s2 = new io.agrest.SizeConstraints().fetchOffset(0); + SizeConstraints s1 = new SizeConstraints().fetchOffset(5); + SizeConstraints s2 = new SizeConstraints().fetchOffset(0); ResourceEntity t1 = new RootResourceEntity<>(entity); t1.setStart(0); - SizeConstraints.apply(t1, s1); + SizeFilter.apply(t1, s1); assertEquals(0, t1.getStart()); assertEquals(5, s1.getFetchOffset()); ResourceEntity t2 = new RootResourceEntity<>(entity); t2.setStart(3); - SizeConstraints.apply(t2, s1); + SizeFilter.apply(t2, s1); assertEquals(3, t2.getStart()); assertEquals(5, s1.getFetchOffset()); ResourceEntity t3 = new RootResourceEntity<>(entity); t3.setStart(6); - SizeConstraints.apply(t3, s1); + SizeFilter.apply(t3, s1); assertEquals(5, t3.getStart()); assertEquals(5, s1.getFetchOffset()); ResourceEntity t4 = new RootResourceEntity<>(entity); t4.setStart(6); - SizeConstraints.apply(t4, s2); + SizeFilter.apply(t4, s2); assertEquals(6, t4.getStart()); assertEquals(0, s2.getFetchOffset()); } @@ -66,41 +67,41 @@ public void fetchLimit() { AgEntity entity = schema.getEntity(Tr.class); - io.agrest.SizeConstraints s1 = new io.agrest.SizeConstraints().fetchLimit(5); - io.agrest.SizeConstraints s2 = new io.agrest.SizeConstraints().fetchLimit(0); + SizeConstraints s1 = new SizeConstraints().fetchLimit(5); + SizeConstraints s2 = new SizeConstraints().fetchLimit(0); ResourceEntity t1 = new RootResourceEntity<>(entity); - SizeConstraints.apply(t1, s1); + SizeFilter.apply(t1, s1); assertEquals(5, t1.getLimit()); assertEquals(5, s1.getFetchLimit()); ResourceEntity t1_1 = new RootResourceEntity<>(entity); t1_1.setLimit(0); - SizeConstraints.apply(t1_1, s1); + SizeFilter.apply(t1_1, s1); assertEquals(5, t1_1.getLimit()); assertEquals(5, s1.getFetchLimit()); ResourceEntity t1_2 = new RootResourceEntity<>(entity); t1_2.setLimit(-1); - SizeConstraints.apply(t1_2, s1); + SizeFilter.apply(t1_2, s1); assertEquals(5, t1_2.getLimit()); assertEquals(5, s1.getFetchLimit()); ResourceEntity t2 = new RootResourceEntity<>(entity); t2.setLimit(3); - SizeConstraints.apply(t2, s1); + SizeFilter.apply(t2, s1); assertEquals(3, t2.getLimit()); assertEquals(5, s1.getFetchLimit()); ResourceEntity t3 = new RootResourceEntity<>(entity); t3.setLimit(6); - SizeConstraints.apply(t3, s1); + SizeFilter.apply(t3, s1); assertEquals(5, t3.getLimit()); assertEquals(5, s1.getFetchLimit()); ResourceEntity t4 = new RootResourceEntity<>(entity); t4.setLimit(6); - SizeConstraints.apply(t4, s2); + SizeFilter.apply(t4, s2); assertEquals(6, t4.getLimit()); assertEquals(0, s2.getFetchLimit()); }