use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EntitiesViewBean method getEntityNames.
private void getEntityNames() {
EntitiesModel model = (EntitiesModel) getModel();
String filter = ((String) getDisplayFieldValue(TF_FILTER));
if ((filter == null) || (filter.length() == 0)) {
filter = "*";
setDisplayFieldValue(TF_FILTER, "*");
} else {
filter = filter.trim();
}
try {
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
IdSearchResults results = model.getEntityNames(curRealm, getDisplayIDType(), filter);
int errorCode = results.getErrorCode();
switch(errorCode) {
case IdSearchResults.SIZE_LIMIT_EXCEEDED:
setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "message.sizelimit.exceeded");
break;
case IdSearchResults.TIME_LIMIT_EXCEEDED:
setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "message.timelimit.exceeded");
break;
}
populateTableModel(results.getSearchResults());
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
// disable the add button if there was an error
CCButton b = (CCButton) getChild(TBL_BUTTON_ADD);
b.setDisabled(true);
}
}
use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EntityEditViewBean method getIdType.
protected IdType getIdType(int hashCode) {
IdType idType = null;
EntitiesModel model = (EntitiesModel) getModel();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
Map types = model.getSupportedEntityTypes(curRealm);
for (Iterator iter = types.keySet().iterator(); iter.hasNext() && (idType == null); ) {
try {
IdType type = IdUtils.getType((String) iter.next());
if (type.hashCode() == hashCode) {
idType = type;
}
} catch (IdRepoException e) {
// display message
}
}
return idType;
}
use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EntityEditViewBean method setDefaultValues.
protected void setDefaultValues(String type) throws AMConsoleException {
if (propertySheetModel != null) {
EntitiesModel model = (EntitiesModel) getModel();
String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
if (!submitCycle) {
propertySheetModel.clear();
try {
Map attrValues = model.getAttributeValues(universalId, false);
AMPropertySheet prop = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
prop.setAttributeValues(attrValues, model);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
String[] uuid = { universalId };
propertySheetModel.setValues(PROPERTY_UUID, uuid, model);
}
}
use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EntityEditViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
EntitiesModel model = (EntitiesModel) getModel();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
Map localized = model.getSupportedEntityTypes(curRealm);
String type = (String) getPageSessionAttribute(ENTITY_TYPE);
String i18nName = (String) localized.get(type);
String title = model.getLocalizedString("page.title.entities.edit");
String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
propertySheetModel.setValue(PROPERTY_UUID, universalId);
// identityDisplayName also used be EndUserViewBean
identityDisplayName = AMFormatUtils.getIdentityDisplayName(model, universalId);
Object[] param = { i18nName, identityDisplayName };
ptModel.setPageTitleText(MessageFormat.format(title, param));
checkForAttributesToDisplay(type);
if (hasNoAttributeToDisplay) {
disableSaveAndResetButton();
}
}
use of com.sun.identity.console.idm.model.EntitiesModel in project OpenAM by OpenRock.
the class EntityEditViewBean method getBreadCrumbDisplayName.
protected String getBreadCrumbDisplayName() {
EntitiesModel model = (EntitiesModel) getModel();
String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
String[] arg = { AMFormatUtils.getIdentityDisplayName(model, universalId) };
return MessageFormat.format(model.getLocalizedString("breadcrumbs.editentities"), (Object[]) arg);
}
Aggregations