use of com.sun.identity.console.federation.model.EntityModel in project OpenAM by OpenRock.
the class FederationViewBean method populateEntityTable.
private void populateEntityTable() {
tablePopulated = true;
CCActionTableModel tableModel = (CCActionTableModel) propertySheetModel.getModel(ENTITY_TABLE);
tableModel.clearAll();
boolean firstRow = true;
EntityModel eModel = getEntityModel();
Map entities = Collections.EMPTY_MAP;
List entityList = new ArrayList();
try {
entities = eModel.getSAMLv2Entities();
if (!entities.isEmpty()) {
addRows(entities, eModel, tableModel, firstRow, entityList);
firstRow = false;
}
entities.clear();
entities = eModel.getIDFFEntities();
if (!entities.isEmpty()) {
addRows(entities, eModel, tableModel, firstRow, entityList);
firstRow = false;
}
entities.clear();
entities = eModel.getWSFedEntities();
if (!entities.isEmpty()) {
addRows(entities, eModel, tableModel, firstRow, entityList);
firstRow = false;
}
// set the instances in the page session so when a request comes
// in we can prepopulate the table model.
setPageSessionAttribute(ENTITY_TABLE, (Serializable) entityList);
} catch (AMConsoleException e) {
debug.error("FederationViewBean.populateEntityTable", e);
return;
}
}
use of com.sun.identity.console.federation.model.EntityModel in project OpenAM by OpenRock.
the class EntityPropertiesBase method getEntityModel.
protected AMModel getEntityModel() {
RequestContext rc = RequestManager.getRequestContext();
EntityModel model = new EntityModelImpl(rc.getRequest(), getPageSessionAttributes());
return model;
}
use of com.sun.identity.console.federation.model.EntityModel in project OpenAM by OpenRock.
the class FederationViewBean method handleEntityNameHrefRequest.
public void handleEntityNameHrefRequest(RequestInvocationEvent event) {
// store the current selected tab in the page session
String id = (String) getPageSessionAttribute(getTrackingTabIDName());
setPageSessionAttribute(AMAdminConstants.PREVIOUS_TAB_ID, id);
String tmp = hexToString((String) getDisplayFieldValue(ENTITY_NAME_HREF));
int index = tmp.lastIndexOf(",");
String location = tmp.substring(index + 1);
tmp = tmp.substring(0, index);
index = tmp.lastIndexOf(",");
String realm = tmp.substring(index + 1);
tmp = tmp.substring(0, index);
index = tmp.indexOf(",");
String protocol = tmp.substring(index + 1);
String name = tmp.substring(0, index);
EntityPropertiesBase vb = null;
List roles = null;
EntityModel eModel = (EntityModel) getEntityModel();
if (protocol.equals(EntityModel.SAMLV2)) {
roles = eModel.getSAMLv2Roles(name, realm);
String strViewBean = (String) roles.get(0);
vb = getSAMLv2ViewBean(strViewBean);
} else if (protocol.equals(EntityModel.IDFF)) {
roles = eModel.getIDFFRoles(name, realm);
String strViewBean = (String) roles.get(0);
vb = getIDFFViewBean(strViewBean);
} else if (protocol.equals(EntityModel.WSFED)) {
vb = (WSFedGeneralViewBean) getViewBean(WSFedGeneralViewBean.class);
}
if (vb != null) {
setPageSessionAttribute(EntityPropertiesBase.ENTITY_NAME, name);
setPageSessionAttribute(EntityPropertiesBase.ENTITY_REALM, realm);
setPageSessionAttribute(EntityPropertiesBase.ENTITY_LOCATION, location);
unlockPageTrail();
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
} else {
setInlineAlertMessage(CCAlert.TYPE_ERROR, getModel().getLocalizedString("unknown.object.type.title"), getModel().getLocalizedString("unknown.object.type"));
forwardTo();
}
}
use of com.sun.identity.console.federation.model.EntityModel in project OpenAM by OpenRock.
the class FederationViewBean method handleDeleteEntityButtonRequest.
public void handleDeleteEntityButtonRequest(RequestInvocationEvent event) throws ModelControlException {
CCActionTable table = (CCActionTable) getChild(ENTITY_TABLE);
table.restoreStateData();
EntityModel model = getEntityModel();
CCActionTableModel cctablemodel = (CCActionTableModel) propertySheetModel.getModel(ENTITY_TABLE);
List entitiesList = (ArrayList) getPageSessionAttribute(ENTITY_TABLE);
Integer[] selected = cctablemodel.getSelectedRows();
List successList = new ArrayList();
List failureList = new ArrayList();
String name = null;
for (int i = 0; i < selected.length; i++) {
String selectedRow = (String) entitiesList.get(selected[i].intValue());
int pos = selectedRow.indexOf(",");
name = selectedRow.substring(0, pos);
String protStr = selectedRow.substring(pos + 1);
int posProtocol = protStr.indexOf(",");
String protocol = protStr.substring(0, posProtocol);
String realmStr = protStr.substring(posProtocol + 1);
int posrealm = realmStr.indexOf(",");
String realm = realmStr.substring(0, posrealm);
try {
model.deleteEntities(name, protocol, realm);
successList.add(name);
} catch (AMConsoleException e) {
failureList.add(name);
}
}
String finalStr = printDeleteMessage(model, successList, failureList);
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", finalStr);
forwardTo();
}
use of com.sun.identity.console.federation.model.EntityModel in project OpenAM by OpenRock.
the class EntityPropertiesBase method createTabModel.
protected void createTabModel() {
String profile = getProfileName();
String entity = (String) getPageSessionAttribute(ENTITY_NAME);
String realm = (String) getPageSessionAttribute("entityRealm");
EntityModel eModel = (EntityModel) getEntityModel();
if (tabModel == null) {
if (profile.equals(eModel.SAMLV2)) {
AMViewConfig amconfig = AMViewConfig.getInstance();
List tabstoDisplay = eModel.getSAMLv2Roles(entity, realm);
tabModel = amconfig.getSAMLv2TabsModel("SAMLv2", "/", getRequestContext().getRequest(), tabstoDisplay);
registerChild(TAB_COMMON, CCTabs.class);
tabModel.clear();
} else if (!profile.equals(eModel.SAMLV2)) {
AMViewConfig amconfig = AMViewConfig.getInstance();
List entries = eModel.getTabMenu(profile, entity, realm);
if ((entries != null) && (entries.size() > 0)) {
amconfig.addTabEntries(profile, entries, true);
}
tabModel = amconfig.getTabsModel(profile, "/", getRequestContext().getRequest());
tabModel.clear();
tabModel.setSelectedNode(1);
}
}
}
Aggregations