* @throws IdentityException
*/
public OAuthAppDO[] getAllOAuthAppByUser(String userName) throws IdentityException {
List<OAuthAppDO> apps = null;
Association[] assoc = null;
OAuthAppDO oauthApp = null;
String path = null;
if (log.isDebugEnabled()) {
log.debug("Retrieving oauth applications for user " + userName);
}
apps = new ArrayList<OAuthAppDO>();
path = IdentityRegistryResources.OAUTH_APP_PATH + userName;
try {
if (registry.resourceExists(path)) {
assoc = registry.getAssociations(RegistryConstants.PROFILES_PATH + userName,
IdentityRegistryResources.ASSOCIATION_USER_OAUTH_APP);
for (Association association : assoc) {
oauthApp = resourceToObject(registry.get(association.getDestinationPath()));
oauthApp.setUserName(userName);
apps.add(oauthApp);
}
}
} catch (RegistryException e) {
log.error("Error occured while retreiving oauth applications for" + userName, e);