001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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    }