Search in sources :

Example 16 with IDRepoModel

use of com.sun.identity.console.realm.model.IDRepoModel in project OpenAM by OpenRock.

the class IDRepoViewBean method populateTableModel.

private void populateTableModel(Collection idRepoNames) {
    tblModel.clearAll();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    if ((idRepoNames != null) && !idRepoNames.isEmpty()) {
        List cache = new ArrayList(idRepoNames.size());
        IDRepoModel model = (IDRepoModel) getModel();
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        Map mapTypeToDisplayName = null;
        try {
            mapTypeToDisplayName = model.getIDRepoTypesMap();
        } catch (AMConsoleException e) {
            mapTypeToDisplayName = Collections.EMPTY_MAP;
        }
        boolean firstEntry = true;
        for (Iterator iter = idRepoNames.iterator(); iter.hasNext(); ) {
            if (firstEntry) {
                firstEntry = false;
            } else {
                tblModel.appendRow();
            }
            String name = (String) iter.next();
            tblModel.setValue(TBL_DATA_NAME, name);
            try {
                String type = model.getIDRepoType(curRealm, name);
                String displayName = (String) mapTypeToDisplayName.get(type);
                if (displayName == null) {
                    displayName = type;
                }
                tblModel.setValue(TBL_DATA_TYPE, displayName);
            } catch (AMConsoleException e) {
                tblModel.setValue(TBL_DATA_TYPE, "");
            }
            tblModel.setValue(TBL_DATA_ACTION_HREF, stringToHex(name));
            cache.add(name);
        }
        szCache.setValue((ArrayList) cache);
    } else {
        szCache.setValue(null);
    }
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) IDRepoModel(com.sun.identity.console.realm.model.IDRepoModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map)

Aggregations

IDRepoModel (com.sun.identity.console.realm.model.IDRepoModel)16 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)11 Map (java.util.Map)7 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)4 HashSet (java.util.HashSet)3 Iterator (java.util.Iterator)3 Set (java.util.Set)3 SerializedField (com.sun.identity.console.components.view.html.SerializedField)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ServletContext (javax.servlet.ServletContext)2 OptionList (com.iplanet.jato.view.html.OptionList)1 AMPropertySheetModel (com.sun.identity.console.base.model.AMPropertySheetModel)1 CCButton (com.sun.web.ui.view.html.CCButton)1 CCRadioButton (com.sun.web.ui.view.html.CCRadioButton)1 CCActionTable (com.sun.web.ui.view.table.CCActionTable)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1