Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/shadow-meta…
Browse files Browse the repository at this point in the history
…data
  • Loading branch information
1azyman committed Jun 6, 2023
2 parents 15e2dcc + 315f30a commit 5725da0
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,23 @@ private SearchItemType createSearchItem(SearchFilterParameterType parameter) {
SearchItemType searchItemType = new SearchItemType();
searchItemType.setParameter(parameter);
searchItemType.setVisibleByDefault(true);
DisplayType displayType = parameter.getDisplay();
searchItemType.setDisplayName(getSearchItemDisplayName(displayType, parameter));
DisplayType displayType = getSearchItemDisplayName(parameter);
searchItemType.setDisplay(displayType);
searchItemType.setDescription(GuiDisplayTypeUtil.getHelp(displayType));
return searchItemType;
}

private PolyStringType getSearchItemDisplayName(DisplayType displayType, SearchFilterParameterType parameter) {
private DisplayType getSearchItemDisplayName(SearchFilterParameterType parameter) {
if (parameter == null || parameter.getDisplay() == null) {
return new DisplayType();
}
DisplayType displayType = parameter.getDisplay();
PolyStringType searchItemDisplayType = GuiDisplayTypeUtil.getLabel(displayType);
if (searchItemDisplayType == null) {
searchItemDisplayType = new PolyStringType(parameter.getName());
displayType.setLabel(new PolyStringType(parameter.getName()));

}
return searchItemDisplayType;
return displayType;
}

private void processFilterToSearchItem(List<SearchItemType> searchItems, ObjectFilter filter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ public static SearchBoxConfigurationType mergeConfigurations(SearchBoxConfigurat
mergedConfig.setDefaultMode(customizedConfig.getDefaultMode());
}

if (customizedConfig.getDefaultObjectType() != null) {
mergedConfig.setDefaultObjectType(customizedConfig.getDefaultObjectType());
}

if (customizedConfig.getObjectTypeConfiguration() != null) {
mergedConfig.setObjectTypeConfiguration(customizedConfig.getObjectTypeConfiguration());
}
Expand All @@ -70,10 +66,6 @@ public static SearchBoxConfigurationType mergeConfigurations(SearchBoxConfigurat
mergedConfig.setRelationConfiguration(customizedConfig.getRelationConfiguration());
}

if (customizedConfig.getDefaultScope() != null) {
mergedConfig.setDefaultScope(customizedConfig.getDefaultScope());
}

SearchItemsType mergedSearchItems = combineSearchItems(mergedConfig.getSearchItems(), customizedConfig.getSearchItems(), pageBase);
mergedConfig.setSearchItems(mergedSearchItems);
return mergedConfig;
Expand Down Expand Up @@ -156,8 +148,8 @@ private static SearchItemType mergeSearchItem(SearchItemType item, SearchItemTyp
if (customItem.getDescription() != null) {
item.setDescription(customItem.getDescription());
}
if (customItem.getDisplayName() != null) {
item.setDisplayName(customItem.getDisplayName());
if (customItem.getDisplay() != null) {
item.setDisplay(customItem.getDisplay());
}
if (customItem.getParameter() != null) {
item.setParameter(customItem.getParameter());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,7 @@ public boolean isVisible() {
}

public String getDisplayName() {
String name = null;
if (item.getDisplayName() != null) {
name = WebComponentUtil.getTranslatedPolyString(item.getDisplayName());
}
if (StringUtils.isNotEmpty(name)) {
return name;
}
name = WebComponentUtil.getTranslatedPolyString(GuiDisplayTypeUtil.getLabel(item.getDisplay()));
String name = WebComponentUtil.getTranslatedPolyString(GuiDisplayTypeUtil.getLabel(item.getDisplay()));
if (StringUtils.isNotEmpty(name)) {
return name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import javax.xml.namespace.QName;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

public class SearchBoxConfigurationHelper implements Serializable {

Expand Down Expand Up @@ -80,13 +79,6 @@ public void setDefaultObjectType(QName defaultObjectType) {
public ScopeSearchItemConfigurationType getDefaultSearchScopeConfiguration() {
if (defaultScopeConfiguration == null) {
defaultScopeConfiguration = searchBoxConfigurationType.getScopeConfiguration();
if (defaultScopeConfiguration == null) {
defaultScopeConfiguration = new ScopeSearchItemConfigurationType();
}
if (defaultScopeConfiguration.getDefaultValue() == null) {
defaultScopeConfiguration.setDefaultValue(searchBoxConfigurationType.getDefaultScope());
}

if (defaultScopeConfiguration == null) {
defaultScopeConfiguration = new ScopeSearchItemConfigurationType();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1876,6 +1876,18 @@
<xsd:appinfo>
<a:container/>
<a:since>3.6</a:since>
<a:schemaMigration>
<a:element>tns:defaultScope</a:element>
<a:version>4.8</a:version>
<a:operation>removed</a:operation>
<a:comment>Use scopeConfiguration.defaultValue instead</a:comment>
</a:schemaMigration>
<a:schemaMigration>
<a:element>tns:defaultObjectType</a:element>
<a:version>4.8</a:version>
<a:operation>removed</a:operation>
<a:comment>Use objectTypeConfiguration.defaultValue instead</a:comment>
</a:schemaMigration>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
Expand Down Expand Up @@ -1971,39 +1983,7 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="defaultScope" type="tns:SearchBoxScopeType" minOccurs="0" maxOccurs="1" default="oneLevel">
<xsd:annotation>
<xsd:documentation>
The scope of the search box. Scope may not be applicable to all types of lists/views.
E.g. it does not make sense for flat searches. Therefore some views may not even display
scope selection at all.
</xsd:documentation>
<xsd:appinfo>
<a:displayName>SearchBoxConfigurationType.defaultScope</a:displayName>
<a:since>3.9</a:since>
<a:deprecated>true</a:deprecated>
<a:deprecatedSince>4.3</a:deprecatedSince>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="defaultObjectType" type="xsd:QName" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>
Default type of object for search boxes that support object type selection.
E.g. UserType or RoleType. Setting it to ObjectType should display all objects.
Type selection may not be applicable to all types of lists/views.
E.g. it does not make sense for lists that only contain objects of a single type.
Therefore some views may not even display object type selection at all.
</xsd:documentation>
<xsd:appinfo>
<a:displayName>SearchBoxConfigurationType.defaultObjectType</a:displayName>
<a:since>3.9</a:since>
<a:deprecated>true</a:deprecated>
<a:deprecatedSince>4.3</a:deprecatedSince>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="searchItems" type="tns:SearchItemsType" minOccurs="0" maxOccurs="1">
<xsd:element name="searchItems" type="tns:SearchItemsType" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>
The list of searchable properties which should be displayed on the search panel.
Expand Down Expand Up @@ -2346,6 +2326,12 @@
<xsd:appinfo>
<a:container/>
<a:since>4.2</a:since>
<a:schemaMigration>
<a:element>tns:displayName</a:element>
<a:version>4.8</a:version>
<a:operation>removed</a:operation>
<a:comment>Use SearchItemType.display.label instead</a:comment>
</a:schemaMigration>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,12 +611,6 @@ private void compileSearchBox(CompiledObjectCollectionView existingView, GuiObje
SearchBoxConfigurationType oldSearchBoxConfig = existingView.getSearchBoxConfiguration();
if (oldSearchBoxConfig == null || replaceIfExist) {
if (oldSearchBoxConfig != null) {
if (newSearchBoxConfig.getDefaultObjectType() == null) {
newSearchBoxConfig.setDefaultObjectType(oldSearchBoxConfig.getDefaultObjectType());
}
if (newSearchBoxConfig.getDefaultScope() == null) {
newSearchBoxConfig.setDefaultScope(oldSearchBoxConfig.getDefaultScope());
}
if (newSearchBoxConfig.getSearchItems() == null) {
newSearchBoxConfig.setSearchItems(oldSearchBoxConfig.getSearchItems());
}
Expand Down

0 comments on commit 5725da0

Please sign in to comment.