Search in sources :

Example 1 with IDRepoModel

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

the class IDRepoAddViewBean 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.create");
    String[] param = { i18nName };
    ptModel.setPageTitleText(MessageFormat.format(title, (Object[]) param));
}
Also used : IDRepoModel(com.sun.identity.console.realm.model.IDRepoModel)

Example 2 with IDRepoModel

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

the class IDRepoAddViewBean method handleButton2Request.

/**
     * Handles create realm request.
     *
     * @param event Request invocation event
     */
public void handleButton2Request(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);
            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.createIDRepo(realmName, idRepoName, idRepoType, values);
            if (LoadSchema == true) {
                ServletContext servletCtx = event.getRequestContext().getServletContext();
                model.loadIdRepoSchema(idRepoName, realmName, servletCtx);
            }
            forwardToIDRepoViewBean();
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
            forwardTo();
        }
    } 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 3 with IDRepoModel

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

the class IDRepoAddViewBean method setDefaultValues.

/**
    * Sets the default values viewed in the create page for new 
    * data stores. 
    */
protected void setDefaultValues(String type) {
    IDRepoModel model = (IDRepoModel) getModel();
    Map defaultValues = model.getDefaultAttributeValues(type);
    AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
    ps.setAttributeValues(defaultValues, model);
}
Also used : AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) IDRepoModel(com.sun.identity.console.realm.model.IDRepoModel) Map(java.util.Map)

Example 4 with IDRepoModel

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

the class IDRepoViewBean method getIDRepoNames.

private void getIDRepoNames() {
    IDRepoModel model = (IDRepoModel) getModel();
    try {
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        populateTableModel(model.getIDRepoNames(curRealm));
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        // disable the button if the current location is invalid
        CCButton btnAdd = (CCButton) getChild(TBL_BUTTON_ADD);
        btnAdd.setDisabled(true);
    }
}
Also used : CCButton(com.sun.web.ui.view.html.CCButton) IDRepoModel(com.sun.identity.console.realm.model.IDRepoModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 5 with IDRepoModel

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

the class IDRepoViewBean method handleTblDataActionHrefRequest.

/**
     * Forwards request to edit ID Repo view bean.
     *
     * @param event Request Invocation Event.
     */
public void handleTblDataActionHrefRequest(RequestInvocationEvent event) {
    String idRepoName = hexToString((String) getDisplayFieldValue(TBL_DATA_ACTION_HREF));
    String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    try {
        IDRepoModel model = (IDRepoModel) getModel();
        setPageSessionAttribute(IDRepoOpViewBeanBase.IDREPO_NAME, idRepoName);
        setPageSessionAttribute(IDRepoOpViewBeanBase.IDREPO_TYPE, model.getIDRepoType(curRealm, idRepoName));
        IDRepoEditViewBean vb = (IDRepoEditViewBean) getViewBean(IDRepoEditViewBean.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)

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