use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EntityAddViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
EntitiesModel model = (EntitiesModel) getModel();
String type = (String) getPageSessionAttribute(ENTITY_TYPE);
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
Map types = model.getSupportedEntityTypes(realmName);
String i18nName = (String) types.get(type);
String title = model.getLocalizedString("page.title.entities.create");
Object[] param = { i18nName };
ptModel.setPageTitleText(MessageFormat.format(title, param));
if (hasNoAttributeToDisplay) {
disableButton("button1", true);
}
}
use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EntityAddViewBean 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 entityType = (String) getPageSessionAttribute(ENTITY_TYPE);
String entityName = (String) propertySheetModel.getValue(ENTITY_NAME);
entityName = entityName.trim();
try {
// null for agent type
Map defaultValues = model.getDefaultAttributeValues(entityType, null, true);
Map values = prop.getAttributeValues(defaultValues.keySet());
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
model.createEntity(realmName, entityName, entityType, values);
forwardToEntitiesViewBean();
} 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 HomeViewBean method forwardTo.
public void forwardTo(RequestContext reqContext) throws NavigationException {
EntitiesModel model = (EntitiesModel) getModel();
AMViewConfig config = AMViewConfig.getInstance();
List supported = config.getSupportedAgentTypes(model);
if (supported.isEmpty()) {
super.forwardTo(reqContext);
} else {
AgentsViewBean vb = (AgentsViewBean) getViewBean(AgentsViewBean.class);
setPageSessionAttribute(AgentsViewBean.PG_SESSION_AGENT_TYPE, (String) supported.iterator().next());
passPgSessionMap(vb);
vb.forwardTo(reqContext);
}
}
use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EndUserViewBean method forwardTo.
public void forwardTo(RequestContext rc) {
String userId = (String) getPageSessionAttribute(UNIVERSAL_ID);
if (userId == null) {
EntitiesModel model = (EntitiesModel) getModel();
try {
userId = model.getUserName();
AMIdentity amid = IdUtils.getIdentity(model.getUserSSOToken(), userId);
setPageSessionAttribute(UNIVERSAL_ID, userId);
setPageSessionAttribute(EntityOpViewBeanBase.ENTITY_NAME, amid.getName());
setPageSessionAttribute(EntityOpViewBeanBase.ENTITY_TYPE, amid.getType().getName());
Set agentTypes = amid.getAttribute("AgentType");
if ((agentTypes != null) && !agentTypes.isEmpty()) {
setPageSessionAttribute(EntityOpViewBeanBase.ENTITY_AGENT_TYPE, (String) agentTypes.iterator().next());
}
super.forwardTo(rc);
} catch (IdRepoException e) {
AuthenticatedViewBean vb = (AuthenticatedViewBean) getViewBean(AuthenticatedViewBean.class);
passPgSessionMap(vb);
vb.forwardTo(rc);
} catch (SSOException e) {
AuthenticatedViewBean vb = (AuthenticatedViewBean) getViewBean(AuthenticatedViewBean.class);
passPgSessionMap(vb);
vb.forwardTo(rc);
}
} else {
super.forwardTo(rc);
}
}
use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EndUserViewBean method getModelInternal.
protected AMModel getModelInternal() {
HttpServletRequest req = RequestManager.getRequestContext().getRequest();
EntitiesModel model = new EntitiesModelImpl(req, getPageSessionAttributes());
model.setEndUser(true);
return model;
}
Aggregations