connObjectWin.setInitialHeight(CONNOBJECT_WIN_HEIGHT);
connObjectWin.setInitialWidth(CONNOBJECT_WIN_WIDTH);
connObjectWin.setCookieName("connobject-modal");
add(connObjectWin);
final StatusBean syncope = new StatusBean();
syncope.setResourceName("Syncope");
if (attributable instanceof UserTO) {
UserTO userTO = (UserTO) attributable;
syncope.setAccountLink(userTO.getUsername());
Status syncopeStatus = Status.UNDEFINED;
if (userTO.getStatus() != null) {
try {
syncopeStatus = Status.valueOf(userTO.getStatus().toUpperCase());
} catch (IllegalArgumentException e) {
LOG.warn("Unexpected status found: {}", userTO.getStatus());
}
}
syncope.setStatus(syncopeStatus);
}
if (attributable instanceof RoleTO) {
RoleTO roleTO = (RoleTO) attributable;
syncope.setAccountLink(roleTO.getDisplayName());
syncope.setStatus(Status.ACTIVE);
}
StatusUtils statusUtils = new StatusUtils((attributable instanceof UserTO ? userRestClient : roleRestClient));
connObjects = statusUtils.getConnectorObjects(attributable);
List<StatusBean> statusBeans = new ArrayList<StatusBean>(connObjects.size() + 1);
statusBeans.add(syncope);
initialStatusBeanMap = new LinkedHashMap<String, StatusBean>(connObjects.size() + 1);
initialStatusBeanMap.put(syncope.getResourceName(), syncope);
for (Map.Entry<String, ConnObjectTO> entry : connObjects.entrySet()) {
final StatusBean statusBean = statusUtils.getStatusBean(entry.getKey(), entry.getValue());
initialStatusBeanMap.put(entry.getKey(), statusBean);
statusBeans.add(statusBean);
}