001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.audit;
016    
017    import com.liferay.portal.kernel.json.JSONException;
018    import com.liferay.portal.kernel.json.JSONObject;
019    
020    import java.util.Date;
021    
022    /**
023     * @author Amos Fong
024     */
025    public class AuditMessageFactoryUtil {
026    
027            public static AuditMessageFactory getAuditMessageFactory() {
028                    return _auditMessageFactory;
029            }
030    
031            public AuditMessage getAuditMessage(String message) throws JSONException {
032                    return getAuditMessageFactory().getAuditMessage(message);
033            }
034    
035            public AuditMessage getAuditMessage(
036                    String eventType, long companyId, long userId, String userName) {
037    
038                    return getAuditMessageFactory().getAuditMessage(
039                            eventType, companyId, userId, userName);
040            }
041    
042            public AuditMessage getAuditMessage(
043                    String eventType, long companyId, long userId, String userName,
044                    String className, String classPK) {
045    
046                    return getAuditMessageFactory().getAuditMessage(
047                            eventType, companyId, userId, userName, className, classPK);
048            }
049    
050            public AuditMessage getAuditMessage(
051                    String eventType, long companyId, long userId, String userName,
052                    String className, String classPK, String message) {
053    
054                    return getAuditMessageFactory().getAuditMessage(
055                            eventType, companyId, userId, userName, className, classPK,
056                            message);
057            }
058    
059            public AuditMessage getAuditMessage(
060                    String eventType, long companyId, long userId, String userName,
061                    String className, String classPK, String message, Date timestamp,
062                    JSONObject additionalInfo) {
063    
064                    return getAuditMessageFactory().getAuditMessage(
065                            eventType, companyId, userId, userName, className, classPK, message,
066                            timestamp, additionalInfo);
067            }
068    
069            public AuditMessage getAuditMessage(
070                    String eventType, long companyId, long userId, String userName,
071                    String className, String classPK, String message,
072                    JSONObject additionalInfo) {
073    
074                    return getAuditMessageFactory().getAuditMessage(
075                            eventType, companyId, userId, userName, className, classPK, message,
076                            additionalInfo);
077            }
078    
079            public void setAuditMessageFactory(
080                    AuditMessageFactory auditMessageFactory) {
081    
082                    _auditMessageFactory = auditMessageFactory;
083            }
084    
085            private static AuditMessageFactory _auditMessageFactory;
086    
087    }