use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class SubjectOpViewBeanBase 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 SubjectOpViewBeanBase 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 subjectType = (String) propertySheetModel.getValue(SUBJECT_TYPE);
Map mapLabels = model.getDisplayNameForSubjectValues(realmName, subjectType, values);
List tmp = AMFormatUtils.sortItems(values, model.getUserLocale());
for (Iterator iter = tmp.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 SelectReferralTypeViewBean method handleButton2Request.
/**
* Handles next button request.
*
* @param event Request invocation event.
*/
public void handleButton2Request(RequestInvocationEvent event) throws ModelControlException {
PolicyModel model = (PolicyModel) getModel();
String referralType = (String) propertySheetModel.getValue(ATTR_REFERRAL_TYPE);
setPageSessionAttribute(ReferralOpViewBeanBase.CALLING_VIEW_BEAN, (String) getPageSessionAttribute(CALLING_VIEW_BEAN));
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String viewBeanURL = model.getReferralViewBeanURL(realmName, referralType);
unlockPageTrailForSwapping();
if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
forwardToURL(viewBeanURL, referralType, realmName);
} else {
forwardToViewBean(model, referralType, realmName);
}
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class SelectServiceTypeViewBean method getTypeOptions.
protected OptionList getTypeOptions() {
PolicyModel model = (PolicyModel) getModel();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
try {
Policy policy = getCachedPolicy().getPolicy();
Map map = model.getServiceTypeNames();
Map options = new HashMap();
for (Iterator iter = map.keySet().iterator(); iter.hasNext(); ) {
String name = (String) iter.next();
String label = (String) map.get(name);
if (model.requiredResourceName(policy, curRealm, name)) {
String[] param = { label };
String lbl = MessageFormat.format(model.getLocalizedString("policy.rules.withResourceName"), (Object[]) param);
options.put(name + "|" + WITH_RESOURCE_SUFFIX, lbl);
}
if (model.notRequiredResourceName(policy, curRealm, name)) {
String[] param = { label };
String lbl = MessageFormat.format(model.getLocalizedString("policy.rules.withoutResourceName"), (Object[]) param);
options.put(name + "|" + WITHOUT_RESOURCE_SUFFIX, lbl);
}
}
return AMFormatUtils.getSortedOptionList(options, model.getUserLocale());
} catch (AMConsoleException e) {
debug.message("SelectServiceTypeViewBean.getTypeOptions " + "creating empty option list");
return new OptionList();
}
}
use of com.sun.identity.console.policy.model.PolicyModel in project OpenAM by OpenRock.
the class SelectServiceTypeViewBean method handleButton2Request.
/**
* Handles next button request.
*
* @param event Request invocation event.
*/
public void handleButton2Request(RequestInvocationEvent event) throws ModelControlException {
PolicyModel model = (PolicyModel) getModel();
String formatServiceType = (String) propertySheetModel.getValue(ATTR_SERVICE_TYPE);
int idx = formatServiceType.indexOf("|");
String serviceType = formatServiceType.substring(0, idx);
boolean withResource = formatServiceType.substring(idx + 1).equals(WITH_RESOURCE_SUFFIX);
setPageSessionAttribute(RuleOpViewBeanBase.CALLING_VIEW_BEAN, (String) getPageSessionAttribute(CALLING_VIEW_BEAN));
setPageSessionAttribute(RuleOpViewBeanBase.WITH_RESOURCE, withResource ? Boolean.TRUE : Boolean.FALSE);
RuleAddViewBean vb = null;
if (withResource) {
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
if (model.canCreateNewResource(realmName, serviceType)) {
vb = (RuleAddViewBean) getViewBean(RuleAddViewBean.class);
} else {
vb = (RuleAddViewBean) getViewBean(RuleWithPrefixAddViewBean.class);
}
} else {
vb = (RuleNoResourceAddViewBean) getViewBean(RuleNoResourceAddViewBean.class);
}
unlockPageTrailForSwapping();
passPgSessionMap(vb);
vb.serviceType = serviceType;
vb.forwardTo(getRequestContext());
}
Aggregations