use of com.sun.identity.policy.ReferralTypeManager in project OpenAM by OpenRock.
the class PolicyModelImpl method getReferralPossibleValues.
/**
* Returns a set of possible values for a referral type.
*
* @param realmName Name of Realm.
* @param referralType Name of Referral Type.
* @param filter wildcards for filtering the results.
* @return a set of possible values for a referral type.
*/
public ValidValues getReferralPossibleValues(String realmName, String referralType, String filter) {
ValidValues values = null;
try {
PolicyManager policyMgr = getPolicyManager(realmName);
if (policyMgr != null) {
ReferralTypeManager referralTypeMgr = policyMgr.getReferralTypeManager();
Referral referral = referralTypeMgr.getReferral(referralType);
values = referral.getValidValues(getUserSSOToken(), filter);
}
} catch (AMConsoleException e) {
debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
} catch (NameNotFoundException e) {
debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
} catch (SSOException e) {
debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
} catch (PolicyException e) {
debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
}
return values;
}
use of com.sun.identity.policy.ReferralTypeManager in project OpenAM by OpenRock.
the class PolicyModelImpl method getActiveReferralTypes.
/**
* Returns a map of active referral types for a realm to its display name.
*
* @param realmName Name of Realm.
* @return a map of active referral types for a realm to its display name.
*/
public Map getActiveReferralTypes(String realmName) {
Map referralTypes = null;
try {
PolicyManager policyMgr = getPolicyManager(realmName);
if (policyMgr != null) {
ReferralTypeManager referralTypeMgr = policyMgr.getReferralTypeManager();
if (referralTypeMgr != null) {
Set types = referralTypeMgr.getSelectedReferralTypeNames();
referralTypes = new HashMap(types.size() * 2);
for (Iterator iter = types.iterator(); iter.hasNext(); ) {
String rName = (String) iter.next();
Referral referral = referralTypeMgr.getReferral(rName);
if (referral != null) {
Syntax syntax = referral.getValueSyntax(getUserSSOToken());
if (!syntax.equals(Syntax.NONE)) {
referralTypes.put(rName, referralTypeMgr.getDisplayName(rName));
}
}
}
}
}
} catch (AMConsoleException e) {
debug.warning("PolicyModelImpl.getActiveReferralTypes", e);
} catch (SSOException e) {
debug.warning("PolicyModelImpl.getActiveReferralTypes", e);
} catch (NameNotFoundException e) {
debug.warning("PolicyModelImpl.getActiveReferralTypes", e);
} catch (PolicyException e) {
debug.warning("PolicyModelImpl.getActiveReferralTypes", e);
}
return (referralTypes == null) ? Collections.EMPTY_MAP : referralTypes;
}
use of com.sun.identity.policy.ReferralTypeManager in project OpenAM by OpenRock.
the class PolicyModelImpl method createReferral.
/**
* Returns a referral object.
*
* @param realmName Name of Realm.
* @param referralType Name of referral type.
* @param values Values of the referral.
* @return referral obejct.
* @throws AMConsoleException if referral cannot be created.
*/
public Referral createReferral(String realmName, String referralType, Set values) throws AMConsoleException {
Referral referral = null;
try {
PolicyManager policyMgr = getPolicyManager(realmName);
if (policyMgr != null) {
ReferralTypeManager referralTypeMgr = policyMgr.getReferralTypeManager();
referral = referralTypeMgr.getReferral(referralType);
referral.setValues(values);
}
} catch (NameNotFoundException e) {
throw new AMConsoleException(getErrorString(e));
} catch (PolicyException e) {
throw new AMConsoleException(getErrorString(e));
}
return referral;
}
use of com.sun.identity.policy.ReferralTypeManager in project OpenAM by OpenRock.
the class PolicyModelImpl method getDisplayNameForReferralValues.
/**
* Returns a map of values to localized label.
*
* @param realmName Name of realm.
* @param referralTypeName Name of referral Type.
* @param values Valid values.
* @return a map of values to localized label.
*/
public Map getDisplayNameForReferralValues(String realmName, String referralTypeName, 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) {
ReferralTypeManager mgr = policyMgr.getReferralTypeManager();
Referral referral = mgr.getReferral(referralTypeName);
for (Iterator i = values.iterator(); i.hasNext(); ) {
String v = (String) i.next();
map.put(v, referral.getDisplayNameForValue(v, locale));
}
}
} catch (AMConsoleException e) {
debug.warning("PolicyModelImpl.getDisplayNameForReferralValues", e);
} catch (NameNotFoundException e) {
debug.warning("PolicyModelImpl.getDisplayNameForReferralValues", e);
} catch (PolicyException e) {
debug.warning("PolicyModelImpl.getDisplayNameForReferralValues", e);
}
}
return (map == null) ? Collections.EMPTY_MAP : map;
}
use of com.sun.identity.policy.ReferralTypeManager in project OpenAM by OpenRock.
the class PolicyModelImpl method getReferralViewBeanURL.
/**
* Returns properties view bean URL of a referral.
*
* @param realmName Name of realm.
* @param referralTypeName Name of Referral Type.
* @return properties view bean URL of a referral.
*/
public String getReferralViewBeanURL(String realmName, String referralTypeName) {
String url = null;
try {
PolicyManager policyMgr = getPolicyManager(realmName);
if (policyMgr != null) {
ReferralTypeManager referralTypeMgr = policyMgr.getReferralTypeManager();
Referral referral = referralTypeMgr.getReferral(referralTypeName);
url = referralTypeMgr.getViewBeanURL(referral);
}
} catch (AMConsoleException e) {
debug.warning("PolicyModelImpl.getReferralViewBeanURL", e);
} catch (NameNotFoundException e) {
debug.warning("PolicyModelImpl.getReferralViewBeanURL", e);
} catch (PolicyException e) {
debug.warning("PolicyModelImpl.getReferralViewBeanURL", e);
}
return url;
}
Aggregations