use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class ResponseProviderOpViewBeanBase method getCachedPolicy.
protected CachedPolicy getCachedPolicy() throws AMConsoleException {
CachedPolicy policy = null;
String cacheID = (String) getPageSessionAttribute(ProfileViewBeanBase.PG_SESSION_POLICY_CACHE_ID);
if (cacheID != null) {
PolicyCache cache = PolicyCache.getInstance();
PolicyModel model = (PolicyModel) getModel();
policy = model.getCachedPolicy(cacheID);
}
return policy;
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class PolicySelectTypeViewBean method handleButton1Request.
/**
* Handles next button request.
*
* @param event Request invocation event.
*/
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
PolicyModel model = (PolicyModel) getModel();
String policyName = (String) propertySheetModel.getValue(PolicyModel.TF_NAME);
policyName = policyName.trim();
String policyType = (String) propertySheetModel.getValue(ATTR_POLICY_TYPE);
if (policyName.length() > 0) {
try {
boolean referralType = !policyType.equals(ATTR_VALUE_POLICY_TYPE_NORMAL);
String id = model.cachePolicy(policyName, "", referralType, true);
setPageSessionAttribute(PolicyOpViewBeanBase.PG_SESSION_POLICY_CACHE_ID, id);
PolicyOpViewBeanBase vb = null;
if (referralType) {
vb = (PolicyReferralAddViewBean) getViewBean(PolicyReferralAddViewBean.class);
} else {
vb = (PolicyNormalAddViewBean) getViewBean(PolicyNormalAddViewBean.class);
}
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
forwardTo();
}
} else {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "policy.missing.policyName");
forwardTo();
}
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class ReferralOpViewBeanBase method createOptionList.
protected OptionList createOptionList(Set values) {
OptionList optList = new OptionList();
if ((values != null) && !values.isEmpty()) {
PolicyModel model = (PolicyModel) getModel();
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String referralType = (String) propertySheetModel.getValue(REFERRAL_TYPE);
Map mapLabels = model.getDisplayNameForReferralValues(realmName, referralType, values);
for (Iterator iter = values.iterator(); iter.hasNext(); ) {
String value = (String) iter.next();
optList.add((String) mapLabels.get(value), value);
}
}
return optList;
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class ReferralOpViewBeanBase method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
if (!submitCycle) {
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
PolicyModel model = (PolicyModel) getModel();
String referralName = (String) getPageSessionAttribute(PG_SESSION_REFERRAL_NAME);
String referralType = (String) getPageSessionAttribute(PG_SESSION_REFERRAL_TYPE);
Syntax syntax = model.getReferralSyntax(realmName, referralType);
propertySheetModel.setValue(SYNTAX, Integer.toString(AMDisplayType.getDisplaySyntax(syntax)));
propertySheetModel.setValue(REFERRAL_NAME, referralName);
propertySheetModel.setValue(REFERRAL_TYPE, referralType);
Map map = model.getActiveReferralTypes(realmName);
String i18nName = (String) map.get(referralType);
propertySheetModel.setValue(REFERRAL_TYPE_NAME, i18nName);
}
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class ResponseProviderAddViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
wizard = getPageSessionAttribute(PolicyOpViewBeanBase.WIZARD) != null;
String ptTitle = "page.title.policy.responseprovider.create";
if (!wizard) {
ptTitle = "page.title.policy.responseprovider.create.shortcut";
disableButton("button1", true);
}
PolicyModel model = (PolicyModel) getModel();
String i18nName = (String) propertySheetModel.getValue(RESPONSEPROVIDER_TYPE_NAME);
String title = model.getLocalizedString(ptTitle);
String[] param = { i18nName };
ptModel.setPageTitleText(MessageFormat.format(title, (Object[]) param));
}
Aggregations