use of com.sun.web.ui.view.addremove.CCAddRemove in project OpenAM by OpenRock.
the class SMDiscoveryDescriptionViewBeanBase method getValues.
private SMDescriptionData getValues() throws AMConsoleException {
SMDescriptionData smData = new SMDescriptionData();
smData.descriptionID = (String) getDisplayFieldValue(TF_DESCRIPTION_ID);
if (smData.descriptionID.length() == 0) {
smData.descriptionID = SAMLUtils.generateID();
}
CCAddRemove mechIdChild = (CCAddRemove) getChild(ATTR_NAME_SECURITY_MECH_ID);
mechIdChild.restoreStateData();
CCAddRemoveModel mechIdModel = (CCAddRemoveModel) propertySheetModel.getModel(ATTR_NAME_SECURITY_MECH_ID);
smData.securityMechId = getList(mechIdModel.getSelectedOptionList());
smData.endPointUrl = ((String) propertySheetModel.getValue(ATTR_NAME_SOAP_HTTP_END_POINT)).trim();
smData.soapAction = ((String) propertySheetModel.getValue(ATTR_NAME_SOAP_HTTP_ACTION)).trim();
if (smData.securityMechId.isEmpty()) {
throw new AMConsoleException("discovery.service.description.missing.securityMechId.message");
}
if (smData.endPointUrl.length() == 0) {
throw new AMConsoleException("discovery.service.description.missing.endPointUrl.message");
}
return smData;
}
use of com.sun.web.ui.view.addremove.CCAddRemove in project OpenAM by OpenRock.
the class IdentityMembershipConditionAddViewBean method beginDisplay.
/**
* Sets the values to UI model.
*
* @param event Display Event.
* @throws ModelControlException if the default UI model is not accessible.
*/
public void beginDisplay(DisplayEvent event) throws ModelControlException {
IdentitySubjectModel subjectModel = getSubjectModel();
PolicyModel model = (PolicyModel) getModel();
super.beginDisplay(event);
CCDropDownMenu menu = (CCDropDownMenu) getChild(FILTER_TYPE);
Map supportedEntityTypes = model.getSupportedEntityTypes(realmName);
OptionList entityTypes = createOptionList(supportedEntityTypes);
entityTypes.add(0, "policy.subject.select.identity.type", "");
menu.setOptions(entityTypes);
menu.setValue("");
// initialize the available/selected component
CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
child.restoreStateData();
OptionList selected = addRemoveModel.getSelectedOptionList();
OptionList possible = helper.createOptionList(model.getUserSSOToken(), model.getUserLocale(), this, getPossibleValues(subjectModel, realmName));
child.resetStateData();
addRemoveModel.setAvailableOptionList(possible);
}
use of com.sun.web.ui.view.addremove.CCAddRemove in project OpenAM by OpenRock.
the class IdentityMembershipConditionEditViewBean method beginDisplay.
/**
* Sets the values to UI model.
*
* @param event Display Event.
*/
public void beginDisplay(DisplayEvent event) throws ModelControlException {
IdentitySubjectModel subjectModel = getSubjectModel();
PolicyModel model = (PolicyModel) getModel();
super.beginDisplay(event);
if (!canModify) {
Map mapValues = getDefaultValues();
if ((mapValues != null) && !mapValues.isEmpty()) {
Set values = (Set) mapValues.get(AMIdentityMembershipCondition.AM_IDENTITY_NAME);
Set identityNames = helper.getAMIdentityNames(model.getUserSSOToken(), values);
propertySheetModel.setValue(VALUES_MULTIPLE_CHOICE_VALUE, AMAdminUtils.getString(identityNames, ",", false));
}
} else {
CCDropDownMenu menu = (CCDropDownMenu) getChild(FILTER_TYPE);
Map supportedEntityTypes = model.getSupportedEntityTypes(realmName);
OptionList entityTypes = createOptionList(supportedEntityTypes);
entityTypes.add(0, "policy.subject.select.identity.type", "");
menu.setOptions(entityTypes);
menu.setValue("");
CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
child.restoreStateData();
if (!submitCycle) {
helper.setSelectedIdentities(child, model.getUserSSOToken(), model.getUserLocale(), this, getDefaultValues());
} else {
// initialize the available/selected component
OptionList possible = helper.createOptionList(model.getUserSSOToken(), model.getUserLocale(), this, getPossibleValues(subjectModel, realmName));
OptionList selected = addRemoveModel.getSelectedOptionList();
List selectedIds = AMAdminUtils.toList(selected);
child.resetStateData();
addRemoveModel.setAvailableOptionList(possible);
addRemoveModel.setSelectedOptionList(helper.createOptionList(model.getUserSSOToken(), model.getUserLocale(), this, selectedIds));
}
}
}
use of com.sun.web.ui.view.addremove.CCAddRemove in project OpenAM by OpenRock.
the class IdentitySubjectEditViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
IdentitySubjectModel model = (IdentitySubjectModel) getModel();
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
Set values = null;
if (bFilter) {
Set defaultValue = getValues();
if (defaultValue != null) {
values = getAMIdentity(model, defaultValue);
}
} else {
values = getAMIdentity(model, getDefaultValues(model));
}
super.beginDisplay(event);
if (canModify) {
Map supportedEntityTypes = model.getSupportedEntityTypes(realmName);
CCDropDownMenu menu = (CCDropDownMenu) getChild(FILTER_TYPE);
OptionList entityTypes = createOptionList(supportedEntityTypes);
entityTypes.add(0, "policy.subject.select.identity.type", "");
menu.setOptions(entityTypes);
menu.setValue("");
CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
child.restoreStateData();
OptionList selected = addRemoveModel.getSelectedOptionList();
child.resetStateData();
addRemoveModel.setAvailableOptionList(createOptionList(getPossibleValues(model, realmName, values)));
if (submitCycle) {
addRemoveModel.setSelectedOptionList(selected);
} else {
addRemoveModel.setSelectedOptionList(createOptionList(values));
}
} else {
propertySheetModel.setValue(VALUES_MULTIPLE_CHOICE_VALUE, AMAdminUtils.getString(getDefaultValues(), ",", false));
}
}
use of com.sun.web.ui.view.addremove.CCAddRemove in project OpenAM by OpenRock.
the class IdentitySubjectEditViewBean method getPossibleValues.
private Set getPossibleValues(IdentitySubjectModel model, String realmName, Set values) {
Set possibleValues = null;
String searchEntityType = (String) getPageSessionAttribute(ENTITY_TYPE);
if ((searchEntityType != null) && (searchEntityType.length() > 0)) {
String pattern = (String) propertySheetModel.getValue(FILTER);
try {
IdSearchResults results = model.getEntityNames(realmName, searchEntityType, pattern);
int errorCode = results.getErrorCode();
switch(errorCode) {
case IdSearchResults.SIZE_LIMIT_EXCEEDED:
setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "message.sizelimit.exceeded");
break;
case IdSearchResults.TIME_LIMIT_EXCEEDED:
setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "message.timelimit.exceeded");
break;
}
possibleValues = results.getSearchResults();
// remove the system users which should not be displayed.
Set hiddenUsers = model.getSpecialUsers(realmName);
possibleValues.removeAll(hiddenUsers);
if ((possibleValues != null) && !possibleValues.isEmpty()) {
if (submitCycle) {
CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
Set selected = getValues(addRemoveModel.getSelectedOptionList());
if ((selected != null) && !selected.isEmpty()) {
Set amids = getAMIdentity(model, selected);
possibleValues.removeAll(amids);
}
} else if (values != null) {
possibleValues.removeAll(values);
}
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
}
return (possibleValues != null) ? possibleValues : Collections.EMPTY_SET;
}
Aggregations