CODE
<widget id="webservice-list" xsi:type="ctdbum:ListWidgetType">
<hidden>false</hidden>
<displayOptions>
<modalSize>LG</modalSize>
</displayOptions>
<config>
<actions/>
<allowExport>true</allowExport>
<columns>
<column>
<attribute>true</attribute>
<dataKey>id</dataKey>
<dataType>string</dataType>
<dateFormat>DAY_MONTH_YEAR_LONG</dateFormat>
<ellipsis>false</ellipsis>
<hidden>false</hidden>
<sortAs>ALPHA</sortAs>
<sortDirection>ASC</sortDirection>
<sortable>true</sortable>
<sorted>true</sorted>
<type>general</type>
</column>
<column>
<attribute>true</attribute>
<dataKey>firstName</dataKey>
<dataType>string</dataType>
<dateFormat>DAY_MONTH_YEAR_LONG</dateFormat>
<ellipsis>false</ellipsis>
<hidden>false</hidden>
<sortAs>ALPHA</sortAs>
<sortDirection>ASC</sortDirection>
<sortable>true</sortable>
<sorted>false</sorted>
<type>general</type>
</column>
<column>
<attribute>true</attribute>
<dataKey>lastName</dataKey>
<dataType>string</dataType>
<dateFormat>DAY_MONTH_YEAR_LONG</dateFormat>
<ellipsis>false</ellipsis>
<hidden>false</hidden>
<sortAs>ALPHA</sortAs>
<sortDirection>ASC</sortDirection>
<sortable>true</sortable>
<sorted>false</sorted>
<type>general</type>
</column>
</columns>
<rowClickActions/>
<contentRule>
<script><![CDATA[
import com.memority.toolkit.rest.client.groovy.ContentType
int pageNumber = LIST_WIDGET.request.pagination.getIndex()
def pageSize = LIST_WIDGET.request.pagination.size
def params = [:] << [page:"$pageNumber", size:"$pageSize"]if (LIST_WIDGET.request.sort != null) {
params << [sort:"${LIST_WIDGET.request.sort.property},${LIST_WIDGET.request.sort.direction}"]
}
def result;
try {
result = HTTP.get('http://idm-tnx.dev.citadel.intranet.lagoon.psa-cloud.com/nto/api/idm/identities') { basicAuth(usernamePassword('ws-test.credentials')) contentType ContentType.JSON queryParams params }
LOG.info("result = " + result)
LOG.info("resultJSON = " + (result.json as List).toString())} catch(Exception e) {
def param = [:] << [url:"http://idm-tnx.dev.citadel.intranet.lagoon.psa-cloud.com/nto/api/idm/identities"]
return ListWidgetRuleResult.failure("Failed to connect to the server", "tenant.error.connectionError.label", param as Map<String, Object>);
}
if (result.isSuccess()) {
def content = ((result.json as Map)?._embedded as Map)?.identities as List
LOG.info("content = " + content)
int totalCount = ((result.json as Map)?.page as Map)?.totalElements as int
return ListWidgetRuleResult.success(content, pageNumber, pageSize, totalCount)
}
ListWidgetRuleResult.failure()
]]></script>
</contentRule>
</config>
</widget>