use of com.sun.web.ui.model.CCActionTableModel in project OpenAM by OpenRock.
the class SMDiscoveryServiceViewBean method handleTblBootstrapResOffButtonDeleteRequest.
/**
* Handles remove resource offerings request.
*
* @param event Request Invocation Event.
*/
public void handleTblBootstrapResOffButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
setSubmitCycle(true);
CCActionTable table = (CCActionTable) getChild(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
table.restoreStateData();
CCActionTableModel tblModel = (CCActionTableModel) propertySheetModel.getModel(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
Integer[] selected = tblModel.getSelectedRows();
if ((selected != null) && (selected.length > 0)) {
try {
OrderedSet tblValues = (OrderedSet) getPageSessionAttribute(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF);
SMDiscoveryServiceData smEntry = SMDiscoveryServiceData.getEntries(tblValues);
smEntry.deleteDiscoEntries(selected);
tblValues = (OrderedSet) smEntry.getDiscoveryEntries();
setPageSessionAttribute(AMAdminConstants.DISCOVERY_SERVICE_NAME_BOOTSTRAP_RES_OFF, tblValues);
populateBootstrapResOffTable(tblValues);
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
forwardTo();
}
use of com.sun.web.ui.model.CCActionTableModel in project OpenAM by OpenRock.
the class AbstractAuditViewBean method handleTblSubConfigButtonDeleteRequest.
/**
* Called on request from the UI to delete an event handler.
*
* @param event Request Invocation Event.
*/
@SuppressWarnings("unused")
public void handleTblSubConfigButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
submitCycle = true;
CCActionTable tbl = (CCActionTable) getChild(TBL_SUB_CONFIG);
tbl.restoreStateData();
CCActionTableModel tblModel = (CCActionTableModel) tbl.getModel();
Integer[] selected = tblModel.getSelectedRows();
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
List list = szCache.getSerializedObj();
Set<String> names = new HashSet<>(selected.length * 2);
for (Integer index : selected) {
SMSubConfig sc = (SMSubConfig) list.get(index);
names.add(sc.getName());
}
try {
AbstractAuditModel model = (AbstractAuditModel) getModel();
model.deleteEventHandles(names);
if (selected.length == 1) {
setInlineAlertMessage(TYPE_INFO, INFORMATION_MESSAGE, "event.handler.message.deleted");
} else {
setInlineAlertMessage(TYPE_INFO, INFORMATION_MESSAGE, "event.handler.message.deleted.plural");
}
} catch (AMConsoleException e) {
setInlineAlertMessage(TYPE_ERROR, ERROR_MESSAGE, e.getMessage());
}
submitCycle = false;
forwardTo();
}
use of com.sun.web.ui.model.CCActionTableModel in project OpenAM by OpenRock.
the class FederationViewBean method handleDeleteCOTButtonRequest.
public void handleDeleteCOTButtonRequest(RequestInvocationEvent event) throws ModelControlException {
CCActionTable tbl = (CCActionTable) getChild(COT_TABLE);
tbl.restoreStateData();
CCActionTableModel tableModel = (CCActionTableModel) propertySheetModel.getModel(COT_TABLE);
// get selected rows
Integer[] selected = tableModel.getSelectedRows();
SerializedField szCache = (SerializedField) getChild(SZ_CACHE);
List list = (List) szCache.getSerializedObj();
FSAuthDomainsModel model = (FSAuthDomainsModel) getModel();
StringBuilder deletedNames = new StringBuilder();
StringBuilder cannotDeleteds = new StringBuilder();
// each COT is deleted separately as they can be in separate realms
for (int i = 0; i < selected.length; i++) {
String str = (String) list.get(selected[i].intValue());
int pipeIndex = str.indexOf(",");
String name = str.substring(0, pipeIndex);
String realm = str.substring(pipeIndex + 1);
try {
model.deleteAuthenticationDomain(realm, name);
if (deletedNames.length() > 0) {
deletedNames.append(", ");
}
deletedNames.append(name);
} catch (AMConsoleException e) {
if (cannotDeleteds.length() > 0) {
cannotDeleteds.append(", ");
}
cannotDeleteds.append(e.getMessage());
}
}
StringBuilder message = new StringBuilder();
if (deletedNames.length() > 0) {
Object[] params = { deletedNames };
message.append(MessageFormat.format(model.getLocalizedString("authDomain.message.deleted"), params));
}
if (cannotDeleteds.length() > 0) {
Object[] params = { cannotDeleteds };
message.append(MessageFormat.format(model.getLocalizedString("generic.error.message"), params));
}
if (message.length() > 0) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", message.toString());
}
forwardTo();
}
use of com.sun.web.ui.model.CCActionTableModel in project OpenAM by OpenRock.
the class FederationViewBean method populateSAMLTable.
private void populateSAMLTable() {
tablePopulated = true;
FSSAMLServiceModel model = (FSSAMLServiceModel) getSAMLModel();
Map attrValues = model.getAttributeValues();
CCActionTableModel tblModel = (CCActionTableModel) propertySheetModel.getModel(SAML_TABLE);
tblModel.clearAll();
removePageSessionAttribute(SAML_TABLE_ATTRIBUTE);
List cache = new ArrayList();
for (Iterator iter = attrValues.keySet().iterator(); iter.hasNext(); ) {
String name = (String) iter.next();
Set values = (Set) attrValues.get(name);
if (name.equals(TABLE_TRUSTED_PARTNERS)) {
AMPipeDelimitAttrTokenizer tokenizer = AMPipeDelimitAttrTokenizer.getInstance();
boolean firstEntry = true;
int counter = 0;
for (Iterator iter2 = values.iterator(); iter2.hasNext(); ) {
if (!firstEntry) {
tblModel.appendRow();
} else {
firstEntry = false;
}
String tokenizedValue = (String) iter2.next();
Map map = AMAdminUtils.upCaseKeys(tokenizer.tokenizes(tokenizedValue));
String partnerName = (String) map.get(SAMLConstants.PARTNERNAME);
if (partnerName == null) {
partnerName = (String) map.get(SAMLConstants.SOURCEID);
}
tblModel.setValue(SAML_TRUSTED_PARTNER_VALUE, partnerName);
tblModel.setValue(SAML_TRUSTED_PARTNER_HREF, Integer.toString(counter++));
cache.add(tokenizedValue);
// get trusted partner type
SAMLPropertyXMLBuilder builder = SAMLPropertyXMLBuilder.getInstance();
List profiles = (ArrayList) builder.getSAMLProperties(map);
StringBuffer trustedPartnerSourceType = new StringBuffer();
StringBuffer trustedPartnerDestinationType = new StringBuffer();
int size = profiles.size();
for (int i = 0; i < size; i++) {
if (((SAMLProperty) profiles.get(i)).getRole().equals("destination")) {
if (trustedPartnerDestinationType.length() != 0) {
trustedPartnerDestinationType.append(", ");
}
trustedPartnerDestinationType.append(getTrustedPartnersSelectType(((SAMLProperty) profiles.get(i)).getBindMethod()));
} else {
// source
if (trustedPartnerSourceType.length() != 0) {
trustedPartnerSourceType.append(", ");
}
trustedPartnerSourceType.append(getTrustedPartnersSelectType(((SAMLProperty) profiles.get(i)).getBindMethod()));
}
}
tblModel.setValue(SAML_TRUSTED_PARTNER_DESTINATION_TYPE, trustedPartnerDestinationType.toString());
tblModel.setValue(SAML_TRUSTED_PARTNER_SOURCE_TYPE, trustedPartnerSourceType.toString());
}
break;
}
}
setPageSessionAttribute(SAML_TABLE_ATTRIBUTE, (ArrayList) cache);
}
use of com.sun.web.ui.model.CCActionTableModel in project OpenAM by OpenRock.
the class FederationViewBean method populateEntityTable.
private void populateEntityTable() {
tablePopulated = true;
CCActionTableModel tableModel = (CCActionTableModel) propertySheetModel.getModel(ENTITY_TABLE);
tableModel.clearAll();
boolean firstRow = true;
EntityModel eModel = getEntityModel();
Map entities = Collections.EMPTY_MAP;
List entityList = new ArrayList();
try {
entities = eModel.getSAMLv2Entities();
if (!entities.isEmpty()) {
addRows(entities, eModel, tableModel, firstRow, entityList);
firstRow = false;
}
entities.clear();
entities = eModel.getIDFFEntities();
if (!entities.isEmpty()) {
addRows(entities, eModel, tableModel, firstRow, entityList);
firstRow = false;
}
entities.clear();
entities = eModel.getWSFedEntities();
if (!entities.isEmpty()) {
addRows(entities, eModel, tableModel, firstRow, entityList);
firstRow = false;
}
// set the instances in the page session so when a request comes
// in we can prepopulate the table model.
setPageSessionAttribute(ENTITY_TABLE, (Serializable) entityList);
} catch (AMConsoleException e) {
debug.error("FederationViewBean.populateEntityTable", e);
return;
}
}
Aggregations