Skip to main content

Set up Attribute Suggestion List

Introduction​

Attributes are used in many different places in our application. Either in the facet module to create filter conditions or to group elements or during the creation of Attribute Sets. While it is not strictly necessary to configure an attribute suggestion list, we highly suggest it for users of the Facet and Attribute Set modules.

Once you have configured the attribute suggestion list, if configured correctly you can see the result in any Definition like the following screenshot.

autocomplete.png

Prerequisites​

  • PubServer: 4.7.0.x
  • Data Management: 4.7.0.x
  • Knowledge requirements: Basic understanding of configuring PubServer using the Eclipse ISON plugin.
  • Usage of the Facet module or Attribute set module

Step-by-Step: Configure the Suggestion List​

1. Configure and Implement a Data Provider for the Suggestion List​

The attribute suggestion list is implemented based on the Data Provider concept. This means you need to implement a Data Provider that returns a list of suggestion items. The expected return type is: Map<String, String>

After implementing your provider, register it in the DataProviderManager using the ISON plugin.

Result Data Provider registration after creation using GUI:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<con:PluginConfig xmlns:con="com.priint.pubserver.config.manager/20130620">
<con:name>SampleAutoComplete.xml</con:name>
<con:type>DataProvider</con:type>
<con:description>SampleAutoComplete.xml</con:description>
<con:custom>
<dp:dataProvider xmlns:dp="com.priint.pubserver.dataprovider/20140213"
xmlns:pl="com.priint.pubserver.plugin/20140213"
xmlns:tags="com.priint.pubserver.tagging/20161102"
entityClass="Bucket"
identifier="SampleAutoComplete"
label="SampleAutoComplete for attribute set">
<tags:tags>
<tags:tag/>
</tags:tags>

<dp:dataProviderGetter dataformat="" description="">
<dp:queryMethod>
<pl:pluginMappedName>com.priint.sample.plugins.DataManagementAutoCompleteProvider</pl:pluginMappedName>
<pl:methodName>getAutoCompleteSampleData</pl:methodName>
<pl:returnType>java.util.Map</pl:returnType>
<pl:returnTypeArguments>java.lang.String</pl:returnTypeArguments>
<pl:returnTypeArguments>java.lang.String</pl:returnTypeArguments>
<pl:parameters defaultValue="&lt;DataProvider.Parameters&gt;"
description="list of additional parameters"
name="parameters"
type="java.util.Map"/>
</dp:queryMethod>

<dp:dataMappingMethod>
<pl:pluginMappedName>com.priint.sample.plugins.DataManagementAutoCompleteProvider</pl:pluginMappedName>
<pl:methodName>passMapOfStringString</pl:methodName>
<pl:returnType>java.util.Map</pl:returnType>
<pl:returnTypeArguments>java.lang.String</pl:returnTypeArguments>
<pl:returnTypeArguments>java.lang.String</pl:returnTypeArguments>
<pl:parameters defaultValue="&lt;Entity.ResultList&gt;"
description="output of previous function in the processing chain"
name="inputList"
type="java.util.Map"/>
</dp:dataMappingMethod>
</dp:dataProviderGetter>

<dp:dataProviderSetter dataformat="" description="">
<dp:queryMethod>
<pl:pluginMappedName/>
<pl:methodName/>
</dp:queryMethod>
<dp:dataMappingMethod>
<pl:pluginMappedName/>
<pl:methodName/>
</dp:dataMappingMethod>
</dp:dataProviderSetter>
</dp:dataProvider>
</con:custom>

<con:dependencies/>
<con:instances/>
</con:PluginConfig>

2. Configure the Data Provider in the Data Management Configuration​

After creating and registering your provider, enable it for the suggestion list by updating the Data Management configuration file.

  • The mapped name of the ISON folder is: com.priint.datamanagement.config.DataManagementPlugin.

config.png

Example configuration:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<con:PluginConfig xmlns:con="com.priint.pubserver.config.manager/20130620">
<con:name>default.xml</con:name>
<con:type>DataManagementConfig</con:type>
<con:dependencies/>
<con:custom>
<dataManagement version="1.0">
<dataProviders>
<dataProvider id="SampleAutoComplete" entityId="attribute"> <!-- replace with your provider ID -->
<arguments>
<argument key="componentId">text</argument>
<argument key="context"/>
<argument key="entityId">attribute</argument>
</arguments>
</dataProvider>
</dataProviders>
</dataManagement>
</con:custom>
</con:PluginConfig>

Note: Replace "SampleAutoComplete" with your actual Data Provider ID.

Explanation:​

  • <dataManagement>This is the parent element that encapsulates the configuration for Data management.
    • <dataProviders>: The list of data provider.
      • <dataProvider>: Defines a data provider with id and entityId
        • <id>: Identifier of data provider which is configured in the data provider xml file.
        • <entityId>: Identifier of the entity that uses the data provider.
        • <arguments>: List of argument that needs to call the data provider. Each of argument needs to provide a key and value. If the key is context, then the value will be dynamically replaced with the current context.

Final Result​

Once completed, open the Data Management application, the user will be able to choose a value from the configured suggestion list by pressing the colon.

The example chosen shows the "Create New Attribute" in the Attribute Set module, however the attribute suggestion mechanism will work the same in all other sections of the facet module.

  1. Press ":" colon and start to type letters of searched word. attribute suggestion list 1
  2. Select any attribute from the list returned by your dataprovider. attribute suggestion list 2