use of com.iplanet.jato.model.ModelControlException in project OpenAM by OpenRock.
the class SubConfigAddViewBean method getAttributeValueMap.
@Override
protected Map<String, Set<String>> getAttributeValueMap() {
try {
SubConfigModel model = (SubConfigModel) getModel();
AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
String schemaName = (String) getPageSessionAttribute(AMServiceProfile.PG_SESSION_SUB_SCHEMA_NAME);
return ps.getAttributeValues(model.getAttributeNames(schemaName));
} catch (AMConsoleException | ModelControlException e) {
debug.error("Could not retrieve attribute values", e);
}
return Collections.emptyMap();
}
use of com.iplanet.jato.model.ModelControlException 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.iplanet.jato.model.ModelControlException 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();
}
use of com.iplanet.jato.model.ModelControlException in project OpenAM by OpenRock.
the class PWResetQuestionTiledView method getAnswers.
/**
* Gets the answer to the secret question
*
* @return answer to the secret question
*/
public Map getAnswers() {
Map map = Collections.EMPTY_MAP;
PWResetQuestionModel model = getModel();
try {
DatasetModel dataModel = getPrimaryModel();
int size = dataModel.getSize();
if (size > 0) {
dataModel.first();
map = new HashMap(size);
}
for (int i = 0; i < size; i++) {
HiddenField hf = (HiddenField) getChild(FLD_ATTR_NAME);
String attrName = (String) hf.getValue();
String answer = (String) getDisplayFieldValue(TF_ANSWER);
if (answer != null) {
answer = answer.trim();
}
if (answer == null || answer.length() == 0) {
missingData = true;
}
map.put(attrName, answer);
dataModel.next();
}
} catch (ModelControlException mce) {
model.debugError("PWResetQuestionTiledView.getAnswers", mce);
}
return map;
}
use of com.iplanet.jato.model.ModelControlException in project OpenAM by OpenRock.
the class AuthExceptionViewBean method beginDisplay.
/**
* Called as notification that the JSP has begun its display
* processing. In addition to performing the default behavior in the
* superclass's version, this method executes any auto-retrieving or auto-
* executing models associated with this view unless auto-retrieval is
* disabled.
* @param event Display Event.
* @throws ModelControlException if manipulation of a model fails during
* display preparation or execution of auto-retrieving models.
*/
public void beginDisplay(DisplayEvent event) throws ModelControlException {
if (ad != null) {
try {
String cookieDomain = null;
Set<String> cookieDomainSet = AuthClientUtils.getCookieDomainsForRequest(request);
Cookie cookie;
setPageEncoding(request, response);
// No cookie domain specified in profile
if (cookieDomainSet.isEmpty()) {
cookie = AuthUtils.getLogoutCookie(ac, null);
response.addCookie(cookie);
} else {
Iterator iter = cookieDomainSet.iterator();
while (iter.hasNext()) {
cookieDomain = (String) iter.next();
cookie = AuthUtils.getLogoutCookie(ac, cookieDomain);
response.addCookie(cookie);
}
}
AuthUtils.clearlbCookie(request, response);
ResultVal = rb.getString("uncaught_exception");
} catch (Exception e) {
e.printStackTrace();
if (exDebug.messageEnabled()) {
exDebug.message("error in getting Exception : " + e.getMessage());
}
ResultVal = rb.getString("uncaught_exception") + " : " + e.getMessage();
}
}
}
Aggregations