Search in sources :

Example 11 with IDRepoModel

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

the class IDRepoViewBean method handleTblButtonDeleteRequest.

/**
     * Deletes ID Repo.
     *
     * @param event Request Invocation Event.
     * @throws ModelControlException if table model cannot be restored.
     */
public void handleTblButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
    CCActionTable table = (CCActionTable) getChild(TBL_SEARCH);
    table.restoreStateData();
    Integer[] selected = tblModel.getSelectedRows();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
    List list = (List) szCache.getSerializedObj();
    Set names = new HashSet(selected.length * 2);
    for (int i = 0; i < selected.length; i++) {
        names.add(list.get(selected[i].intValue()));
    }
    try {
        IDRepoModel model = (IDRepoModel) getModel();
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        model.deleteIDRepos(curRealm, names);
        if (selected.length == 1) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "idRepo.message.deleted");
        } else {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "idRepo.message.deleted.pural");
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) SerializedField(com.sun.identity.console.components.view.html.SerializedField) ArrayList(java.util.ArrayList) List(java.util.List) CCActionTable(com.sun.web.ui.view.table.CCActionTable) IDRepoModel(com.sun.identity.console.realm.model.IDRepoModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashSet(java.util.HashSet)

Example 12 with IDRepoModel

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

the class IDRepoEditViewBean method setDefaultValues.

/**
     * Sets the default values for the attributes of a particular 
     * data store entry. The name of the data store is retrieved from 
     * the page session. The type passed in the request is not used here.
     */
protected void setDefaultValues(String type) {
    String idRepoName = (String) getPageSessionAttribute(IDREPO_NAME);
    if (idRepoName != null) {
        IDRepoModel model = (IDRepoModel) getModel();
        String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        try {
            Map attrValues = model.getAttributeValues(realmName, idRepoName);
            propertySheetModel.clear();
            AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
            ps.setAttributeValues(attrValues, model);
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
            forwardTo();
        }
    }
}
Also used : AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) IDRepoModel(com.sun.identity.console.realm.model.IDRepoModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map)

Example 13 with IDRepoModel

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

the class IDRepoEditViewBean method getBreadCrumbDisplayName.

protected String getBreadCrumbDisplayName() {
    String idRepoName = (String) getPageSessionAttribute(IDREPO_NAME);
    String[] arg = { idRepoName };
    IDRepoModel model = (IDRepoModel) getModel();
    return MessageFormat.format(model.getLocalizedString("breadcrumbs.realm.idrepo.editIdRepo"), (Object[]) arg);
}
Also used : IDRepoModel(com.sun.identity.console.realm.model.IDRepoModel)

Example 14 with IDRepoModel

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

the class IDRepoOpViewBeanBase method createPropertyModel.

protected boolean createPropertyModel() {
    boolean created = false;
    HttpServletRequest req = RequestManager.getRequestContext().getRequest();
    String type = (String) getPageSessionAttribute(IDREPO_TYPE);
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    if ((type != null) && (type.trim().length() > 0)) {
        IDRepoModel model = (IDRepoModel) getModel();
        try {
            propertySheetModel = new AMPropertySheetModel(model.getPropertyXMLString(realmName, getClass().getName(), type, isCreateViewBean()));
            propertySheetModel.clear();
            created = true;
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
    }
    return created;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) AMPropertySheetModel(com.sun.identity.console.base.model.AMPropertySheetModel) IDRepoModel(com.sun.identity.console.realm.model.IDRepoModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 15 with IDRepoModel

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

the class IDRepoOpViewBeanBase method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    String idRepoName = (String) getPageSessionAttribute(IDREPO_NAME);
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    IDRepoModel model = (IDRepoModel) getModel();
    try {
        Map localizedMap = model.getIDRepoTypesMap();
        String idRepoType = (String) getPageSessionAttribute(IDREPO_TYPE);
        String i18nName = (String) localizedMap.get(idRepoType);
        if (!submitCycle) {
            setDefaultValues(idRepoType);
        }
        propertySheetModel.setValue(IDREPO_TYPE, idRepoType);
        propertySheetModel.setValue(IDREPO_TYPE_NAME, i18nName);
        propertySheetModel.setValue(IDREPO_NAME, idRepoName);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : 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