use of com.sun.identity.console.agentconfig.model.AgentsModel in project OpenAM by OpenRock.
the class AgentsViewBean method beginDisplay.
/**
* Sets the agent title and populates the agent and agent group
* action table.
*
* @param event Display Event.
* @throws ModelControlException if cannot access to framework model.
*/
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event, false);
resetButtonState(TBL_BUTTON_DELETE);
AgentsModel model = (AgentsModel) getModel();
String agentType = getDisplayIDType();
Object[] param = { agentType };
ptModel.setPageTitleText(model.getLocalizedString("agenttype." + agentType));
ptModel.setPageTitleHelpMessage(model.getLocalizedString("agenttype." + agentType + ".help"));
tblModel.setTitle(MessageFormat.format(model.getLocalizedString("table.agents.title.name"), param));
tblModel.setTitleLabel(MessageFormat.format(model.getLocalizedString("table.agents.summary"), param));
tblModel.setSummary(MessageFormat.format(model.getLocalizedString("table.agents.summary"), param));
tblGroupModel.setTitle(MessageFormat.format(model.getLocalizedString("table.agent.groups.title.name"), param));
tblGroupModel.setTitleLabel(MessageFormat.format(model.getLocalizedString("table.agent.groups.summary"), param));
tblGroupModel.setSummary(MessageFormat.format(model.getLocalizedString("table.agent.groups.summary"), param));
getAgentNames();
CCButton b = (CCButton) getChild(TBL_BUTTON_DELETE);
b.setDisabled(true);
b = (CCButton) getChild(TBL_BUTTON_DELETE_GROUP);
b.setDisabled(true);
}
use of com.sun.identity.console.agentconfig.model.AgentsModel in project OpenAM by OpenRock.
the class GenericAgentProfileViewBean method createTabModel.
protected void createTabModel() {
String agentType = getAgentType();
if (isLocalConfig(agentType)) {
agentType = AgentsViewBean.AGENT_2_2;
}
if (agentType != null) {
super.createTabModel();
AgentsModel model = (AgentsModel) getModel();
AgentTabManager mgr = AgentTabManager.getInstance();
List tabs = mgr.getTabs(agentType);
if ((tabs != null) && !tabs.isEmpty()) {
for (int i = 0; i < tabs.size(); i++) {
String tabName = (String) tabs.get(i);
tabModel.addNode(new CCNavNode(Integer.parseInt(TAB_PREFIX + i), model.getLocalizedString("tab.label." + agentType + "." + tabName), "", ""));
}
} else {
tabModel.addNode(new CCNavNode(TAB_GENERAL_ID, "tab.general", "", ""));
}
String group = (String) getPageSessionAttribute(IS_GROUP);
if ((group != null) && group.equals("true")) {
tabModel.addNode(new CCNavNode(TAB_GROUP_ID, "tab.group", "", ""));
}
}
}
use of com.sun.identity.console.agentconfig.model.AgentsModel 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.agentconfig.model.AgentsModel in project OpenAM by OpenRock.
the class GenericAgentProfileViewBean method createPropertySheetModel.
protected AMPropertySheetModel createPropertySheetModel(String type) {
String agentType = getAgentType();
AgentsModel model = (AgentsModel) getModel();
String tabName = (String) getPageSessionAttribute(PS_TABNAME);
String choice = (String) getPageSessionAttribute(AgentsViewBean.LOCAL_OR_NOT);
AgentPropertyXMLBuilder blder = null;
try {
if (isLocalConfig(agentType)) {
blder = new AgentPropertyXMLBuilder(agentType, isGroup, true, tabName, model);
} else {
blder = new AgentPropertyXMLBuilder(agentType, isGroup, is2dot2Agent() || isAgentAuthenticator(), tabName, model);
}
attributeSchemas = blder.getAttributeSchemas();
return new AMPropertySheetModel(blder.getXML(inheritedPropertyNames, choice));
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
} catch (SMSException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
} catch (SSOException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
return null;
}
use of com.sun.identity.console.agentconfig.model.AgentsModel in project OpenAM by OpenRock.
the class GenericAgentProfileViewBean method setDefaultValues.
protected void setDefaultValues(String type) throws AMConsoleException {
if (propertySheetModel != null) {
AgentsModel model = (AgentsModel) getModel();
String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
try {
if (!submitCycle) {
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
// !isGroup should that we do not inherit value is
// the identity is a group.
Map attrValues = model.getAttributeValues(curRealm, universalId, !isGroup);
removeAgentRootURLKey(attrValues);
propertySheetModel.clear();
AMPropertySheet prop = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
prop.setAttributeValues(attrValues, model);
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
disableButton("button1", true);
}
String[] uuid = { universalId };
propertySheetModel.setValues(PROPERTY_UUID, uuid, model);
}
}
Aggregations