diff --git a/agrest-cayenne/src/test/java/io/agrest/cayenne/GET_ReadAccess_OverlayIT.java b/agrest-cayenne/src/test/java/io/agrest/cayenne/GET_ReadAccess_OverlayIT.java index ed26767cd..0027f59be 100644 --- a/agrest-cayenne/src/test/java/io/agrest/cayenne/GET_ReadAccess_OverlayIT.java +++ b/agrest-cayenne/src/test/java/io/agrest/cayenne/GET_ReadAccess_OverlayIT.java @@ -2,7 +2,7 @@ import io.agrest.Ag; import io.agrest.DataResponse; -import io.agrest.access.PropertyAccessBuilder; +import io.agrest.filter.PropertyFilteringRulesBuilder; import io.agrest.cayenne.cayenne.main.E2; import io.agrest.cayenne.cayenne.main.E3; import io.agrest.cayenne.cayenne.main.E4; @@ -75,7 +75,7 @@ public static class Resource { public DataResponse getObjects_LimitAttributes(@Context UriInfo uriInfo) { return Ag.select(E4.class, config).uri(uriInfo) - .propertyAccess(E4.class, r -> r.empty().id(true).property("cInt", true)) + .propFilter(E4.class, r -> r.empty().id(true).property("cInt", true)) .get(); } @@ -86,7 +86,7 @@ public DataResponse getE2_E3s_Constrained(@PathParam("id") int id, @Context return Ag.select(E3.class, config) .parent(E2.class, id, "e3s") .uri(uriInfo) - .propertyAccess(E3.class, PropertyAccessBuilder::idOnly) + .propFilter(E3.class, PropertyFilteringRulesBuilder::idOnly) .get(); } } diff --git a/agrest-cayenne/src/test/java/io/agrest/cayenne/POST_ReadAccess_OverlayIT.java b/agrest-cayenne/src/test/java/io/agrest/cayenne/POST_ReadAccess_OverlayIT.java index a90aacd39..b62238dd9 100644 --- a/agrest-cayenne/src/test/java/io/agrest/cayenne/POST_ReadAccess_OverlayIT.java +++ b/agrest-cayenne/src/test/java/io/agrest/cayenne/POST_ReadAccess_OverlayIT.java @@ -123,7 +123,7 @@ public static class Resource { @Path("e3/constrained") public DataResponse insertE3ReadConstrained(@Context UriInfo uriInfo, String requestBody) { return Ag.create(E3.class, config).uri(uriInfo) - .propertyReadAccess(E3.class, b -> b.idOnly().property("name", true)) + .readablePropFilter(E3.class, b -> b.idOnly().property("name", true)) .syncAndSelect(requestBody); } @@ -131,7 +131,7 @@ public DataResponse insertE3ReadConstrained(@Context UriInfo uriInfo, String @Path("e3/w/constrained") public DataResponse insertE3WriteConstrained(@Context UriInfo uriInfo, String requestBody) { return Ag.create(E3.class, config).uri(uriInfo) - .propertyWriteAccess(E3.class, b -> b.idOnly().property("name", true)) + .writeablePropFilter(E3.class, b -> b.idOnly().property("name", true)) .syncAndSelect(requestBody); } @@ -143,7 +143,7 @@ public SimpleResponse create_WriteConstrainedId( String requestBody) { return Ag.create(E8.class, config).uri(uriInfo).id(id) - .propertyWriteAccess(E8.class, b -> b.idOnly().property("name", true)) + .writeablePropFilter(E8.class, b -> b.idOnly().property("name", true)) .sync(requestBody); } @@ -154,7 +154,7 @@ public SimpleResponse create_WriteConstrainedIdBlocked( @Context UriInfo uriInfo, String requestBody) { return Ag.create(E8.class, config).uri(uriInfo).id(id) - .propertyWriteAccess(E8.class, b -> b.empty().property("name", true)) + .writeablePropFilter(E8.class, b -> b.empty().property("name", true)) .sync(requestBody); } } diff --git a/agrest-engine/src/main/java/io/agrest/SelectBuilder.java b/agrest-engine/src/main/java/io/agrest/SelectBuilder.java index b59d53318..7146990fb 100644 --- a/agrest-engine/src/main/java/io/agrest/SelectBuilder.java +++ b/agrest-engine/src/main/java/io/agrest/SelectBuilder.java @@ -5,7 +5,7 @@ import io.agrest.encoder.EntityEncoderFilter; import io.agrest.meta.AgEntity; import io.agrest.meta.AgEntityOverlay; -import io.agrest.access.PropertyAccessRules; +import io.agrest.filter.PropertyFilter; import io.agrest.processor.Processor; import io.agrest.processor.ProcessorOutcome; import io.agrest.runtime.AgBuilder; @@ -87,22 +87,23 @@ public interface SelectBuilder { * @param constraint an instance of Constraint function. * @return this builder instance. * @since 2.4 - * @deprecated since 4.8 in favor of {@link #propertyAccess(Class, PropertyAccessRules)}. + * @deprecated since 4.8 in favor of {@link #propFilter(Class, PropertyFilter)}. */ @Deprecated SelectBuilder constraint(Constraint constraint); /** - * Applies provided property access rules to the current request, defining which attributes and relationships a - * client can see for the specified entity type. Can be called multiple times to add multiple rules for same entity - * or different entities. So the "entityType" parameter can match the root entity or can be any other entity in the - * model. This method is a shortcut for "entityOverlay(AgEntity.overlay(entityType).readAccess(accessRules))". + * Adds a {@link PropertyFilter} that define property access rules for the current request and a given entity. I.e. + * which entity attributes, relationships and ids a client is allowed to see. Can be called multiple times to add + * multiple rules for same entity or different entities. The "entityType" parameter can match the root entity or + * can be any other entity in the model. This method is a shortcut for + * entityOverlay(AgEntity.overlay(entityType).readablePropFilter(filter)) * * @return this builder instance * @since 4.8 */ - default SelectBuilder propertyAccess(Class entityType, PropertyAccessRules rules) { - return entityOverlay(AgEntity.overlay(entityType).readAccess(rules)); + default SelectBuilder propFilter(Class entityType, PropertyFilter filter) { + return entityOverlay(AgEntity.overlay(entityType).readablePropFilter(filter)); } /** diff --git a/agrest-engine/src/main/java/io/agrest/UpdateBuilder.java b/agrest-engine/src/main/java/io/agrest/UpdateBuilder.java index 7c1f111ac..1d3c3a5fc 100644 --- a/agrest-engine/src/main/java/io/agrest/UpdateBuilder.java +++ b/agrest-engine/src/main/java/io/agrest/UpdateBuilder.java @@ -1,6 +1,6 @@ package io.agrest; -import io.agrest.access.PropertyAccessRules; +import io.agrest.filter.PropertyFilter; import io.agrest.constraints.Constraint; import io.agrest.meta.AgEntity; import io.agrest.meta.AgEntityOverlay; @@ -62,7 +62,7 @@ public interface UpdateBuilder { * @param constraint an instance of Constraint function. * @return this builder instance. * @since 2.4 - * @deprecated since 4.8 in favor of {@link #propertyReadAccess(Class, PropertyAccessRules)} + * @deprecated since 4.8 in favor of {@link #readablePropFilter(Class, PropertyFilter)} */ @Deprecated UpdateBuilder readConstraint(Constraint constraint); @@ -73,35 +73,37 @@ public interface UpdateBuilder { * * @param constraint an instance of Constraint function. * @return this builder instance - * @deprecated since 4.8 in favor of {@link #propertyWriteAccess(Class, PropertyAccessRules)} + * @deprecated since 4.8 in favor of {@link #writeablePropFilter(Class, PropertyFilter)} */ @Deprecated UpdateBuilder writeConstraint(Constraint constraint); /** - * Applies provided property read access rules to the current request, defining which attributes and relationships a - * client can view for the specified entity type. Can be called multiple times to add multiple rules for same entity - * or different entities. So the "entityType" parameter can match the root entity or can be any other entity in the - * model. This method is a shortcut for "entityOverlay(AgEntity.overlay(entityType).readAccess(accessRules))". + * Adds a {@link PropertyFilter} that define property read access rules for the current request and a given entity. + * I.e. which entity attributes, relationships and ids a client is allowed to see. Can be called multiple times to add + * multiple rules for same entity or different entities. The "entityType" parameter can match the root entity or + * can be any other entity in the model. This method is a shortcut for + * entityOverlay(AgEntity.overlay(entityType).readablePropFilter(filter)) * * @return this builder instance * @since 4.8 */ - default UpdateBuilder propertyReadAccess(Class entityType, PropertyAccessRules rules) { - return entityOverlay(AgEntity.overlay(entityType).readAccess(rules)); + default UpdateBuilder readablePropFilter(Class entityType, PropertyFilter rules) { + return entityOverlay(AgEntity.overlay(entityType).readablePropFilter(rules)); } /** - * Applies provided property write access rules to the current request, defining which attributes and relationships a - * client can modify for the specified entity type. Can be called multiple times to add multiple rules for same entity - * or different entities. So the "entityType" parameter can match the root entity or can be any other entity in the - * model. This method is a shortcut for "entityOverlay(AgEntity.overlay(entityType).writeAccess(accessRules))". + * Adds a {@link PropertyFilter} that define property write access rules for the current request and a given entity. + * I.e. which entity attributes, relationships and ids a client is allowed to see. Can be called multiple times to add + * multiple rules for same entity or different entities. The "entityType" parameter can match the root entity or + * can be any other entity in the model. This method is a shortcut for + * entityOverlay(AgEntity.overlay(entityType).writeablePropFilter(filter)) * * @return this builder instance * @since 4.8 */ - default UpdateBuilder propertyWriteAccess(Class entityType, PropertyAccessRules rules) { - return entityOverlay(AgEntity.overlay(entityType).writeAccess(rules)); + default UpdateBuilder writeablePropFilter(Class entityType, PropertyFilter rules) { + return entityOverlay(AgEntity.overlay(entityType).writablePropFilter(rules)); } /** diff --git a/agrest-engine/src/main/java/io/agrest/access/PropertyAccessRules.java b/agrest-engine/src/main/java/io/agrest/access/PropertyAccessRules.java deleted file mode 100644 index a4374771e..000000000 --- a/agrest-engine/src/main/java/io/agrest/access/PropertyAccessRules.java +++ /dev/null @@ -1,30 +0,0 @@ -package io.agrest.access; - -import java.util.Objects; - -/** - * Encapsulates logic for creating custom property access rules for a single entity. The logic is implemented in the - * {@link #apply(PropertyAccessBuilder)} method, where custom code can invoke various access rules on an instance of - * {@link PropertyAccessBuilder}. - * - * @see io.agrest.SelectBuilder#propertyAccess(Class, PropertyAccessRules) - * @since 4.7 - */ -@FunctionalInterface -public interface PropertyAccessRules { - - /** - * Configures access rules of the provided {@link PropertyAccessBuilder}. - * - * @param accessConfig - */ - void apply(PropertyAccessBuilder accessConfig); - - default PropertyAccessRules andThen(PropertyAccessRules after) { - Objects.requireNonNull(after); - return pa -> { - apply(pa); - after.apply(pa); - }; - } -} diff --git a/agrest-engine/src/main/java/io/agrest/constraints/Constraint.java b/agrest-engine/src/main/java/io/agrest/constraints/Constraint.java index 27f16db86..93243a3be 100644 --- a/agrest-engine/src/main/java/io/agrest/constraints/Constraint.java +++ b/agrest-engine/src/main/java/io/agrest/constraints/Constraint.java @@ -1,5 +1,6 @@ package io.agrest.constraints; +import io.agrest.filter.PropertyFilter; import io.agrest.meta.AgEntity; import java.util.function.Function; @@ -8,7 +9,7 @@ * Metadata constraint, essentially a function that creates {@link ConstrainedAgEntity} from {@link AgEntity}. * * @since 2.4 - * @deprecated since 4.8 in favor of non-hierarchical per-entity {@link io.agrest.access.PropertyAccessRules} API + * @deprecated since 4.8 in favor of non-hierarchical per-entity {@link PropertyFilter} API */ @Deprecated public interface Constraint extends Function, ConstrainedAgEntity> { diff --git a/agrest-engine/src/main/java/io/agrest/constraints/ConstraintsBuilder.java b/agrest-engine/src/main/java/io/agrest/constraints/ConstraintsBuilder.java index e9fa078ac..08050a36d 100644 --- a/agrest-engine/src/main/java/io/agrest/constraints/ConstraintsBuilder.java +++ b/agrest-engine/src/main/java/io/agrest/constraints/ConstraintsBuilder.java @@ -1,6 +1,7 @@ package io.agrest.constraints; import io.agrest.PathConstants; +import io.agrest.filter.PropertyFilter; import io.agrest.base.protocol.Exp; import io.agrest.meta.AgEntity; import io.agrest.meta.AgRelationship; @@ -13,7 +14,7 @@ * in this class returns a new copy of Constraints, so it is safe to reuse instances including intermediate instances. * * @since 1.3 - * @deprecated since 4.8 in favor of non-hierarchical per-entity {@link io.agrest.access.PropertyAccessRules} API + * @deprecated since 4.8 in favor of non-hierarchical per-entity {@link PropertyFilter} API */ @Deprecated public class ConstraintsBuilder implements Constraint { diff --git a/agrest-engine/src/main/java/io/agrest/filter/PropertyFilter.java b/agrest-engine/src/main/java/io/agrest/filter/PropertyFilter.java new file mode 100644 index 000000000..48dd598fb --- /dev/null +++ b/agrest-engine/src/main/java/io/agrest/filter/PropertyFilter.java @@ -0,0 +1,28 @@ +package io.agrest.filter; + +import java.util.Objects; + +/** + * Encapsulates logic for creation of custom property access rules for a single entity. The logic is implemented in the + * {@link #apply(PropertyFilteringRulesBuilder)} method, where custom code invokes methods on an instance of + * {@link PropertyFilteringRulesBuilder} to define access rules. + * + * @see io.agrest.SelectBuilder#propFilter(Class, PropertyFilter) + * @since 4.7 + */ +@FunctionalInterface +public interface PropertyFilter { + + /** + * Configures property access rules via the provided {@link PropertyFilteringRulesBuilder}. + */ + void apply(PropertyFilteringRulesBuilder accessConfig); + + default PropertyFilter andThen(PropertyFilter after) { + Objects.requireNonNull(after); + return pa -> { + apply(pa); + after.apply(pa); + }; + } +} diff --git a/agrest-engine/src/main/java/io/agrest/access/PropertyAccessBuilder.java b/agrest-engine/src/main/java/io/agrest/filter/PropertyFilteringRulesBuilder.java similarity index 88% rename from agrest-engine/src/main/java/io/agrest/access/PropertyAccessBuilder.java rename to agrest-engine/src/main/java/io/agrest/filter/PropertyFilteringRulesBuilder.java index 54a802482..7b61ee57b 100644 --- a/agrest-engine/src/main/java/io/agrest/access/PropertyAccessBuilder.java +++ b/agrest-engine/src/main/java/io/agrest/filter/PropertyFilteringRulesBuilder.java @@ -1,4 +1,4 @@ -package io.agrest.access; +package io.agrest.filter; import io.agrest.PathConstants; import io.agrest.meta.AgEntity; @@ -15,10 +15,10 @@ * A mutable builder of property access constraints for a single entity. Used to configure property access in * {@link AgEntityOverlay}. * - * @see PropertyAccessRules#apply(PropertyAccessBuilder) + * @see PropertyFilter#apply(PropertyFilteringRulesBuilder) * @since 4.8 */ -public class PropertyAccessBuilder { +public class PropertyFilteringRulesBuilder { // Since we can't resolve the access rules until we are given an entity, // we must store them as "filter" operations in the order they were specified. @@ -26,14 +26,14 @@ public class PropertyAccessBuilder { // set of properties private final List>> accessFilters; - public PropertyAccessBuilder() { + public PropertyFilteringRulesBuilder() { this.accessFilters = new ArrayList<>(); } /** * Creates a rule to block access to all properties (ids, attributes, relationships) from the entity model. */ - public PropertyAccessBuilder empty() { + public PropertyFilteringRulesBuilder empty() { accessFilters.add(ExcludeBuilder::excludeEverything); return this; } @@ -41,7 +41,7 @@ public PropertyAccessBuilder empty() { /** * Creates a rule to block access to all properties, but allows access to id */ - public PropertyAccessBuilder idOnly() { + public PropertyFilteringRulesBuilder idOnly() { accessFilters.add(ExcludeBuilder::includeIdOnly); return this; } @@ -49,14 +49,14 @@ public PropertyAccessBuilder idOnly() { /** * Sets an access rule for the id property. */ - public PropertyAccessBuilder id(boolean accessible) { + public PropertyFilteringRulesBuilder id(boolean accessible) { return property(PathConstants.ID_PK_ATTRIBUTE, accessible); } /** * Sets an access rule for all attribute properties. */ - public PropertyAccessBuilder attributes(boolean accessible) { + public PropertyFilteringRulesBuilder attributes(boolean accessible) { accessFilters.add(accessible ? ExcludeBuilder::includeAllAttributes : ExcludeBuilder::excludeAllAttributes); @@ -67,7 +67,7 @@ public PropertyAccessBuilder attributes(boolean accessible) { /** * Sets an access rule for all relationship properties. */ - public PropertyAccessBuilder relationships(boolean accessible) { + public PropertyFilteringRulesBuilder relationships(boolean accessible) { accessFilters.add(accessible ? ExcludeBuilder::includeAllRelationships : ExcludeBuilder::excludeAllRelationships); @@ -78,7 +78,7 @@ public PropertyAccessBuilder relationships(boolean accessible) { /** * Sets am access rule for a given named property, that can be an attribute, a relationship or an id. */ - public PropertyAccessBuilder property(String name, boolean accessible) { + public PropertyFilteringRulesBuilder property(String name, boolean accessible) { accessFilters.add(accessible ? b -> b.includeProperty(name) : b -> b.excludeProperty(name)); diff --git a/agrest-engine/src/main/java/io/agrest/meta/AgEntityOverlay.java b/agrest-engine/src/main/java/io/agrest/meta/AgEntityOverlay.java index fa2cf5db3..74495d0cb 100644 --- a/agrest-engine/src/main/java/io/agrest/meta/AgEntityOverlay.java +++ b/agrest-engine/src/main/java/io/agrest/meta/AgEntityOverlay.java @@ -1,7 +1,7 @@ package io.agrest.meta; -import io.agrest.access.PropertyAccessBuilder; -import io.agrest.access.PropertyAccessRules; +import io.agrest.filter.PropertyFilteringRulesBuilder; +import io.agrest.filter.PropertyFilter; import io.agrest.property.PropertyReader; import io.agrest.resolver.NestedDataResolver; import io.agrest.resolver.NestedDataResolverFactory; @@ -30,8 +30,8 @@ public class AgEntityOverlay { private final Map relationships; private RootDataResolver rootDataResolver; - private PropertyAccessRules readAccessRules; - private PropertyAccessRules writeAccessRules; + private PropertyFilter readablePropFilter; + private PropertyFilter writablePropFilter; public AgEntityOverlay(Class type) { this.type = type; @@ -63,7 +63,7 @@ public AgEntity resolve(AgDataMap agDataMap, AgEntity maybeOverlaid) { // TODO: support null entity like we do for overlaid Attributes and Relationships? Objects.requireNonNull(maybeOverlaid); - if (attributes.isEmpty() && relationships.isEmpty() && readAccessRules == null && writeAccessRules == null) { + if (attributes.isEmpty() && relationships.isEmpty() && readablePropFilter == null && writablePropFilter == null) { return maybeOverlaid; } @@ -72,15 +72,15 @@ public AgEntity resolve(AgDataMap agDataMap, AgEntity maybeOverlaid) { getAttributeOverlays().forEach(resolver::loadAttributeOverlay); getRelationshipOverlays().forEach(resolver::loadRelationshipOverlay); - if (readAccessRules != null) { - PropertyAccessBuilder pa = new PropertyAccessBuilder(); - readAccessRules.apply(pa); + if (readablePropFilter != null) { + PropertyFilteringRulesBuilder pa = new PropertyFilteringRulesBuilder(); + readablePropFilter.apply(pa); pa.resolveInaccessible(maybeOverlaid, this).forEach(resolver::makeUnreadable); } - if (writeAccessRules != null) { - PropertyAccessBuilder pa = new PropertyAccessBuilder(); - writeAccessRules.apply(pa); + if (writablePropFilter != null) { + PropertyFilteringRulesBuilder pa = new PropertyFilteringRulesBuilder(); + writablePropFilter.apply(pa); pa.resolveInaccessible(maybeOverlaid, this).forEach(resolver::makeUnwritable); } @@ -104,12 +104,12 @@ public AgEntityOverlay merge(AgEntityOverlay anotherOverlay) { attributes.putAll(anotherOverlay.attributes); relationships.putAll(anotherOverlay.relationships); - if (anotherOverlay.readAccessRules != null) { - readAccess(anotherOverlay.readAccessRules); + if (anotherOverlay.readablePropFilter != null) { + readablePropFilter(anotherOverlay.readablePropFilter); } - if (anotherOverlay.writeAccessRules != null) { - writeAccess(anotherOverlay.writeAccessRules); + if (anotherOverlay.writablePropFilter != null) { + writablePropFilter(anotherOverlay.writablePropFilter); } if (anotherOverlay.getRootDataResolver() != null) { @@ -158,22 +158,22 @@ public RootDataResolver getRootDataResolver() { } /** - * Appends read access rules specified as a PropertyAccess consumer to the existing rules. + * Adds a {@link PropertyFilter} to any existing read filters in this overlay. * * @since 4.8 */ - public AgEntityOverlay readAccess(PropertyAccessRules accessBuilder) { - this.readAccessRules = readAccessRules != null ? readAccessRules.andThen(accessBuilder) : accessBuilder; + public AgEntityOverlay readablePropFilter(PropertyFilter filter) { + this.readablePropFilter = readablePropFilter != null ? readablePropFilter.andThen(filter) : filter; return this; } /** - * Appends read access rules specified as a PropertyAccess consumer to the existing rules. + * Adds a {@link PropertyFilter} to any existing write filters in this overlay. * * @since 4.8 */ - public AgEntityOverlay writeAccess(PropertyAccessRules accessBuilder) { - this.writeAccessRules = writeAccessRules != null ? writeAccessRules.andThen(accessBuilder) : accessBuilder; + public AgEntityOverlay writablePropFilter(PropertyFilter filter) { + this.writablePropFilter = writablePropFilter != null ? writablePropFilter.andThen(filter) : filter; return this; } @@ -182,13 +182,13 @@ public AgEntityOverlay writeAccess(PropertyAccessRules accessBuilder) { * * @return this overlay instance * @since 3.7 - * @deprecated since 4.8 use {@link #readAccess(PropertyAccessRules)} and/or {@link #writeAccess(PropertyAccessRules)} + * @deprecated since 4.8 use {@link #readablePropFilter(PropertyFilter)} and/or {@link #writablePropFilter(PropertyFilter)} */ @Deprecated public AgEntityOverlay exclude(String... properties) { List asList = asList(properties); - readAccess(pa -> asList.forEach(p -> pa.property(p, false))); - writeAccess(pa -> asList.forEach(p -> pa.property(p, false))); + readablePropFilter(pa -> asList.forEach(p -> pa.property(p, false))); + writablePropFilter(pa -> asList.forEach(p -> pa.property(p, false))); return this; } diff --git a/agrest-engine/src/test/java/io/agrest/access/PropertyAccessBuilderTest.java b/agrest-engine/src/test/java/io/agrest/filter/PropertyFilteringRulesBuilderTest.java similarity index 71% rename from agrest-engine/src/test/java/io/agrest/access/PropertyAccessBuilderTest.java rename to agrest-engine/src/test/java/io/agrest/filter/PropertyFilteringRulesBuilderTest.java index bee749506..86055d21d 100644 --- a/agrest-engine/src/test/java/io/agrest/access/PropertyAccessBuilderTest.java +++ b/agrest-engine/src/test/java/io/agrest/filter/PropertyFilteringRulesBuilderTest.java @@ -1,4 +1,4 @@ -package io.agrest.access; +package io.agrest.filter; import io.agrest.meta.AgEntity; import io.agrest.pojo.model.P11; @@ -13,20 +13,20 @@ import static java.util.Arrays.asList; import static org.junit.jupiter.api.Assertions.assertEquals; -public class PropertyAccessBuilderTest extends PojoTest { +public class PropertyFilteringRulesBuilderTest extends PojoTest { @BQTestTool static final AgPojoTester tester = tester().build(); @Test public void testDefault_AllAvailable() { - PropertyAccessBuilder pab = new PropertyAccessBuilder(); + PropertyFilteringRulesBuilder pab = new PropertyFilteringRulesBuilder(); assertInaccessible(pab.resolveInaccessible(tester.entity(P11.class), AgEntity.overlay(P11.class))); } @Test public void testDefault_AllAvailable_WithOverlay() { - PropertyAccessBuilder pab = new PropertyAccessBuilder(); + PropertyFilteringRulesBuilder pab = new PropertyFilteringRulesBuilder(); assertInaccessible(pab.resolveInaccessible( tester.entity(P11.class), AgEntity.overlay(P11.class).redefineAttribute("x", String.class, p11 -> "a"))); @@ -34,38 +34,38 @@ public void testDefault_AllAvailable_WithOverlay() { @Test public void testEmpty() { - PropertyAccessBuilder pab = new PropertyAccessBuilder().empty(); + PropertyFilteringRulesBuilder pab = new PropertyFilteringRulesBuilder().empty(); assertInaccessible(pab.resolveInaccessible(tester.entity(P11.class), AgEntity.overlay(P11.class)), "id", "intProp", "p6"); } @Test public void testIdOnly() { - PropertyAccessBuilder pab = new PropertyAccessBuilder().idOnly(); + PropertyFilteringRulesBuilder pab = new PropertyFilteringRulesBuilder().idOnly(); assertInaccessible(pab.resolveInaccessible(tester.entity(P11.class), AgEntity.overlay(P11.class)), "intProp", "p6"); } @Test public void testId() { - PropertyAccessBuilder pab = new PropertyAccessBuilder().empty().id(true); + PropertyFilteringRulesBuilder pab = new PropertyFilteringRulesBuilder().empty().id(true); assertInaccessible(pab.resolveInaccessible(tester.entity(P11.class), AgEntity.overlay(P11.class)), "intProp", "p6"); } @Test public void testAllButId() { - PropertyAccessBuilder pab = new PropertyAccessBuilder().empty().attributes(true).relationships(true); + PropertyFilteringRulesBuilder pab = new PropertyFilteringRulesBuilder().empty().attributes(true).relationships(true); assertInaccessible(pab.resolveInaccessible(tester.entity(P11.class), AgEntity.overlay(P11.class)), "id"); } @Test public void testExcludeByName() { - PropertyAccessBuilder pab = new PropertyAccessBuilder().property("intProp", false); + PropertyFilteringRulesBuilder pab = new PropertyFilteringRulesBuilder().property("intProp", false); assertInaccessible(pab.resolveInaccessible(tester.entity(P11.class), AgEntity.overlay(P11.class)), "intProp"); } @Test public void testExcludeByName_InOverlay() { - PropertyAccessBuilder pab = new PropertyAccessBuilder().property("x", false); + PropertyFilteringRulesBuilder pab = new PropertyFilteringRulesBuilder().property("x", false); assertInaccessible(pab.resolveInaccessible( tester.entity(P11.class),