Search in sources :

Example 1 with AMModel

use of com.sun.identity.console.base.model.AMModel in project OpenAM by OpenRock.

the class EditAuthTypeViewBean method getBreadCrumbDisplayName.

protected String getBreadCrumbDisplayName() {
    AMModel model = (AMModel) getModel();
    String serviceName = (String) getPageSessionAttribute(AMServiceProfile.SERVICE_NAME);
    Object[] arg = { model.getLocalizedServiceName(serviceName) };
    return MessageFormat.format(model.getLocalizedString("breadcrumbs.services.edit"), arg);
}
Also used : AMModel(com.sun.identity.console.base.model.AMModel)

Example 2 with AMModel

use of com.sun.identity.console.base.model.AMModel in project OpenAM by OpenRock.

the class SMDiscoveryDescriptionViewBeanBase method getModelInternal.

protected AMModel getModelInternal() {
    AMModel model = null;
    HttpServletRequest req = RequestManager.getRequestContext().getRequest();
    try {
        model = new SMDiscoveryServiceModelImpl(req, getPageSessionAttributes());
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    return model;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) AMModel(com.sun.identity.console.base.model.AMModel) SMDiscoveryServiceModelImpl(com.sun.identity.console.service.model.SMDiscoveryServiceModelImpl) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 3 with AMModel

use of com.sun.identity.console.base.model.AMModel in project OpenAM by OpenRock.

the class AMPropertySheetTest method shouldRemoveEmptyStringPropertyValues.

/**
     * OPENAM-3579: Test that the property sheet completely removes any properties that are set to the empty string.
     * This ensures that optional attributes can be removed by blanking out the associated field.
     */
@Test
public void shouldRemoveEmptyStringPropertyValues() throws ModelControlException, AMConsoleException {
    // Given
    String key = "phonenumber";
    String oldValue = "555123456789";
    String newValue = "";
    Map<String, Set<String>> oldValues = Collections.singletonMap(key, Collections.singleton(oldValue));
    AMModel amModel = mock(AMModel.class);
    given(mockModel.isChildSupported(key)).willReturn(true);
    given(mockModel.getValues(key)).willReturn(new Object[] { newValue });
    // When
    @SuppressWarnings("unchecked") Map<String, Set<String>> result = propertySheet.getAttributeValues(oldValues, true, amModel);
    // Then
    assertThat(result).isEqualTo(Collections.singletonMap(key, Collections.emptySet()));
}
Also used : Set(java.util.Set) AMModel(com.sun.identity.console.base.model.AMModel) Test(org.testng.annotations.Test)

Example 4 with AMModel

use of com.sun.identity.console.base.model.AMModel in project OpenAM by OpenRock.

the class PMDefaultAuthSchemeConditionEditViewBean method setPropertiesValues.

protected void setPropertiesValues(Map values) {
    if ((values != null) && !values.isEmpty()) {
        for (Iterator i = values.keySet().iterator(); i.hasNext(); ) {
            String propName = (String) i.next();
            Set propValue = (Set) values.get(propName);
            if ((propValue != null) && !propValue.isEmpty()) {
                if (propName.equals(AuthSchemeCondition.AUTH_SCHEME) && canModify) {
                    Set val = (Set) values.get(propName);
                    AMModel model = getModel();
                    CCSelect sl = (CCSelect) getChild(AuthSchemeCondition.AUTH_SCHEME);
                    sl.setOptions(createOptionList(getLabelValueMap(propValue)));
                    propertySheetModel.setValues(propName, propValue.toArray(), model);
                } else {
                    StringBuilder strValue = new StringBuilder(16);
                    for (Iterator x = propValue.iterator(); x.hasNext(); ) {
                        String tmp = (String) x.next();
                        if (strValue.length() > 0) {
                            strValue.append(", ");
                        }
                        strValue.append(tmp);
                    }
                    setDisplayFieldValue(propName, strValue.toString());
                }
            }
        }
    }
}
Also used : Set(java.util.Set) AMModel(com.sun.identity.console.base.model.AMModel) Iterator(java.util.Iterator) CCSelect(com.sun.web.ui.view.html.CCSelect)

Example 5 with AMModel

use of com.sun.identity.console.base.model.AMModel in project OpenAM by OpenRock.

the class G11NSupportedCharsetsViewBeanBase method getModelInternal.

protected AMModel getModelInternal() {
    AMModel model = null;
    HttpServletRequest req = RequestManager.getRequestContext().getRequest();
    try {
        model = new SMG11NModelImpl(req, getPageSessionAttributes());
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    return model;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) SMG11NModelImpl(com.sun.identity.console.service.model.SMG11NModelImpl) AMModel(com.sun.identity.console.base.model.AMModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Aggregations

AMModel (com.sun.identity.console.base.model.AMModel)33 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)14 HttpServletRequest (javax.servlet.http.HttpServletRequest)13 Iterator (java.util.Iterator)4 SMDiscoveryServiceModelImpl (com.sun.identity.console.service.model.SMDiscoveryServiceModelImpl)3 SubConfigModelImpl (com.sun.identity.console.service.model.SubConfigModelImpl)3 List (java.util.List)3 Set (java.util.Set)3 SMG11NModelImpl (com.sun.identity.console.service.model.SMG11NModelImpl)2 WSPersonalProfileServiceModelImpl (com.sun.identity.console.webservices.model.WSPersonalProfileServiceModelImpl)2 CCBreadCrumbsModel (com.sun.web.ui.model.CCBreadCrumbsModel)2 CCBreadCrumbs (com.sun.web.ui.view.breadcrumb.CCBreadCrumbs)2 CCSelect (com.sun.web.ui.view.html.CCSelect)2 ArrayList (java.util.ArrayList)2 Locale (java.util.Locale)2 RequestContext (com.iplanet.jato.RequestContext)1 OptionList (com.iplanet.jato.view.html.OptionList)1 AMCommonNameGenerator (com.sun.identity.console.base.model.AMCommonNameGenerator)1 SCSAML2SOAPBindingModelImpl (com.sun.identity.console.service.model.SCSAML2SOAPBindingModelImpl)1 SCSOAPBindingModelImpl (com.sun.identity.console.service.model.SCSOAPBindingModelImpl)1