Skip to content

Commit

Permalink
[SHIBUI-1237]
Browse files Browse the repository at this point in the history
handle null boolean
  • Loading branch information
jj committed Feb 22, 2019
1 parent ec8cc06 commit ab6dd4b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,9 @@ public EntityDescriptorRepresentation createRepresentationFromDescriptor(org.ope
}
}

// TODO: fix this; there is a problem with the way that defaults are working and the processing from the front end
ModelRepresentationConversions.completeMe(relyingPartyOverrides);

representation.setRelyingPartyOverrides(relyingPartyOverrides);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,31 @@ public static Map<String, Object> getRelyingPartyOverridesRepresentationFromAttr
}
}

// TODO: fix this; currently there is a problem with not returning a value
completeMe(relyingPartyOverrides);

return relyingPartyOverrides;
}

// TODO: fix this; currently there is a problem with not returning a value
public static Map<String,Object> completeMe(Map<String, Object> relyingPartyOverrides) {
customPropertiesConfiguration
.getOverrides()
.stream()
.filter(o -> !relyingPartyOverrides.containsKey(o.getName()))
.filter(o -> o.getDisplayType().equals("boolean"))
.forEach(p -> relyingPartyOverrides.put(p.getName(), getDefaultValueFromProperty(p)));
return relyingPartyOverrides;
}

private static Object getDefaultValueFromProperty(RelyingPartyOverrideProperty property) {
switch (property.getDisplayType()) {
case "boolean":
return Boolean.getBoolean(property.getDefaultValue());
}
return null;
}

public static Object getOverrideFromAttribute(Attribute attribute) {
RelyingPartyOverrideProperty relyingPartyOverrideProperty = customPropertiesConfiguration.getOverrides().stream()
.filter(it -> it.getAttributeFriendlyName().equals(attribute.getFriendlyName())).findFirst().get();
Expand Down

0 comments on commit ab6dd4b

Please sign in to comment.