001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2015 ForgeRock AS. 015 */ 016package org.forgerock.audit.events; 017 018/** 019 * Builder for audit config events. 020 * <p> 021 * This builder should not be used directly but be specialized for each product to allow to define 022 * new specific fields, e.g 023 * <pre> 024 * <code> 025 * class OpenProductConfigAuditEventBuilder{@code <T extends OpenProductConfigAuditEventBuilder<T>>} 026 * extends ConfigAuditEventBuilder{@code <T>} { 027 * 028 * public static {@code <T>} OpenProductConfigAuditEventBuilder{@code <?>} productConfigEvent() { 029 * return new OpenProductConfigAuditEventBuilder(); 030 * } 031 * 032 * public T someField(String v) { 033 * jsonValue.put("someField", v); 034 * return self(); 035 * } 036 * 037 * ... 038 * } 039 * </code> 040 * </pre> 041 * 042 * @param <T> the type of the builder 043 */ 044public class ConfigAuditEventBuilder<T extends ConfigAuditEventBuilder<T>> extends StateChangeAuditEventBuilder<T> { 045 046 /** 047 * Creates the builder. 048 */ 049 protected ConfigAuditEventBuilder() { 050 // Reduce visibility of the default constructor 051 } 052 053 /** 054 * Starts to build an audit config event. 055 * <p> 056 * Note: it is preferable to use a specialized builder that allow to add fields specific to a product. 057 * 058 * @return an audit config event builder 059 */ 060 @SuppressWarnings("rawtypes") 061 public static ConfigAuditEventBuilder<?> configEvent() { 062 return new ConfigAuditEventBuilder(); 063 } 064 065}