Search in sources :

Example 1 with IdentityProviderListResponse

use of org.wso2.carbon.identity.api.server.idp.v1.model.IdentityProviderListResponse in project identity-api-server by wso2.

the class ServerIdpManagementService method createIDPListResponse.

private IdentityProviderListResponse createIDPListResponse(IdpSearchResult idpSearchResult, List<String> requestedAttributeList) {
    List<IdentityProvider> idps = idpSearchResult.getIdPs();
    IdentityProviderListResponse listResponse = new IdentityProviderListResponse();
    if (CollectionUtils.isNotEmpty(idps)) {
        List<IdentityProviderListItem> identityProviderList = new ArrayList<>();
        for (IdentityProvider idp : idps) {
            IdentityProviderListItem listItem = populateIDPListResponse(idp, requestedAttributeList);
            identityProviderList.add(listItem);
        }
        listResponse.setIdentityProviders(identityProviderList);
        listResponse.setCount(idps.size());
    } else {
        listResponse.setCount(0);
    }
    listResponse.setTotalResults(idpSearchResult.getTotalIDPCount());
    listResponse.setStartIndex(idpSearchResult.getOffSet() + 1);
    listResponse.setLinks(createLinks(V1_API_PATH_COMPONENT + IDP_PATH_COMPONENT, idpSearchResult.getLimit(), idpSearchResult.getOffSet(), idpSearchResult.getTotalIDPCount(), idpSearchResult.getFilter()));
    return listResponse;
}
Also used : IdentityProviderListItem(org.wso2.carbon.identity.api.server.idp.v1.model.IdentityProviderListItem) ArrayList(java.util.ArrayList) IdentityProvider(org.wso2.carbon.identity.application.common.model.IdentityProvider) IdentityProviderListResponse(org.wso2.carbon.identity.api.server.idp.v1.model.IdentityProviderListResponse)

Aggregations

ArrayList (java.util.ArrayList)1 IdentityProviderListItem (org.wso2.carbon.identity.api.server.idp.v1.model.IdentityProviderListItem)1 IdentityProviderListResponse (org.wso2.carbon.identity.api.server.idp.v1.model.IdentityProviderListResponse)1 IdentityProvider (org.wso2.carbon.identity.application.common.model.IdentityProvider)1