SCServiceProfileViewBean.java revision 28de0461d82a4e6471c71d793af7a9492ca98dd3
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/**
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Copyright (c) 2007 Sun Microsystems Inc. All Rights Reserved
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * The contents of this file are subject to the terms
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * of the Common Development and Distribution License
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * (the License). You may not use this file except in
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * compliance with the License.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * You can obtain a copy of the License at
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * https://opensso.dev.java.net/public/CDDLv1.0.html or
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * opensso/legal/CDDLv1.0.txt
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * See the License for the specific language governing
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * permission and limitations under the License.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * When distributing Covered Code, include this CDDL
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Header Notice in each file and include the License file
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * at opensso/legal/CDDLv1.0.txt.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * If applicable, add the following below the CDDL Header,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * with the fields enclosed by brackets [] replaced by
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * your own identifying information:
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * "Portions Copyrighted [year] [name of copyright owner]"
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * $Id: SCServiceProfileViewBean.java,v 1.7 2009/01/09 22:35:19 asyhuang Exp $
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync *
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync/*
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Portions Copyrighted 2011-2015 ForgeRock AS.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Portions Copyrighted 2015 Nomura Research Institute, Ltd.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncpackage com.sun.identity.console.service;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.iplanet.jato.NavigationException;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.iplanet.jato.RequestContext;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.iplanet.jato.RequestManager;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.iplanet.jato.model.ModelControlException;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.iplanet.jato.view.View;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.iplanet.jato.view.event.DisplayEvent;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.iplanet.jato.view.event.RequestInvocationEvent;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.authentication.util.AMAuthUtils;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.console.base.AMPropertySheet;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.console.base.AMServiceProfile;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.console.base.ScriptValidatorViewBean;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.console.base.model.AMAdminConstants;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.console.base.model.AMAdminUtils;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.console.base.model.AMConsoleException;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.console.base.model.AMModel;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.console.base.model.AMPropertySheetModel;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.console.base.model.AMServiceProfileModel;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.console.base.model.SMSubConfig;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.console.components.view.html.SerializedField;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.console.service.model.SubConfigModel;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.console.service.model.SubConfigModelImpl;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.console.service.model.SubSchemaModel;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.console.service.model.SubSchemaModelImpl;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.sm.AttributeSchema;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.sm.DynamicAttributeValidator;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.sm.SMSEntry;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.sm.ServiceSchema;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.identity.sm.ServiceSchemaManager;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.web.ui.model.CCActionTableModel;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.web.ui.view.alert.CCAlert;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.web.ui.view.html.CCRadioButton;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport com.sun.web.ui.view.table.CCActionTable;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport java.text.MessageFormat;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport java.util.ArrayList;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport java.util.HashSet;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport java.util.Iterator;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport java.util.List;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport java.util.Map;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport java.util.Set;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncimport javax.servlet.http.HttpServletRequest;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsyncpublic class SCServiceProfileViewBean extends ScriptValidatorViewBean {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync public static final String DEFAULT_DISPLAY_URL =
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync "/console/service/SCServiceProfile.jsp";
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync public static final String PAGE_NAME = "SCServiceProfile";
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync private static final String validatorAttributeName = "ScriptValidator";
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync private boolean populatedSubConfigTable;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync /**
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync * Creates a service profile view bean.
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync */
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync public SCServiceProfileViewBean() {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync super(PAGE_NAME, DEFAULT_DISPLAY_URL, null);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync initService();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync }
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync SCServiceProfileViewBean(String name, String defaultURL) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync super(name, defaultURL, null);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync initService();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync }
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync private void initService() {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync String serviceName = (String)getPageSessionAttribute(
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync AMServiceProfile.SERVICE_NAME);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (serviceName != null) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync initialize(serviceName);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync }
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync }
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync protected View createChild(String name) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (!populatedSubConfigTable &&
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync name.equals(AMPropertySheetModel.TBL_SUB_CONFIG)
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync ) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync populatedSubConfigTable = true;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync SubSchemaModel model = (SubSchemaModel)getModel();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (model.hasGlobalSubSchema()) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync SerializedField szCache = (SerializedField)getChild(SZ_CACHE);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync populateTableModel((List)szCache.getSerializedObj());
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync }
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync }
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync return super.createChild(name);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync }
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync private void populateTableModel(List subconfig) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync CCActionTable tbl = (CCActionTable)getChild(
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync AMPropertySheetModel.TBL_SUB_CONFIG);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync CCActionTableModel tblModel =(CCActionTableModel)tbl.getModel();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync tblModel.clearAll();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (subconfig != null) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync SerializedField szCache = (SerializedField)getChild(SZ_CACHE);
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync List cache = new ArrayList(subconfig.size());
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (!subconfig.isEmpty()) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync tblModel.clearAll();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync boolean firstEntry = true;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync for (Iterator iter = subconfig.iterator(); iter.hasNext(); ) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync if (firstEntry) {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync firstEntry = false;
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync } else {
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync tblModel.appendRow();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync }
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync SMSubConfig conf = (SMSubConfig)iter.next();
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync tblModel.setValue(
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync AMPropertySheetModel.TBL_SUB_CONFIG_DATA_NAME,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync conf.getLocalizedName() == null ? conf.getName() : conf.getLocalizedName());
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync tblModel.setValue(
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync AMPropertySheetModel.TBL_SUB_CONFIG_HREF_NAME,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync conf.getName());
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync tblModel.setValue(
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync AMPropertySheetModel.TBL_SUB_CONFIG_DATA_TYPE,
cf22150eaeeb72431bf1cf65c309a431454fb22bvboxsync conf.getType());
cache.add(conf);
}
}
szCache.setValue((ArrayList)cache);
}
}
public void forwardTo(RequestContext reqContext)
throws NavigationException {
initialize((String)getPageSessionAttribute(
AMServiceProfile.SERVICE_NAME));
super.forwardTo(reqContext);
}
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
SubSchemaModel model = (SubSchemaModel) getModel();
if (model.hasGlobalSubSchema()) {
if (!submitCycle) {
populateTableModel(model.getSubConfigurations());
}
resetButtonState(AMPropertySheetModel.TBL_SUB_CONFIG_BUTTON_DELETE);
Map createable = model.getCreateableSubSchemaNames();
if (createable.isEmpty()) {
resetButtonState(AMPropertySheetModel.TBL_SUB_CONFIG_BUTTON_ADD);
} else {
SubConfigModel scModel = getSubConfigModel();
boolean canCreate = false;
for (Iterator i = createable.keySet().iterator(); i.hasNext() && !canCreate;) {
String name = (String) i.next();
String plugin = scModel.getSelectableSubConfigNamesPlugin(name);
if (plugin == null) {
canCreate = true;
} else {
Set subconfigNames = scModel.getSelectableConfigNames(name);
canCreate = (subconfigNames != null) && !subconfigNames.isEmpty();
}
}
disableButton(AMPropertySheetModel.TBL_SUB_CONFIG_BUTTON_ADD, !canCreate);
}
}
final AMPropertySheet propertySheet = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
Map<String, Set<String>> valueMap = unpersistedValueMap;
if (serviceName.equals("iPlanetAMAuthHTTPBasicService")) {
CCRadioButton radio = (CCRadioButton) getChild("iplanet-am-auth-http-basic-module-configured");
if ((radio.getValue() == null) || (radio.getValue().equals(""))) {
String defaultModule = new String();
String realmName = SMSEntry.getRootSuffix();
if (realmName != null) {
List moduleList = AMAuthUtils.getModuleInstancesForHttpBasic(realmName);
if (!moduleList.isEmpty()) {
defaultModule = (String) moduleList.get(0);
radio.setValue(defaultModule);
}
}
}
} else if (serviceName.equals("iPlanetAMAuthDeviceIdMatchService")
|| serviceName.equals("iPlanetAMAuthScriptedService")) {
// If this is not a dynamic request the UI is set with persisted values
if (!dynamicRequest) {
valueMap = model.getAttributeValues();
}
if (valueMap != null) {
propertySheet.setAttributeValues(valueMap, model);
}
}
}
protected String getPropertySheetXML(AMServiceProfileModel model)
throws AMConsoleException {
return ((SubSchemaModel)model).getPropertySheetXML(
"/", PAGE_NAME, getClass().getName());
}
protected AMModel getModelInternal() {
HttpServletRequest req =
RequestManager.getRequestContext().getRequest();
try {
return new SubSchemaModelImpl(
req, serviceName, getPageSessionAttributes());
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error",
e.getMessage());
}
return null;
}
private SubConfigModel getSubConfigModel() {
HttpServletRequest req =
RequestManager.getRequestContext().getRequest();
try {
return new SubConfigModelImpl(
req, serviceName, "/", getPageSessionAttributes());
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error",
e.getMessage());
}
return null;
}
/**
* Adds sub configuration.
*
* @param event Request Invocation Event.
*/
public void handleTblSubConfigButtonAddRequest(
RequestInvocationEvent event
) {
SubSchemaModel model = (SubSchemaModel)getModel();
Map createable = model.getCreateableSubSchemaNames();
if (!createable.isEmpty()) {
if (createable.size() > 1) {
SubSchemaTypeSelectViewBean vb = (SubSchemaTypeSelectViewBean)
getViewBean(SubSchemaTypeSelectViewBean.class);
addViewBeanClassToPageSession();
unlockPageTrail();
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
} else {
String subSchema =
(String)createable.keySet().iterator().next();
setPageSessionAttribute(
AMServiceProfile.PG_SESSION_SUB_SCHEMA_NAME,
subSchema);
SubConfigAddViewBean vb = (SubConfigAddViewBean)getViewBean(
SubConfigAddViewBean.class);
addViewBeanClassToPageSession();
unlockPageTrail();
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
}
} else {
forwardTo();
}
}
private void addViewBeanClassToPageSession() {
ArrayList viewBeanClasses = (ArrayList)getPageSessionAttribute(
AMServiceProfile.PG_SESSION_PROFILE_VIEWBEANS);
if (viewBeanClasses == null) {
viewBeanClasses = new ArrayList();
setPageSessionAttribute(
AMServiceProfile.PG_SESSION_PROFILE_VIEWBEANS, viewBeanClasses);
}
viewBeanClasses.add(0, "../service/SCServiceProfile");
}
/**
* Deletes sub configuration.
*
* @param event Request Invocation Event.
* @throws ModelControlException if table model cannot be restored.
*/
public void handleTblSubConfigButtonDeleteRequest(
RequestInvocationEvent event
) throws ModelControlException {
submitCycle = true;
CCActionTable tbl = (CCActionTable)getChild(
AMPropertySheetModel.TBL_SUB_CONFIG);
tbl.restoreStateData();
CCActionTableModel tblModel =(CCActionTableModel)tbl.getModel();
Integer[] selected = tblModel.getSelectedRows();
SerializedField szCache = (SerializedField)getChild(SZ_CACHE);
List list = (List)szCache.getSerializedObj();
Set names = new HashSet(selected.length *2);
for (int i = 0; i < selected.length; i++) {
SMSubConfig sc = (SMSubConfig)list.get(selected[i].intValue());
names.add(sc.getName());
}
try {
SubSchemaModel model = (SubSchemaModel)getModel();
model.deleteSubConfigurations(names);
if (selected.length == 1) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information",
"subconfig.message.deleted");
} else {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information",
"subconfig.message.deleted.pural");
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error",
e.getMessage());
}
submitCycle = false;
forwardTo();
}
/**
* Handles edit sub configuration request.
*
* @param event Request Invocation Event.
*/
public void handleTblSubConfigHrefNameRequest(RequestInvocationEvent event){
String configName = (String)getDisplayFieldValue(
AMPropertySheetModel.TBL_SUB_CONFIG_HREF_NAME);
SubConfigEditViewBean vb = (SubConfigEditViewBean)getViewBean(
SubConfigEditViewBean.class);
ArrayList subConfigNames = (ArrayList)getPageSessionAttribute(
AMServiceProfile.PG_SESSION_SUB_CONFIG_IDS);
if (subConfigNames == null) {
subConfigNames = new ArrayList();
subConfigNames.add("/");
setPageSessionAttribute(AMServiceProfile.PG_SESSION_SUB_CONFIG_IDS,
subConfigNames);
}
subConfigNames.add(0, configName);
addViewBeanClassToPageSession();
unlockPageTrail();
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
}
// button1 (Save) request done in AMServiceProfileViewBean
// button2 (Reset) request done in AMServiceProfileViewBean
/**
* Handles reset request.
*
* @param event Request invocation event
*/
public void handleButton3Request(RequestInvocationEvent event) {
backTrail();
try {
String name = (String) getPageSessionAttribute(
AMAdminConstants.SAVE_VB_NAME);
SCConfigViewBean vb = (SCConfigViewBean) getViewBean(
Class.forName(name));
passPgSessionMap(vb);
vb.forwardTo(getRequestContext());
} catch (ClassNotFoundException e) {
debug.warning("SCServiceProfileViewBean.handleButton3Request:", e);
}
}
protected String getBreadCrumbDisplayName() {
AMModel model = (AMModel) getModel();
String serviceName = (String) getPageSessionAttribute(AMServiceProfile.SERVICE_NAME);
Object[] arg = { model.getLocalizedServiceName(serviceName) };
return MessageFormat.format(model.getLocalizedString("breadcrumbs.services.edit"), arg);
}
protected boolean startPageTrail() {
return false;
}
/**
* Retrieve the validators specified for the attribute, invoke their
* validate methods and display the validation messages if any are present.
*
* @param attributeName The name of the attribute for which the validation should be done.
*/
protected void handleDynamicValidationRequest(String attributeName) {
try {
ServiceSchemaManager serviceSchemaManager = new ServiceSchemaManager(serviceName,
AMAdminUtils.getSuperAdminSSOToken());
ServiceSchema organizationSchema = serviceSchemaManager.getOrganizationSchema();
AttributeSchema attributeSchema = organizationSchema.getAttributeSchema(validatorAttributeName);
Set<?> defaultValues = attributeSchema.getDefaultValues();
final Iterator<?> javaClasses = defaultValues.iterator();
final List<DynamicAttributeValidator> validatorList = new ArrayList<DynamicAttributeValidator>();
while (javaClasses.hasNext()) {
final String javaClass = (String) javaClasses.next();
final Class<?> clazz = Class.forName(javaClass);
if (DynamicAttributeValidator.class.isAssignableFrom(clazz)) {
validatorList.add((DynamicAttributeValidator) clazz.newInstance());
}
}
validateScript(attributeName, "", validatorList);
} catch (Exception e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
}