use of com.sun.identity.console.sts.model.STSInstanceModelResponse in project OpenAM by OpenRock.
the class STSAddViewBeanBase method handleButton1Request.
/**
* Handles save button request. Validates the rest sts configuration state, and invokes the model to publish a
* rest sts instance corresponding to this state.
* @param event Request invocation event
*/
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
submitCycle = true;
try {
Map<String, Set<String>> configurationState = (Map<String, Set<String>>) getAttributeSettings();
STSInstanceModel model = (STSInstanceModel) getModel();
STSInstanceModelResponse validationResponse = model.validateConfigurationState(stsType, configurationState);
if (validationResponse.isSuccessful()) {
final String currentRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
try {
STSInstanceModelResponse creationResponse = model.createInstance(stsType, configurationState, currentRealm);
if (creationResponse.isSuccessful()) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", creationResponse.getMessage());
forwardToAMViewBean();
} else {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", creationResponse.getMessage());
}
} catch (AMConsoleException e) {
throw new ModelControlException(e);
}
} else {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", validationResponse.getMessage());
}
} catch (AMConsoleException e) {
//will be entered if getAttributeSettings throws a AMConsoleException because passwords are mis-matched.
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
use of com.sun.identity.console.sts.model.STSInstanceModelResponse in project OpenAM by OpenRock.
the class STSEditViewBeanBase method handleButton1Request.
/**
* Handles save button request. Validates the rest sts configuration state, and invokes the model to publish a
* rest sts instance corresponding to this state.
* @param event Request invocation event
*/
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
submitCycle = true;
final String currentRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
final String instanceName = (String) getPageSessionAttribute(STSHomeViewBean.INSTANCE_NAME);
try {
Map<String, Set<String>> configurationState = getUpdatedConfigurationState(currentRealm, instanceName);
if (configurationState.isEmpty()) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", getModel().getLocalizedString("rest.sts.view.no.updates"));
} else {
if (instanceNameUpdated(currentRealm, instanceName)) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", MessageFormat.format(getModel().getLocalizedString("rest.sts.view.no.edit.deployment.url"), instanceName));
} else {
STSInstanceModel model = (STSInstanceModel) getModel();
STSInstanceModelResponse validationResponse = model.validateConfigurationState(stsType, configurationState);
if (validationResponse.isSuccessful()) {
try {
STSInstanceModelResponse creationResponse = model.updateInstance(stsType, configurationState, currentRealm, instanceName);
if (creationResponse.isSuccessful()) {
forwardToSTSHomeViewBean();
} else {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", creationResponse.getMessage());
}
} catch (AMConsoleException e) {
throw new ModelControlException(e);
}
} else {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", validationResponse.getMessage());
}
}
}
} catch (AMConsoleException e) {
//getUpdatedConfigurationState will throw this exception if passwords are mis-matched.
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
Aggregations