Search in sources :

Example 46 with EntitiesModel

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);
    }
}
Also used : IdSearchResults(com.sun.identity.idm.IdSearchResults) CCButton(com.sun.web.ui.view.html.CCButton) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 47 with EntitiesModel

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;
}
Also used : Iterator(java.util.Iterator) IdRepoException(com.sun.identity.idm.IdRepoException) HashMap(java.util.HashMap) Map(java.util.Map) IdType(com.sun.identity.idm.IdType) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 48 with EntitiesModel

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);
    }
}
Also used : AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 49 with EntitiesModel

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();
    }
}
Also used : HashMap(java.util.HashMap) Map(java.util.Map) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 50 with EntitiesModel

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);
}
Also used : EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Aggregations

EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)55 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)23 Map (java.util.Map)15 Set (java.util.Set)13 HashSet (java.util.HashSet)10 Iterator (java.util.Iterator)10 List (java.util.List)9 OptionList (com.iplanet.jato.view.html.OptionList)7 AMIdentity (com.sun.identity.idm.AMIdentity)7 IdRepoException (com.sun.identity.idm.IdRepoException)7 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)7 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)5 SerializedField (com.sun.identity.console.components.view.html.SerializedField)5 CCAddRemoveModel (com.sun.web.ui.model.CCAddRemoveModel)4 CCAddRemove (com.sun.web.ui.view.addremove.CCAddRemove)4 AMViewConfig (com.sun.identity.console.base.AMViewConfig)3 IdSearchResults (com.sun.identity.idm.IdSearchResults)3 IdType (com.sun.identity.idm.IdType)3 AMPropertySheetModel (com.sun.identity.console.base.model.AMPropertySheetModel)2