use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class ServiceViewBeanBase method getAttributeValues.
protected Map getAttributeValues() throws ModelControlException, AMConsoleException {
EntitiesModel model = (EntitiesModel) getModel();
String universalId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
String serviceName = (String) getPageSessionAttribute(SERVICE_NAME);
return (model != null) ? model.getServiceAttributeValues(universalId, serviceName) : Collections.EMPTY_MAP;
}
use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EntityEditViewBean method getEntityDisplayNames.
protected List getEntityDisplayNames(Collection entities) {
List displayNames = null;
if ((entities != null) && !entities.isEmpty()) {
EntitiesModel model = (EntitiesModel) getModel();
Set names = new HashSet(entities.size() * 2);
for (Iterator iter = entities.iterator(); iter.hasNext(); ) {
AMIdentity entity = (AMIdentity) iter.next();
names.add(AMFormatUtils.getIdentityDisplayName(model, entity));
}
displayNames = AMFormatUtils.sortItems(names, model.getUserLocale());
}
return (displayNames != null) ? displayNames : Collections.EMPTY_LIST;
}
use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EntitiesViewBean method addEntitiesTab.
private void addEntitiesTab() {
EntitiesModel model = (EntitiesModel) getModel();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
AMViewConfig config = AMViewConfig.getInstance();
config.addEntityTabs(tabModel, curRealm, model);
}
use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EntitiesViewBean method handleTblButtonDeleteRequest.
/**
* Deletes policies.
*
* @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);
List cache = (List) szCache.getSerializedObj();
for (int i = 0; i < selected.length; i++) {
names.add((String) cache.get(selected[i].intValue()));
}
try {
EntitiesModel model = (EntitiesModel) getModel();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String idType = (String) getPageSessionAttribute(PG_SESSION_ENTITY_TYPE);
model.deleteEntities(curRealm, names);
if (selected.length == 1) {
Object[] param = { model.getLocalizedString(idType) };
String msg = model.getLocalizedString("entities.message.deleted");
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", MessageFormat.format(msg, param));
} else {
Object[] param = { model.getLocalizedString(idType) };
String msg = model.getLocalizedString("entities.message.deleted.pural");
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", MessageFormat.format(msg, param));
}
} 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 checkForAttributesToDisplay.
protected void checkForAttributesToDisplay(String type) {
if (this.getClass().equals(EntityEditViewBean.class)) {
EntitiesModel model = (EntitiesModel) getModel();
String agentType = (String) getPageSessionAttribute(ENTITY_AGENT_TYPE);
String serviceName = model.getServiceNameForIdType(type, agentType);
hasNoAttributeToDisplay = (serviceName == null) || (serviceName.trim().length() == 0);
}
}
Aggregations