Skip to content

Commit

Permalink
SHIBUI-1788
Browse files Browse the repository at this point in the history
Updates to incorporate the React changes to the UI with these changes
  • Loading branch information
chasegawa committed Jun 15, 2021
1 parent 73beec3 commit ebbbe1a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class JsonSchemaBuilderService {
def properties = [:]
customPropertiesConfiguration.getOverrides().each {
def property
if (it['displayType'] == 'list'
|| it['displayType'] == 'set') {
if (it['displayType'] == 'list' || it['displayType'] == 'set' || it['displayType'] == 'selection_list') {
property = [$ref: '#/definitions/' + it['name']]
} else {
property =
Expand All @@ -46,13 +45,13 @@ class JsonSchemaBuilderService {

void addRelyingPartyOverridesCollectionDefinitionsToJson(Object json) {
customPropertiesConfiguration.getOverrides().stream().filter {
it -> it['displayType'] && (it['displayType'] == 'list' || it['displayType'] == 'set')
it -> it['displayType'] && (it['displayType'] == 'list' || it['displayType'] == 'set' || it['displayType'] == 'selection_list')
}.each {
def definition = [title : it['displayName'],
description: it['helpText'],
type : 'array',
default : null]
if (it['displayType'] == 'set') {
if (it['displayType'] == 'set' || it['displayType'] == 'selection_list') {
definition['uniqueItems'] = true
} else if (it['displayType'] == 'list') {
definition['uniqueItems'] = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import javax.persistence.Id;
import javax.persistence.JoinColumn;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.envers.Audited;

import lombok.Data;
Expand All @@ -18,13 +20,9 @@
@Audited
@Data
public class CustomEntityAttributeDefinition implements IRelyingPartyOverrideProperty {
@Id
@Column(nullable = false)
String name;

@Column(name = "attribute_friendly_name", nullable = true)
String attributeFriendlyName;

@Column(name = "attribute_name", nullable = true)
String attributeName;

Expand All @@ -33,43 +31,51 @@ public class CustomEntityAttributeDefinition implements IRelyingPartyOverridePro

@ElementCollection
@CollectionTable(name = "custom_entity_attr_list_items", joinColumns = @JoinColumn(name = "name"))
@Fetch(FetchMode.JOIN)
@Column(name = "value", nullable = false)
Set<String> customAttrListDefinitions = new HashSet<>();

@Column(name = "default_value", nullable = true)
String defaultValue;

@Column(name = "display_name", nullable = true)
String displayName;

@Column(name = "display_type", nullable = true)
String displayType;

@Column(name = "help_text", nullable = true)
String helpText;

@Column(name = "invert", nullable = true)
String invert;

@Id
@Column(nullable = false)
String name;

@Column(name = "persist_type", nullable = true)
String persistType;

@Column(name = "persist_value", nullable = true)
String persistValue;

@Override
public Set<String> getDefaultValues() {
return customAttrListDefinitions;
}

@Override
public Boolean getFromConfigFile() {
return Boolean.FALSE;
public String getDisplayName() {
// This is here only to ensure proper functionality works until the full definition is revised with all the fields
return displayName == null ? "DEFAULTED to name: " + name : displayName;
}

@Override
public String getPersistType() {
return attributeType.toString();
public String getDisplayType() {
return attributeType.name().toLowerCase();
}

@Override
public String getPersistValue() {
// Definitions don't have a persist value, here to comply with the interface only
return null;
public Boolean getFromConfigFile() {
return Boolean.FALSE;
}

@Override
Expand All @@ -78,14 +84,7 @@ public void setDefaultValues(Set<String> defaultValues) {
}

@Override
public void setPersistType(String persistType) {
// This is "attributeType", but this is only here to comply with the interface, we don't intend for this to be
// used, we want to match up against the actual ENUM types of CustomAttributeType
}

@Override
public void setPersistValue(String persistValue) {
// Definitions don't have a persist value, here to comply with the interface only
}

public void setDisplayType(String displayType) {
// This is here to comply with the interface only and should not be used to change the value in this implementation
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ public interface IRelyingPartyOverrideProperty {
public String getAttributeFriendlyName();

public String getAttributeName();


public CustomAttributeType getAttributeType();

public String getDefaultValue();

public Set<String> getDefaultValues();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,21 @@ public class RelyingPartyOverrideProperty implements IRelyingPartyOverrideProper
private String name;
private String persistType;
private String persistValue;

@Override
public Boolean getFromConfigFile() {
return Boolean.TRUE;
}

@Override
public CustomAttributeType getAttributeType() {
switch (displayType) {
case ("set"):
case ("list"):
return CustomAttributeType.SELECTION_LIST;
default:
return CustomAttributeType.valueOf(displayType.toUpperCase());
}

}
}

0 comments on commit ebbbe1a

Please sign in to comment.