use of com.sun.identity.policy.PolicyManager in project OpenAM by OpenRock.
the class PolicyModelImpl method getConditionInstance.
private Condition getConditionInstance(String realmName, String conditionTypeName) {
Condition condition = null;
try {
PolicyManager policyMgr = getPolicyManager(realmName);
if (policyMgr != null) {
ConditionTypeManager condTypeMgr = policyMgr.getConditionTypeManager();
condition = condTypeMgr.getCondition(conditionTypeName);
}
} catch (AMConsoleException e) {
debug.warning("PolicyModelImpl.getConditionInstance", e);
} catch (NameNotFoundException e) {
debug.warning("PolicyModelImpl.getConditionInstance", e);
} catch (PolicyException e) {
debug.warning("PolicyModelImpl.getConditionInstance", e);
}
return condition;
}
use of com.sun.identity.policy.PolicyManager in project OpenAM by OpenRock.
the class PolicyModelImpl method replacePolicy.
/**
* Modifies a policy.
*
* @param realmName Name of realm.
* @param policy Policy object.
* @throws AMConsoleException if policy cannot be created.
*/
public void replacePolicy(String realmName, Policy policy) throws AMConsoleException {
try {
String[] params = { realmName, policy.getName() };
logEvent("ATTEMPT_MODIFY_POLICY", params);
PolicyManager policyManager = getPolicyManager(realmName);
policyManager.replacePolicy(policy);
logEvent("SUCCEED_MODIFY_POLICY", params);
} catch (PolicyException e) {
String strError = getErrorString(e);
String[] params = { realmName, policy.getName(), strError };
logEvent("POLICY_EXCEPTION_MODIFY_POLICY", params);
throw new AMConsoleException(getErrorString(e));
} catch (SSOException e) {
String strError = getErrorString(e);
String[] params = { realmName, policy.getName(), strError };
logEvent("SSO_EXCEPTION_MODIFY_POLICY", params);
throw new AMConsoleException(getErrorString(e));
}
}
use of com.sun.identity.policy.PolicyManager 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;
}
use of com.sun.identity.policy.PolicyManager in project OpenAM by OpenRock.
the class PolicyModelImpl method getSubjectTypeName.
/**
* Returns subject type name of a subject.
*
* @param realmName Name of realm.
* @param subject Subject instance.
* @return subject type name of a subject.
*/
public String getSubjectTypeName(String realmName, Subject subject) {
String typeName = null;
try {
PolicyManager policyMgr = getPolicyManager(realmName);
if (policyMgr != null) {
SubjectTypeManager subjectTypeMgr = policyMgr.getSubjectTypeManager();
typeName = subjectTypeMgr.getSubjectTypeName(subject);
}
} catch (AMConsoleException e) {
debug.warning("PolicyModelImpl.getSubjectTypeName", e);
}
return typeName;
}
use of com.sun.identity.policy.PolicyManager in project OpenAM by OpenRock.
the class PolicyModelImpl method getConditionTypeName.
/**
* Returns condition type name of a condition.
*
* @param realmName Name of realm.
* @param condition Condition instance.
* @return Condition type name of a condition.
*/
public String getConditionTypeName(String realmName, Condition condition) {
String typeName = null;
try {
PolicyManager policyMgr = getPolicyManager(realmName);
if (policyMgr != null) {
ConditionTypeManager conditionTypeMgr = policyMgr.getConditionTypeManager();
typeName = conditionTypeMgr.getConditionTypeName(condition);
}
} catch (AMConsoleException e) {
debug.warning("PolicyModelImpl.getConditionTypeName", e);
}
return typeName;
}
Aggregations