use of com.sun.identity.policy.interfaces.Referral in project OpenAM by OpenRock.
the class ReferralEditViewBean method getDefaultValues.
protected Set getDefaultValues() {
Set values = null;
try {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
String referralName = (String) getPageSessionAttribute(PG_SESSION_REFERRAL_NAME);
Referral referral = policy.getReferral(referralName);
values = referral.getValues();
} catch (NameNotFoundException e) {
debug.warning("ReferralEditViewBean.getDefaultValues", e);
} catch (AMConsoleException e) {
debug.warning("ReferralEditViewBean.getDefaultValues", e);
}
return values;
}
use of com.sun.identity.policy.interfaces.Referral in project OpenAM by OpenRock.
the class ReferralOpViewBeanBase method createReferral.
protected Referral createReferral() throws ModelControlException, AMConsoleException {
Referral referral = null;
String referralType = (String) propertySheetModel.getValue(REFERRAL_TYPE);
String referralName = getReferralName();
if (referralName != null) {
Set values = getValues(referralType);
if (values != null) {
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
PolicyModel model = (PolicyModel) getModel();
referral = model.createReferral(realmName, referralType, values);
}
}
return referral;
}
use of com.sun.identity.policy.interfaces.Referral in project OpenAM by OpenRock.
the class ReferralAddViewBean method handleButton2Request.
/**
* Handles create policy request.
*
* @param event Request invocation event
*/
public void handleButton2Request(RequestInvocationEvent event) throws ModelControlException {
boolean forwarded = false;
submitCycle = true;
try {
Referral referral = createReferral();
if (referral != null) {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
String name = (String) propertySheetModel.getValue(REFERRAL_NAME);
policy.addReferral(name, referral);
backTrail();
forwardToPolicyViewBean();
forwarded = 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 (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
} finally {
if (!forwarded) {
forwardTo();
}
}
}
use of com.sun.identity.policy.interfaces.Referral 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.interfaces.Referral 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;
}
Aggregations