Search in sources :

Example 1 with ConnectedApp

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

the class ServerIdpManagementService method createConnectedAppsResponse.

private ConnectedApps createConnectedAppsResponse(String resourceId, ConnectedAppsResult connectedAppsResult) {
    ConnectedApps connectedAppsResponse = new ConnectedApps();
    if (connectedAppsResult == null) {
        return connectedAppsResponse;
    }
    List<ConnectedApp> connectedAppList = new ArrayList<>();
    if (CollectionUtils.isNotEmpty(connectedAppsResult.getApps())) {
        for (String app : connectedAppsResult.getApps()) {
            ConnectedApp listItem = new ConnectedApp();
            listItem.setAppId(app);
            listItem.setSelf(ContextLoader.buildURIForBody(String.format(V1_API_PATH_COMPONENT + "/applications/%s", app)).toString());
            connectedAppList.add(listItem);
        }
        connectedAppsResponse.setConnectedApps(connectedAppList);
        connectedAppsResponse.setCount(connectedAppList.size());
    } else {
        connectedAppsResponse.setCount(0);
    }
    connectedAppsResponse.setTotalResults(connectedAppsResult.getTotalAppCount());
    connectedAppsResponse.setStartIndex(connectedAppsResult.getOffSet() + 1);
    connectedAppsResponse.setLinks(createLinks(V1_API_PATH_COMPONENT + IDP_PATH_COMPONENT + Constants.PATH_SEPERATOR + resourceId + "/connected-apps", connectedAppsResult.getLimit(), connectedAppsResult.getOffSet(), connectedAppsResult.getTotalAppCount(), null));
    return connectedAppsResponse;
}
Also used : ConnectedApp(org.wso2.carbon.identity.api.server.idp.v1.model.ConnectedApp) ArrayList(java.util.ArrayList) ConnectedApps(org.wso2.carbon.identity.api.server.idp.v1.model.ConnectedApps)

Aggregations

ArrayList (java.util.ArrayList)1 ConnectedApp (org.wso2.carbon.identity.api.server.idp.v1.model.ConnectedApp)1 ConnectedApps (org.wso2.carbon.identity.api.server.idp.v1.model.ConnectedApps)1