Skip to content

Commit

Permalink
SHIBUI-522: refactoring REST controller for polymorphic filters endpo…
Browse files Browse the repository at this point in the history
…ints
  • Loading branch information
dima767 committed Jun 4, 2018
1 parent c05339a commit cc439e1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ public ResponseEntity<?> update(@PathVariable String metadataResolverId, @Reques
filter.setName(updatedFilter.getName());
filter.setFilterEnabled(updatedFilter.isFilterEnabled());
filter.setEntityAttributesFilterTarget(updatedFilter.getEntityAttributesFilterTarget());
filter.setAttributes(updatedFilter.getAttributes());
filter.setRelyingPartyOverrides(updatedFilter.getRelyingPartyOverrides());
filter.setAttributeRelease(updatedFilter.getAttributeRelease());
filter.intoTransientRepresentation();

MetadataResolver persistedMr = repository.save(metadataResolver);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public EntityAttributesFilter() {
public void intoTransientRepresentation() {
this.attributeRelease = getAttributeReleaseListFromAttributeList(this.attributes);
this.relyingPartyOverrides = getRelyingPartyOverridesRepresentationFromAttributeList(attributes);
setVersion(hashCode());
}

@PrePersist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
public class MetadataFilter extends AbstractAuditable {

@JsonProperty("@type")
transient String type;
@Transient
String type;

private String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class PolymorphicFiltersJacksonHandlingTests extends Specification {

def "List of filters with correct types"() {
given:
def filters = [testObjectGenerator.entityRoleWhitelistFilter()]
def filters = testObjectGenerator.buildAllTypesOfFilterList();

when:
def json = mapper.writeValueAsString(filters)
Expand Down

0 comments on commit cc439e1

Please sign in to comment.