AbstractAuditModel.java revision 11ddc496a78229c9c3e6f48a12f743e2d16d5180
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2015 ForgeRock AS.
*/
/**
* Abstract Audit configuration UI model.
*
* @since 13.0.0
*/
public abstract class AbstractAuditModel extends AMServiceProfileModelImpl {
protected ResourceBundle handlerResourceBundle;
/**
* Create a new {@code AbstractAuditModel}.
*
* @param request The {@code HttpServletRequest}
* @param sessionAttributes The session attributes.
* @throws AMConsoleException If construction fails.
*/
public AbstractAuditModel(HttpServletRequest request, Map sessionAttributes) throws AMConsoleException {
}
/**
* The service schema for the configuration represented by this model.
*
* @return The service schema.
* @throws SMSException If an SMS error occurred.
* @throws SSOException If an SSO error occurred.
*/
/**
* The service config for the configuration represented by this model.
*
* @return The service config.
* @throws SMSException If an SMS error occurred.
* @throws SSOException If an SSO error occurred.
*/
}
} else {
return super.getLocalizedString(key);
}
}
public String getPropertySheetXML(String realmName, String viewBeanName, String viewBeanClassName) throws
boolean readOnly = !dc.hasPermission(realmName, serviceName, PERMISSION_MODIFY, this, viewBeanClassName);
xmlBuilder.setSupportSubConfig(true);
try {
return xmlBuilder.getXML();
} catch (SSOException | SMSException e) {
throw new AMConsoleException(getErrorString(e));
}
}
/**
* Get the JATO XML configuration for generation the UI used to edit event handlers.
*
* @param realmName The current realm.
* @param handlerName The audit event handler name.
* @param viewBeanClassName The view bean class name.
* @return The JATO XML configuration for generation the UI.
* @throws AMConsoleException If an error occurs during the XML creation.
*/
public String getEditEventHandlerPropertyXML(String realmName, String handlerName, String viewBeanClassName)
throws AMConsoleException {
boolean readOnly = !dc.hasPermission(realmName, serviceName, PERMISSION_MODIFY, this, viewBeanClassName);
try {
xmlBuilder.setSupportSubConfig(false);
return xmlBuilder.getXML();
} catch (SMSException | SSOException e) {
throw new AMConsoleException(getErrorString(e));
}
}
/**
* Get the JATO XML configuration for generation the UI used to add event handlers.
*
* @param schemaId The event handler schema ID.
* @return The JATO XML configuration for generation the UI.
* @throws AMConsoleException If an error occurs during the XML creation.
*/
try {
xmlBuilder.setSupportSubConfig(false);
} catch (SMSException | SSOException e) {
throw new AMConsoleException(getErrorString(e));
}
}
/**
* Get the configuration properties of all the audit event handlers.
*
* @return A list of config objects.
*/
try {
if (serviceConfig == null) {
return subConfigModelList;
}
}
} catch (SMSException | SSOException e) {
throw new AMConsoleException(getErrorString(e));
}
return subConfigModelList;
}
/**
* Get the type names (schema ID) for all the event handlers.
*
* @return A set of event handler type names.
*/
@SuppressWarnings("unchecked")
try {
return getServiceSchema().getSubSchemaNames();
} catch (SMSException | SSOException e) {
throw new AMConsoleException(getErrorString(e));
}
}
/**
* Delete the event handlers specified.
*
* @param names Set of event handler names that are to be deleted.
* @throws AMConsoleException if sub configurations cannot be deleted.
*/
try {
if (serviceConfig != null) {
}
}
} catch (SSOException | SMSException e) {
throw new AMConsoleException(getErrorString(e));
}
}
try {
if (serviceConfig == null) {
return;
}
} catch (SSOException | SMSException e) {
throw new AMConsoleException(getErrorString(e));
}
}
public Map getAttributeValues() {
try {
if (serviceConfig == null) {
return emptyMap();
}
return serviceConfig.getAttributes();
} catch (SSOException | SMSException e) {
}
return emptyMap();
}
/**
* Get the attribute values for the specified event handler.
*
* @param eventHandlerName The name of the event handler.
* @return A map of event handler attribute values.
* @throws AMConsoleException If an error occurs whilst reading the attributes.
*/
public Map<?, ?> getEventHandlerAttributeValues(String eventHandlerName) throws AMConsoleException {
try {
if (serviceConfig == null) {
return emptyMap();
}
return emptyMap();
}
} catch (SSOException | SMSException e) {
throw new AMConsoleException(getErrorString(e));
}
}
/**
* Set the attribute values for the specified event handler.
*
* @param eventHandlerName The name of the event handler.
* @param values The attribute values.
* @throws AMConsoleException If an error occurs whilst writing the attributes.
*/
public void setEventHandlerAttributeValues(String eventHandlerName, Map<?, ?> values) throws AMConsoleException {
try {
if (serviceConfig == null) {
return;
}
return;
}
} catch (SSOException | SMSException e) {
throw new AMConsoleException(getErrorString(e));
}
}
/**
* Get the default attribute values for the specified event handler type (schema ID).
*
* @param eventHandlerType The name of the event handler type.
* @return A map of default event handler attribute values.
* @throws AMConsoleException If an error occurs whilst reading the attributes.
*/
public Map<String, Set<?>> getEventHandlerDefaultValues(String eventHandlerType) throws AMConsoleException {
try {
}
}
return defaultValues;
} catch (SSOException | SMSException e) {
throw new AMConsoleException(getErrorString(e));
}
}
/**
* Get the attribute names for the specified event handler type (schema ID).
*
* @param eventHandlerType The name of the event handler type.
* @return A set of attribute type names.
* @throws AMConsoleException If an error occurs whilst reading the attributes.
*/
public Set<String> getEventHandlerAttributeNames(String eventHandlerType) throws AMConsoleException {
try {
}
return attrNames;
} catch (SSOException | SMSException e) {
throw new AMConsoleException(getErrorString(e));
}
}
/**
* Create a new event handler with the given attributes.
*
* @param eventHandlerName The name of the new event handler.
* @param eventHandlerType The name of the event handler type.
* @param attributeValues The attribute values.
* @throws AMConsoleException If an error occurs whilst creating the event handler.
*/
try {
} catch (SSOException | SMSException e) {
throw new AMConsoleException(getErrorString(e));
}
}
}
}
if (isNotEmpty(sections)) {
}
return sectionMap;
}
private static final class MultiResourceBundle extends ResourceBundle {
}
}
}
}
}
return null;
}
}
}
}
}