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.audit;
016    
017    import com.liferay.portal.kernel.audit.AuditMessage;
018    import com.liferay.portal.kernel.audit.AuditMessageFactory;
019    import com.liferay.portal.kernel.json.JSONException;
020    import com.liferay.portal.kernel.json.JSONObject;
021    
022    import java.util.Date;
023    
024    /**
025     * @author Amos Fong
026     */
027    public class AuditMessageFactoryImpl implements AuditMessageFactory {
028    
029            public AuditMessage getAuditMessage(String message) throws JSONException {
030                    return new AuditMessage(message);
031            }
032    
033            public AuditMessage getAuditMessage(
034                    String eventType, long companyId, long userId, String userName) {
035    
036                    return new AuditMessage(eventType, companyId, userId, userName);
037            }
038    
039            public AuditMessage getAuditMessage(
040                    String eventType, long companyId, long userId, String userName,
041                    String className, String classPK) {
042    
043                    return new AuditMessage(
044                            eventType, companyId, userId, userName, className, classPK);
045            }
046    
047            public AuditMessage getAuditMessage(
048                    String eventType, long companyId, long userId, String userName,
049                    String className, String classPK, String message) {
050    
051                    return new AuditMessage(
052                            eventType, companyId, userId, userName, className, classPK,
053                            message);
054            }
055    
056            public AuditMessage getAuditMessage(
057                    String eventType, long companyId, long userId, String userName,
058                    String className, String classPK, String message, Date timestamp,
059                    JSONObject additionalInfo) {
060    
061                    return new AuditMessage(
062                            eventType, companyId, userId, userName, className, classPK, message,
063                            timestamp, additionalInfo);
064            }
065    
066            public AuditMessage getAuditMessage(
067                    String eventType, long companyId, long userId, String userName,
068                    String className, String classPK, String message,
069                    JSONObject additionalInfo) {
070    
071                    return new AuditMessage(
072                            eventType, companyId, userId, userName, className, classPK, message,
073                            additionalInfo);
074            }
075    
076    }