use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.
the class STSHomeViewBean method getPublishedInstancesFromCache.
private Set<String> getPublishedInstancesFromCache(String cacheKey) {
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
Map<String, Set<String>> instancesCache = (Map<String, Set<String>>) szCache.getSerializedObj();
if (instancesCache != null) {
return instancesCache.get(cacheKey);
} else {
return Collections.emptySet();
}
}
use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.
the class SMProfileViewBean method createChild.
/**
* Creates user interface components used by this view bean.
*
* @param name of component
* @return child component
*/
protected View createChild(String name) {
View view = null;
if (name.equals(TBL_SESSIONS)) {
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 if (name.equals(CHILD_SERVER_NAME_MENU)) {
view = new CCDropDownMenu(this, name, null);
} else if (name.equals(LOGOUT_URL)) {
return new CCStaticTextField(this, LOGOUT_URL, "");
} else if (name.equals(CHILD_SERVER_NAME_HREF)) {
view = new CCHref(this, name, null);
} else {
view = super.createChild(name);
}
return view;
}
use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.
the class AgentsViewBean method populateTableModelEx.
private void populateTableModelEx() {
if (!tblModelPopulated) {
tblModelPopulated = true;
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
Map cache = (Map) szCache.getSerializedObj();
if ((cache != null) && !cache.isEmpty()) {
AgentsModel model = (AgentsModel) getModel();
SSOToken ssoToken = model.getUserSSOToken();
List cacheAgents = (List) cache.get(CACHE_AGENTS);
List cacheAgentGroups = (List) cache.get(CACHE_AGENT_GROUPS);
Map mapCache = new HashMap(4);
if ((cacheAgents != null) && !cacheAgents.isEmpty()) {
List list = new ArrayList(cacheAgents.size());
for (Iterator i = cacheAgents.iterator(); i.hasNext(); ) {
String id = (String) i.next();
try {
list.add(IdUtils.getIdentity(ssoToken, id));
} catch (IdRepoException e) {
//ignore since ID is not found.
}
}
mapCache.put(CACHE_AGENTS, list);
}
if ((cacheAgentGroups != null) && !cacheAgentGroups.isEmpty()) {
List list = new ArrayList(cacheAgentGroups.size());
for (Iterator i = cacheAgentGroups.iterator(); i.hasNext(); ) {
String id = (String) i.next();
try {
list.add(IdUtils.getIdentity(ssoToken, id));
} catch (IdRepoException e) {
//ignore since ID is not found.
}
}
mapCache.put(CACHE_AGENT_GROUPS, list);
}
populateTableModel(mapCache);
}
}
}
use of com.sun.identity.console.components.view.html.SerializedField in project OpenAM by OpenRock.
the class AgentsViewBean method handleTblButtonGroupDeleteRequest.
/**
* Deletes agent groups.
*
* @param event Request Invocation Event.
* @throws ModelControlException if table model cannot be restored.
*/
public void handleTblButtonGroupDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
CCActionTable table = (CCActionTable) getChild(TBL_SEARCH_GROUP);
table.restoreStateData();
Integer[] selected = tblGroupModel.getSelectedRows();
Set names = new HashSet(selected.length * 2);
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
Map mapCache = (Map) szCache.getSerializedObj();
List cache = (List) mapCache.get(CACHE_AGENT_GROUPS);
for (int i = 0; i < selected.length; i++) {
names.add((String) cache.get(selected[i].intValue()));
}
try {
AgentsModel model = (AgentsModel) getModel();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
model.deleteAgentGroups(curRealm, names);
if (selected.length == 1) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", model.getLocalizedString("agent.groups.message.deleted"));
} else {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", model.getLocalizedString("agent.groups.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 AgentsViewBean method handleTblButtonDeleteRequest.
/**
* Deletes agents.
*
* @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();
Set names = new HashSet(selected.length * 2);
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
Map mapCache = (Map) szCache.getSerializedObj();
List cache = (List) mapCache.get(CACHE_AGENTS);
for (int i = 0; i < selected.length; i++) {
names.add((String) cache.get(selected[i].intValue()));
}
try {
AgentsModel model = (AgentsModel) getModel();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
model.deleteAgents(curRealm, names);
if (selected.length == 1) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", model.getLocalizedString("agents.message.deleted"));
} else {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", model.getLocalizedString("agents.message.deleted.pural"));
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
Aggregations