use of com.sun.identity.policy.NameNotFoundException in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method handleTblReferralsEditLinkRequest.
public void handleTblReferralsEditLinkRequest(RequestInvocationEvent event) throws ModelControlException {
PolicyModel model = (PolicyModel) getModel();
String name = hexToString((String) getDisplayFieldValue(TBL_REFERRALS_ACTION_HREF));
setPageSessionAttribute(ReferralEditViewBean.CALLING_VIEW_BEAN, getClass().getName());
setPageSessionAttribute(ReferralEditViewBean.EDIT_REFERRAL_NAME, name);
try {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
Referral referral = policy.getReferral(name);
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String referralType = referral.getReferralTypeName();
String viewBeanURL = model.getReferralViewBeanURL(realmName, referralType);
unlockPageTrail();
if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
forwardToReferralURL(viewBeanURL, name, referralType, realmName, "edit");
} else {
forwardToReferralEditViewBean(model, realmName, name, referralType);
}
} catch (NameNotFoundException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
forwardTo();
} catch (AMConsoleException e) {
debug.warning("PolicyOpViewBeanBase.handleTblReferralsEditLinkRequest", e);
redirectToStartURL();
}
}
use of com.sun.identity.policy.NameNotFoundException in project OpenAM by OpenRock.
the class ConditionEditViewBean method handleButton1Request.
private void handleButton1Request(CachedPolicy cachedPolicy) throws ModelControlException {
submitCycle = true;
boolean forwarded = false;
Condition deleted = null;
String origName = (String) getPageSessionAttribute(EDIT_CONDITION_NAME);
Policy policy = cachedPolicy.getPolicy();
try {
Condition condition = createCondition();
if (condition != null) {
String name = (String) propertySheetModel.getValue(CONDITION_NAME);
if (origName.equals(name)) {
policy.replaceCondition(name, condition);
} else {
deleted = policy.removeCondition(origName);
policy.addCondition(name, condition);
}
deleted = null;
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "policy.condition.updated");
cachedPolicy.setPolicyModified(true);
}
} catch (NameAlreadyExistsException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
} catch (InvalidNameException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
} catch (NameNotFoundException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
} finally {
if (deleted != null) {
try {
policy.addCondition(origName, deleted);
} catch (NameAlreadyExistsException e) {
debug.warning("ConditionEditViewBean.handleButton1Request", e);
} catch (InvalidNameException e) {
debug.warning("ConditionEditViewBean.handleButton1Request", e);
}
}
}
forwardTo();
}
use of com.sun.identity.policy.NameNotFoundException in project OpenAM by OpenRock.
the class PolicyModelImpl method getSvcTypeNameToActionsMap.
private Map getSvcTypeNameToActionsMap(Policy policy, String realmName) {
if (mapSvcTypeNameToActions == null) {
try {
Set serviceTypeNames = getServiceTypeNames().keySet();
int sz = serviceTypeNames.size();
mapSvcTypeNameToActions = new HashMap(sz * 2);
mapSvcTypeNameToResBundle = new HashMap(sz * 2);
ServiceTypeManager mgr = getServiceTypeManager();
for (Iterator i = serviceTypeNames.iterator(); i.hasNext(); ) {
String serviceTypeName = (String) i.next();
ServiceType serviceType = mgr.getServiceType(serviceTypeName);
if (serviceType != null) {
ResourceBundle rb = getResourceBundle(serviceType, getUserLocale());
if (rb != null) {
mapSvcTypeNameToResBundle.put(serviceTypeName, rb);
Set as = getActionSchemas(serviceType);
filterActionSchemaWithI18nKey(as);
if ((as != null) && !as.isEmpty()) {
mapSvcTypeNameToActions.put(serviceTypeName, as);
if (requiresResourceName(policy, realmName, serviceTypeName, as, true)) {
requiredResourceNameService.add(serviceTypeName);
}
if (requiresResourceName(policy, realmName, serviceTypeName, as, false)) {
notRequiredResourceNameService.add(serviceTypeName);
}
}
}
}
}
} catch (AMConsoleException e) {
debug.warning("PolicyModelImppl.getSvcTypeNameToActionsMap", e);
} catch (SSOException e) {
debug.warning("PolicyModelImppl.getSvcTypeNameToActionsMap", e);
} catch (NameNotFoundException e) {
debug.warning("PolicyModelImppl.getSvcTypeNameToActionsMap", e);
}
}
return mapSvcTypeNameToActions;
}
use of com.sun.identity.policy.NameNotFoundException in project OpenAM by OpenRock.
the class PolicyModelImpl method getResponseProviderInstance.
private ResponseProvider getResponseProviderInstance(String realmName, String typeName) {
ResponseProvider provider = null;
try {
PolicyManager policyMgr = getPolicyManager(realmName);
if (policyMgr != null) {
ResponseProviderTypeManager mgr = policyMgr.getResponseProviderTypeManager();
provider = mgr.getResponseProvider(typeName);
}
} catch (AMConsoleException e) {
debug.warning("PolicyModelImpl.getResponseProviderInstance", e);
} catch (NameNotFoundException e) {
debug.warning("PolicyModelImpl.getResponseProviderInstance", e);
} catch (PolicyException e) {
debug.warning("PolicyModelImpl.getResponseProviderInstance", e);
}
return provider;
}
use of com.sun.identity.policy.NameNotFoundException in project OpenAM by OpenRock.
the class PolicyModelImpl method getDisplayNameForSubjectValues.
/**
* Returns a map of values to localized label.
*
* @param realmName Name of realm.
* @param subjectTypeName Name of Subject Type.
* @param values Valid values.
* @return a map of values to localized label.
*/
public Map getDisplayNameForSubjectValues(String realmName, String subjectTypeName, Set values) {
Map map = null;
if ((values != null) && !values.isEmpty()) {
map = new HashMap(values.size() * 2);
Locale locale = getUserLocale();
try {
PolicyManager policyMgr = getPolicyManager(realmName);
if (policyMgr != null) {
SubjectTypeManager subjectTypeMgr = policyMgr.getSubjectTypeManager();
Subject subject = subjectTypeMgr.getSubject(subjectTypeName);
for (Iterator i = values.iterator(); i.hasNext(); ) {
String v = (String) i.next();
map.put(v, subject.getDisplayNameForValue(v, locale));
}
}
} catch (AMConsoleException e) {
debug.warning("PolicyModelImpl.getDisplayNameForSubjectValues", e);
} catch (NameNotFoundException e) {
debug.warning("PolicyModelImpl.getDisplayNameForSubjectValues", e);
} catch (PolicyException e) {
debug.warning("PolicyModelImpl.getDisplayNameForSubjectValues", e);
}
}
return (map == null) ? Collections.EMPTY_MAP : map;
}
Aggregations