use of com.sun.identity.console.agentconfig.model.AgentsModel in project OpenAM by OpenRock.
the class AgentConfigInheritViewBean method populatePropertyNameTableModel.
private void populatePropertyNameTableModel(Collection propertyNames) {
if (!submitCycle && (propertyNames != null)) {
tblPropertyNamesModel.clearAll();
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
String universalId = (String) getPageSessionAttribute(AgentProfileViewBean.UNIVERSAL_ID);
String agentType = getAgentType();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
AgentsModel model = (AgentsModel) getModel();
Set inheritedPropertyNames = model.getInheritedPropertyNames(curRealm, universalId);
Map nameToSchemas = model.getAttributeSchemas(agentType, propertyNames);
removeNonInheritable(nameToSchemas, propertyNames);
try {
ResourceBundle rb = AgentConfiguration.getServiceResourceBundle(model.getUserLocale());
String groupName = model.getAgentGroup(curRealm, universalId);
Map groupValues = model.getGroupAttributeValues(curRealm, groupName);
ArrayList cache = new ArrayList();
int counter = 0;
for (Iterator i = propertyNames.iterator(); i.hasNext(); counter++) {
if (counter > 0) {
tblPropertyNamesModel.appendRow();
}
String name = (String) i.next();
AttributeSchema as = (AttributeSchema) nameToSchemas.get(name);
if (as != null) {
String displayName = rb.getString(as.getI18NKey());
tblPropertyNamesModel.setValue(TBL_DATA_PROPERTY_NAME, displayName);
try {
String help = rb.getString(as.getI18NKey() + ".help");
tblPropertyNamesModel.setValue(TBL_DATA_PROPERTY_HELP, help);
} catch (MissingResourceException e) {
// need to clear the help value
tblPropertyNamesModel.setValue(TBL_DATA_PROPERTY_HELP, "");
}
Object oValue = groupValues.get(name);
String value = "";
if (oValue != null) {
value = oValue.toString();
if (value.length() >= 2) {
value = value.substring(1, value.length() - 1);
}
}
tblPropertyNamesModel.setValue(TBL_DATA_VALUE, value);
tblPropertyNamesModel.setSelectionVisible(counter, true);
tblPropertyNamesModel.setRowSelected(inheritedPropertyNames.contains(name));
cache.add(name);
}
}
szCache.setValue(cache);
} 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());
}
}
}
use of com.sun.identity.console.agentconfig.model.AgentsModel in project OpenAM by OpenRock.
the class AgentAddViewBean method beginDisplay.
public void beginDisplay(DisplayEvent e) {
String value = (String) getDisplayFieldValue(RADIO_CHOICE);
if ((value == null) || value.equals("")) {
setDisplayFieldValue(RADIO_CHOICE, AgentsViewBean.PROP_CENTRAL);
}
AgentsModel model = (AgentsModel) getModel();
String agentType = getAgentType();
Object[] param = { model.getLocalizedString("agenttype." + agentType) };
ptModel.setPageTitleText(MessageFormat.format(model.getLocalizedString("page.title.agents.create"), param));
}
use of com.sun.identity.console.agentconfig.model.AgentsModel in project OpenAM by OpenRock.
the class AgentsViewBean method handleTblDataActionGroupHrefRequest.
/**
* Forwards request to edit agent group view bean.
*
* @param event Request Invocation Event.
*/
public void handleTblDataActionGroupHrefRequest(RequestInvocationEvent event) {
AgentsModel model = (AgentsModel) getModel();
String idType = getDisplayIDType();
String universalId = hexToString((String) getDisplayFieldValue(TBL_DATA_ACTION_HREF_GROUP));
setPageSessionAttribute(AgentProfileViewBean.UNIVERSAL_ID, universalId);
SSOToken ssoToken = model.getUserSSOToken();
String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
StringTokenizer st = new StringTokenizer(universalId, "=,");
st.nextToken();
String agentGrpName = st.nextToken();
try {
AMIdentity amid = new AMIdentity(ssoToken, agentGrpName, IdType.AGENTGROUP, realm, null);
String vbName = (String) agentViewBeans.get(idType);
if (vbName == null) {
vbName = GENERIC_VIEW_BEAN;
}
Class clazz = Thread.currentThread().getContextClassLoader().loadClass(vbName);
AMViewBeanBase vb = (AMViewBeanBase) getViewBean(clazz);
removePageSessionAttribute(GenericAgentProfileViewBean.PS_TABNAME);
setPageSessionAttribute(PG_SESSION_SUPERCEDE_AGENT_TYPE, model.getAgentType(amid));
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getErrorString(e));
forwardTo();
} catch (ClassNotFoundException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getErrorString(e));
forwardTo();
}
}
use of com.sun.identity.console.agentconfig.model.AgentsModel in project OpenAM by OpenRock.
the class AgentProfileViewBean method setAgentTitle.
protected void setAgentTitle() {
AgentsModel model = (AgentsModel) getModel();
String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
try {
String title = model.getLocalizedString("edit.agentconfig.title");
String displayName = model.getDisplayName(universalId);
Object[] param = { displayName };
ptModel.setPageTitleText(MessageFormat.format(title, param));
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
use of com.sun.identity.console.agentconfig.model.AgentsModel in project OpenAM by OpenRock.
the class AgentProfileViewBean method createPropertyModel.
protected boolean createPropertyModel() {
boolean created = false;
String type = getAgentType();
if ((type != null) && (type.trim().length() > 0)) {
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
AgentsModel model = (AgentsModel) getModel();
String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
String choice = (String) getPageSessionAttribute(AgentsViewBean.LOCAL_OR_NOT);
if (checkAgentType(type)) {
inheritedPropertyNames = (!isGroup && !is2dot2Agent() && !isAgentAuthenticator() && !choice.equals(AgentsViewBean.PROP_LOCAL)) ? model.getInheritedPropertyNames(curRealm, universalId) : Collections.EMPTY_SET;
} else {
inheritedPropertyNames = (!isGroup && !is2dot2Agent() && !isAgentAuthenticator()) ? model.getInheritedPropertyNames(curRealm, universalId) : Collections.EMPTY_SET;
}
AMPropertySheetModel psModel = createPropertySheetModel(type);
if (psModel != null) {
propertySheetModel = psModel;
propertySheetModel.clear();
}
created = true;
}
return created;
}
Aggregations