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);
}
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;
}
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()));
}
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());
}
}
}
}
}
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;
}
Aggregations