use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EntitiesViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event, false);
resetButtonState(TBL_BUTTON_DELETE);
EntitiesModel model = (EntitiesModel) getModel();
CCButton b = (CCButton) getChild(TBL_BUTTON_ADD);
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
if (model.repoExists(curRealm)) {
b.setDisabled(false);
} else {
b.setDisabled(true);
}
String[] param = { getDisplayIDType() };
ptModel.setPageTitleText(MessageFormat.format(model.getLocalizedString("page.title.entities"), (Object[]) param));
tblModel.setTitle(MessageFormat.format(model.getLocalizedString("table.entities.title.name"), (Object[]) param));
tblModel.setTitleLabel(MessageFormat.format(model.getLocalizedString("table.entities.title.name"), (Object[]) param));
tblModel.setSummary(MessageFormat.format(model.getLocalizedString("table.entities.summary"), (Object[]) param));
getEntityNames();
addEntitiesTab();
tabModel.setSelectedNode(7);
}
use of com.sun.identity.console.idm.model.EntitiesModel 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.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EntityEditViewBean method handleButton1Request.
/**
* Handles create realm request.
*
* @param event Request invocation event
*/
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
submitCycle = true;
EntitiesModel model = (EntitiesModel) getModel();
AMPropertySheet prop = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
try {
Map oldValues = model.getAttributeValues(universalId, false);
Map values = prop.getAttributeValues(oldValues, true, model);
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
model.modifyEntity(curRealm, universalId, values);
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "message.updated");
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EntityEditViewBean method nodeClicked.
/**
* Handles tab selected event.
*
* @param event Request Invocation Event.
* @param nodeID Selected Node ID.
*/
public void nodeClicked(RequestInvocationEvent event, int nodeID) {
EntityEditViewBean vb = null;
IdType idType = null;
EntitiesModel model = (EntitiesModel) getModel();
unlockPageTrailForSwapping();
setPageSessionAttribute(getTrackingTabIDName(), Integer.toString(nodeID));
if (nodeID == TAB_PROFILE) {
vb = (EntityEditViewBean) getViewBean(EntityEditViewBean.class);
forwardToOtherEntityViewBean(vb, idType);
} else if (nodeID == TAB_SERVICES) {
vb = (EntityServicesViewBean) getViewBean(EntityServicesViewBean.class);
forwardToOtherEntityViewBean(vb, idType);
} else {
handleMembersViewForwarding(nodeID, model);
}
}
use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EntityMembersViewBean method getMemberNames.
private void getMemberNames() {
if (!submitCycle) {
try {
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String type = (String) getPageSessionAttribute(PG_SESSION_MEMBER_TYPE);
String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
if (cacheAssigned != null) {
assignedMembers = AMAdminUtils.toList(cacheAssigned);
} else {
EntitiesModel model = (EntitiesModel) getModel();
assignedMembers = new ArrayList();
assignedMembers.addAll(model.getMembers(curRealm, universalId, type));
}
if (canModify) {
CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) propertySheetModel.getModel(ADD_REMOVE_MEMBERS);
addRemoveModel.clear();
if (cacheAssigned != null) {
addRemoveModel.setSelectedOptionList(cacheAssigned);
} else {
addRemoveModel.setSelectedOptionList(getOptionListForEntities(assignedMembers));
}
addRemoveModel.setAvailableOptionList(getAssignableMembers());
} else {
propertySheetModel.setValue(ADD_REMOVE_MEMBERS, AMAdminUtils.getString(getEntityDisplayNames(assignedMembers), ",", false));
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
if (canModify) {
CCAddRemove addRemove = (CCAddRemove) getChild(ADD_REMOVE_MEMBERS);
addRemove.resetStateData();
}
}
}
Aggregations