Search in sources :

Example 6 with IDRepoModel

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

the class IDRepoEditViewBean method handleButton1Request.

/**
     * Handles save request when editing the properties of a data store 
     * entry for a realm.
     *
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    submitCycle = true;
    IDRepoModel model = (IDRepoModel) getModel();
    AMPropertySheet prop = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
    String idRepoType = (String) propertySheetModel.getValue(IDREPO_TYPE);
    String idRepoName = (String) propertySheetModel.getValue(IDREPO_NAME);
    Map defaultValues = model.getDefaultAttributeValues(idRepoType);
    if (idRepoName.trim().length() > 0) {
        try {
            boolean LoadSchema = false;
            Map values = prop.getAttributeValues(defaultValues.keySet());
            String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
            values.remove(IdConstants.SERVICE_ATTRS);
            Set set = (HashSet) values.get("idRepoLoadSchema");
            if (set != null) {
                Iterator i = set.iterator();
                if (i.hasNext()) {
                    String loadingSchemaFlag = (String) i.next();
                    if (loadingSchemaFlag.equals("true") && IdRepoUtils.hasIdRepoSchema(idRepoType)) {
                        LoadSchema = true;
                    }
                }
            }
            model.editIDRepo(realmName, idRepoName, values);
            if (LoadSchema == true) {
                ServletContext servletCtx = event.getRequestContext().getServletContext();
                model.loadIdRepoSchema(idRepoName, realmName, servletCtx);
            }
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "message.updated");
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
    } else {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "idrepo.missing.idRepoName");
    }
    forwardTo();
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) Iterator(java.util.Iterator) ServletContext(javax.servlet.ServletContext) IDRepoModel(com.sun.identity.console.realm.model.IDRepoModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) HashSet(java.util.HashSet)

Example 7 with IDRepoModel

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

the class IDRepoEditViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    IDRepoModel model = (IDRepoModel) getModel();
    String i18nName = (String) propertySheetModel.getValue(IDREPO_TYPE_NAME);
    String title = model.getLocalizedString("page.title.realm.idrepo.edit");
    String[] param = { i18nName };
    ptModel.setPageTitleText(MessageFormat.format(title, (Object[]) param));
}
Also used : IDRepoModel(com.sun.identity.console.realm.model.IDRepoModel)

Example 8 with IDRepoModel

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

the class IDRepoSelectTypeViewBean method handleButton2Request.

/**
     * Handles next button request.
     *
     * @param event Request invocation event.
     */
public void handleButton2Request(RequestInvocationEvent event) throws ModelControlException {
    IDRepoModel model = (IDRepoModel) getModel();
    String idRepoName = (String) propertySheetModel.getValue(IDRepoModel.TF_NAME);
    idRepoName = idRepoName.trim();
    String idRepoType = (String) propertySheetModel.getValue(ATTR_IDREPO_TYPE);
    if (idRepoName.length() > 0) {
        IDRepoAddViewBean vb = (IDRepoAddViewBean) getViewBean(IDRepoAddViewBean.class);
        setPageSessionAttribute(IDRepoAddViewBean.IDREPO_NAME, idRepoName);
        setPageSessionAttribute(IDRepoAddViewBean.IDREPO_TYPE, idRepoType);
        unlockPageTrailForSwapping();
        passPgSessionMap(vb);
        vb.forwardTo(getRequestContext());
    } else {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "idrepo.missing.idRepoName");
        forwardTo();
    }
}
Also used : IDRepoModel(com.sun.identity.console.realm.model.IDRepoModel)

Example 9 with IDRepoModel

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

the class IDRepoSelectTypeViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    disableButton("button1", true);
    try {
        IDRepoModel model = (IDRepoModel) getModel();
        OptionList optList = model.getIDRepoTypes();
        if (optList.size() > 0) {
            CCRadioButton menu = (CCRadioButton) getChild(ATTR_IDREPO_TYPE);
            menu.setOptions(optList);
            String type = (String) menu.getValue();
            if ((type == null) || (type.trim().length() == 0)) {
                menu.setValue(optList.getValue(0));
            }
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : CCRadioButton(com.sun.web.ui.view.html.CCRadioButton) IDRepoModel(com.sun.identity.console.realm.model.IDRepoModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) OptionList(com.iplanet.jato.view.html.OptionList)

Example 10 with IDRepoModel

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

the class IDRepoViewBean method handleTblButtonAddRequest.

/**
     * Forwards request to creation view bean.
     *
     * @param event Request Invocation Event.
     */
public void handleTblButtonAddRequest(RequestInvocationEvent event) {
    IDRepoModel model = (IDRepoModel) getModel();
    try {
        Map map = model.getIDRepoTypesMap();
        /*
 * This causes the first step of the New Data Store wizard to be skipped
 * when only one Data Store type is available. The ideal fix is to modify the 
 * second step page to act as a single page. This is only a temporary fix 
 * until the page two work can be done.
 */
        /********
            if (map.size() == 1) {
                IDRepoAddViewBean vb = (IDRepoAddViewBean)getViewBean(
                    IDRepoAddViewBean.class);
                setPageSessionAttribute(IDRepoAddViewBean.IDREPO_NAME, "");
                setPageSessionAttribute(IDRepoAddViewBean.IDREPO_TYPE,
                    (String)map.keySet().iterator().next());
                unlockPageTrail();
                passPgSessionMap(vb);
                vb.forwardTo(getRequestContext());
            } else {
                IDRepoSelectTypeViewBean vb =
                    (IDRepoSelectTypeViewBean)getViewBean(
                    IDRepoSelectTypeViewBean.class);
                unlockPageTrail();
                passPgSessionMap(vb);
                vb.forwardTo(getRequestContext());
            }
            ********/
        IDRepoSelectTypeViewBean vb = (IDRepoSelectTypeViewBean) getViewBean(IDRepoSelectTypeViewBean.class);
        unlockPageTrail();
        passPgSessionMap(vb);
        vb.forwardTo(getRequestContext());
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        forwardTo();
    }
}
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