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