use of com.sun.identity.policy.interfaces.ResponseProvider in project OpenAM by OpenRock.
the class ResponseProviderEditViewBean method getDefaultValues.
protected Map getDefaultValues() {
Map values = null;
String providerName = (String) getPageSessionAttribute(ResponseProviderOpViewBeanBase.PG_SESSION_PROVIDER_NAME);
try {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
ResponseProvider provider = policy.getResponseProvider(providerName);
values = provider.getProperties();
} catch (NameNotFoundException e) {
debug.warning("ResponseProviderEditViewBean.getDefaultValues", e);
} catch (AMConsoleException e) {
debug.warning("ResponseProviderEditViewBean.getDefaultValues", e);
}
return values;
}
use of com.sun.identity.policy.interfaces.ResponseProvider in project OpenAM by OpenRock.
the class ResponseProviderAddViewBean method handleButton2Request.
/**
* Handles create policy request.
*
* @param event Request invocation event
*/
public void handleButton2Request(RequestInvocationEvent event) throws ModelControlException {
boolean forwarded = false;
submitCycle = true;
try {
ResponseProvider provider = createResponseProvider();
if (provider != null) {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
String name = (String) propertySheetModel.getValue(RESPONSEPROVIDER_NAME);
policy.addResponseProvider(name, provider);
backTrail();
forwardToPolicyViewBean();
forwarded = true;
}
} catch (NameAlreadyExistsException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", getModel().getErrorString(e));
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
if (!forwarded) {
forwardTo();
}
}
use of com.sun.identity.policy.interfaces.ResponseProvider in project OpenAM by OpenRock.
the class PrivilegeUtils method toResourceAttributes.
private static Set<ResourceAttribute> toResourceAttributes(Policy policy) throws PolicyException, EntitlementException {
Set rpNames = policy.getResponseProviderNames();
Set nrps = new HashSet();
for (Object rpNameObj : rpNames) {
String rpName = (String) rpNameObj;
ResponseProvider rp = policy.getResponseProvider(rpName);
Object[] nrp = new Object[2];
nrp[0] = rpName;
nrp[1] = rp;
nrps.add(nrp);
}
return nrpsToResourceAttributes(nrps);
}
use of com.sun.identity.policy.interfaces.ResponseProvider in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method handleTblResponseProvidersEditLinkRequest.
public void handleTblResponseProvidersEditLinkRequest(RequestInvocationEvent event) throws ModelControlException {
PolicyModel model = (PolicyModel) getModel();
String name = hexToString((String) getDisplayFieldValue(TBL_RESPONSE_ATTRIBUTES_ACTION_HREF));
setPageSessionAttribute(ResponseProviderEditViewBean.CALLING_VIEW_BEAN, getClass().getName());
setPageSessionAttribute(ResponseProviderEditViewBean.EDIT_RESPONSEPROVIDER_NAME, name);
try {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
ResponseProvider provider = policy.getResponseProvider(name);
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String responseProviderType = model.getResponseProviderTypeName(realmName, provider);
String viewBeanURL = model.getResponseProviderViewBeanURL(realmName, responseProviderType);
unlockPageTrail();
if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
forwardToResponseProviderURL(viewBeanURL, name, responseProviderType, realmName, "edit");
} else {
forwardToResponseProviderEditViewBean(model, realmName, name, responseProviderType);
}
} catch (NameNotFoundException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getErrorString(e));
forwardTo();
} catch (AMConsoleException e) {
debug.warning("PolicyOpViewBeanBase.handleTblResponseProvidersEditLinkRequest", e);
redirectToStartURL();
}
}
use of com.sun.identity.policy.interfaces.ResponseProvider in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method populateResponseProvidersTable.
protected void populateResponseProvidersTable() throws AMConsoleException {
tblResponseProvidersModel.clearAll();
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
Set responseProviderNames = policy.getResponseProviderNames();
if ((responseProviderNames != null) && !responseProviderNames.isEmpty()) {
PolicyModel model = (PolicyModel) getModel();
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
Map localizedRespAttrTypeNames = model.getActiveResponseProviderTypes(realmName);
boolean firstEntry = true;
for (Iterator i = responseProviderNames.iterator(); i.hasNext(); ) {
if (firstEntry) {
firstEntry = false;
} else {
tblResponseProvidersModel.appendRow();
}
try {
String name = (String) i.next();
ResponseProvider provider = policy.getResponseProvider(name);
tblResponseProvidersModel.setValue(TBL_RESPONSE_ATTRIBUTES_DATA_NAME, name);
String respAttrTypeName = model.getResponseProviderTypeName(realmName, provider);
String displayName = (String) localizedRespAttrTypeNames.get(respAttrTypeName);
if (displayName == null) {
displayName = respAttrTypeName;
}
tblResponseProvidersModel.setValue(TBL_RESPONSE_ATTRIBUTES_DATA_TYPE, displayName);
tblResponseProvidersModel.setValue(TBL_RESPONSE_ATTRIBUTES_ACTION_HREF, stringToHex(name));
} catch (NameNotFoundException e) {
debug.warning("PolicyOpViewBeanBase.populateResponseProvidersTable", e);
}
}
}
}
Aggregations