use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method handleTblReferralsButtonDeleteRequest.
public void handleTblReferralsButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
CCActionTable table = (CCActionTable) getChild(TBL_REFERRALS);
table.restoreStateData();
try {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
Integer[] selected = tblReferralsModel.getSelectedRows();
for (int i = 0; i < selected.length; i++) {
tblReferralsModel.setRowIndex(selected[i].intValue());
String name = (String) tblReferralsModel.getValue(TBL_REFERRALS_DATA_NAME);
policy.removeReferral(name);
}
cachedPolicy.setPolicyModified(true);
populateReferralsTable();
forwardTo();
} catch (AMConsoleException e) {
debug.warning("PolicyOpViewBeanBase.handleTblReferralsButtonDeleteRequest", e);
redirectToStartURL();
}
}
use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method populateAttributes.
protected void populateAttributes() throws AMConsoleException {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
propertySheetModel.setValue(PolicyModel.TF_NAME, policy.getName());
propertySheetModel.setValue(ATTR_DESCRIPTION, policy.getDescription());
propertySheetModel.setValue(ATTR_ISACTIVE, policy.isActive() ? "true" : "false");
}
use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method handleTblConditionsEditLinkRequest.
public void handleTblConditionsEditLinkRequest(RequestInvocationEvent event) throws ModelControlException {
PolicyModel model = (PolicyModel) getModel();
String name = hexToString((String) getDisplayFieldValue(TBL_CONDITIONS_ACTION_HREF));
setPageSessionAttribute(ConditionEditViewBean.CALLING_VIEW_BEAN, getClass().getName());
setPageSessionAttribute(ConditionEditViewBean.EDIT_CONDITION_NAME, name);
try {
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
Condition condition = policy.getCondition(name);
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String conditionType = model.getConditionTypeName(realmName, condition);
String viewBeanURL = model.getConditionViewBeanURL(realmName, conditionType);
unlockPageTrail();
if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
forwardToConditionURL(viewBeanURL, name, conditionType, realmName, "edit");
} else {
forwardToConditionEditViewBean(model, realmName, name, conditionType);
}
} catch (NameNotFoundException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getErrorString(e));
forwardTo();
} catch (AMConsoleException e) {
debug.warning("PolicyOpViewBeanBase.handleTblConditionsButtonDeleteRequest", e);
redirectToStartURL();
}
}
use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method populateRulesTable.
protected void populateRulesTable() throws AMConsoleException {
tblRulesModel.clearAll();
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
Set ruleNames = policy.getRuleNames();
if ((ruleNames != null) && !ruleNames.isEmpty()) {
PolicyModel model = (PolicyModel) getModel();
Map localizedSvcTypeNames = model.getServiceTypeNames();
boolean firstEntry = true;
for (Iterator iter = ruleNames.iterator(); iter.hasNext(); ) {
if (firstEntry) {
firstEntry = false;
} else {
tblRulesModel.appendRow();
}
try {
String name = (String) iter.next();
Rule rule = policy.getRule(name);
tblRulesModel.setValue(TBL_RULES_DATA_NAME, name);
tblRulesModel.setValue(TBL_RULES_DATA_TYPE, localizedSvcTypeNames.get(rule.getServiceTypeName()));
tblRulesModel.setValue(TBL_RULES_ACTION_HREF, stringToHex(name));
} catch (NameNotFoundException e) {
debug.warning("PolicyOpViewBeanBase.populateRulesTable", e);
}
}
}
}
use of com.sun.identity.console.policy.model.CachedPolicy in project OpenAM by OpenRock.
the class PolicyOpViewBeanBase method populateReferralsTable.
protected void populateReferralsTable() throws AMConsoleException {
tblReferralsModel.clearAll();
CachedPolicy cachedPolicy = getCachedPolicy();
Policy policy = cachedPolicy.getPolicy();
Set referralsNames = policy.getReferralNames();
if ((referralsNames != null) && !referralsNames.isEmpty()) {
PolicyModel model = (PolicyModel) getModel();
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
Map localizedRflTypeNames = model.getActiveReferralTypes(realmName);
boolean firstEntry = true;
for (Iterator iter = referralsNames.iterator(); iter.hasNext(); ) {
if (firstEntry) {
firstEntry = false;
} else {
tblReferralsModel.appendRow();
}
try {
String name = (String) iter.next();
Referral referral = policy.getReferral(name);
tblReferralsModel.setValue(TBL_REFERRALS_DATA_NAME, name);
String rflTypeName = referral.getReferralTypeName();
String displayName = (String) localizedRflTypeNames.get(rflTypeName);
if (displayName == null) {
displayName = rflTypeName;
}
tblReferralsModel.setValue(TBL_REFERRALS_DATA_TYPE, displayName);
tblReferralsModel.setValue(TBL_REFERRALS_ACTION_HREF, stringToHex(name));
} catch (NameNotFoundException e) {
debug.warning("PolicyOpViewBeanBase.populateReferralsTable", e);
}
}
}
}
Aggregations