use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.
the class EntitiesViewBean method populateTableModelEx.
private void populateTableModelEx() {
if (!tblModelPopulated) {
tblModelPopulated = true;
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
List cache = (List) szCache.getSerializedObj();
if ((cache != null) && !cache.isEmpty()) {
EntitiesModel model = (EntitiesModel) getModel();
SSOToken ssoToken = model.getUserSSOToken();
List list = new ArrayList(cache.size());
for (Iterator iter = cache.iterator(); iter.hasNext(); ) {
String id = (String) iter.next();
try {
list.add(IdUtils.getIdentity(ssoToken, id));
} catch (IdRepoException e) {
//ignore since ID is not found.
}
}
populateTableModel(list);
}
}
}
use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.
the class EntitiesViewBean method populateTableModel.
private void populateTableModel(Collection entityNames) {
tblModel.clearAll();
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
if ((entityNames != null) && !entityNames.isEmpty()) {
// set the paging size
EntitiesModel model = (EntitiesModel) getModel();
tblModel.setMaxRows(model.getPageSize());
// remove the special users from the set of enitities to display
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
Set specialUsers = model.getSpecialUsers(curRealm);
entityNames.removeAll(specialUsers);
// get the current logged in user
AMIdentity curUser = null;
try {
curUser = IdUtils.getIdentity(model.getUserSSOToken(), model.getUniversalID());
} catch (IdRepoException idr) {
// do nothing
}
int counter = 0;
boolean firstEntry = true;
List cache = new ArrayList(entityNames.size());
for (Iterator iter = entityNames.iterator(); iter.hasNext(); ) {
AMIdentity entity = (AMIdentity) iter.next();
if (firstEntry) {
firstEntry = false;
} else {
tblModel.appendRow();
}
String name = AMFormatUtils.getIdentityDisplayName(model, entity);
// hide the checkbox if this is the current user or amadmin
boolean showCheckbox = ((curUser != null) && (!curUser.equals(entity))) && !model.isAmadminUser(entity);
tblModel.setSelectionVisible(counter++, showCheckbox);
String universalId = IdUtils.getUniversalId(entity);
tblModel.setValue(TBL_DATA_NAME, name);
tblModel.setValue(TBL_DATA_ID, LDAPUtils.rdnValueFromDn(universalId));
tblModel.setValue(TBL_DATA_UNIVERSALNAME, universalId);
tblModel.setValue(TBL_DATA_ACTION_HREF, stringToHex(universalId));
cache.add(universalId);
}
szCache.setValue((Serializable) cache);
} else {
szCache.setValue(null);
}
}
use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.
the class IDRepoViewBean method handleTblButtonDeleteRequest.
/**
* Deletes ID Repo.
*
* @param event Request Invocation Event.
* @throws ModelControlException if table model cannot be restored.
*/
public void handleTblButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
CCActionTable table = (CCActionTable) getChild(TBL_SEARCH);
table.restoreStateData();
Integer[] selected = tblModel.getSelectedRows();
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
List list = (List) szCache.getSerializedObj();
Set names = new HashSet(selected.length * 2);
for (int i = 0; i < selected.length; i++) {
names.add(list.get(selected[i].intValue()));
}
try {
IDRepoModel model = (IDRepoModel) getModel();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
model.deleteIDRepos(curRealm, names);
if (selected.length == 1) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "idRepo.message.deleted");
} else {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "idRepo.message.deleted.pural");
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.
the class IDRepoViewBean method populateTableModel.
private void populateTableModel(Collection idRepoNames) {
tblModel.clearAll();
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
if ((idRepoNames != null) && !idRepoNames.isEmpty()) {
List cache = new ArrayList(idRepoNames.size());
IDRepoModel model = (IDRepoModel) getModel();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
Map mapTypeToDisplayName = null;
try {
mapTypeToDisplayName = model.getIDRepoTypesMap();
} catch (AMConsoleException e) {
mapTypeToDisplayName = Collections.EMPTY_MAP;
}
boolean firstEntry = true;
for (Iterator iter = idRepoNames.iterator(); iter.hasNext(); ) {
if (firstEntry) {
firstEntry = false;
} else {
tblModel.appendRow();
}
String name = (String) iter.next();
tblModel.setValue(TBL_DATA_NAME, name);
try {
String type = model.getIDRepoType(curRealm, name);
String displayName = (String) mapTypeToDisplayName.get(type);
if (displayName == null) {
displayName = type;
}
tblModel.setValue(TBL_DATA_TYPE, displayName);
} catch (AMConsoleException e) {
tblModel.setValue(TBL_DATA_TYPE, "");
}
tblModel.setValue(TBL_DATA_ACTION_HREF, stringToHex(name));
cache.add(name);
}
szCache.setValue((ArrayList) cache);
} else {
szCache.setValue(null);
}
}
use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.
the class RMRealmViewBean method createChild.
protected View createChild(String name) {
View view = null;
if (name.equals(TBL_SEARCH)) {
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
populateTableModel((List) szCache.getSerializedObj());
view = new CCActionTable(this, tblModel, name);
} else if (name.equals(PAGETITLE)) {
view = new CCPageTitle(this, ptModel, name);
} else if (tblModel.isChildSupported(name)) {
view = tblModel.createChild(this, name);
} else {
view = super.createChild(name);
}
return view;
}
Aggregations