001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Julien Anguenot
011 *     Thierry Delprat
012 *     Florent Guillaume
013 */
014
015package org.nuxeo.ecm.platform.audit.api;
016
017import java.io.Serializable;
018import java.util.Date;
019import java.util.Map;
020
021import org.nuxeo.ecm.core.api.DocumentRef;
022import org.nuxeo.ecm.platform.audit.api.comment.UIAuditComment;
023
024/**
025 * Log entry.
026 */
027public interface LogEntry extends Serializable {
028
029    /**
030     * @return the log identifier
031     */
032    long getId();
033
034    void setId(long id);
035
036    /**
037     * Returns the name of the principal who originated the log entry.
038     *
039     * @return the name of the principal who originated the log entry
040     */
041    String getPrincipalName();
042
043    void setPrincipalName(String principalName);
044
045    /**
046     * Returns the identifier of the event that originated the log entry.
047     *
048     * @return the identifier of the event that originated the log entry
049     */
050    String getEventId();
051
052    void setEventId(String eventId);
053
054    /**
055     * @return the date of the log insertion: this up to max transaction timeout later than eventDate. This date is
056     *         useful for services such as Nuxeo Drive that need fine grained incremental near-monotonic access to the
057     *         audit log.
058     * @since 5.7
059     * @since 5.6-HF16
060     */
061    Date getLogDate();
062
063    void setLogDate(Date logDate);
064
065    /**
066     * Returns the date of the event that originated the log entry.
067     *
068     * @return the date of the event that originated the log entry
069     */
070    Date getEventDate();
071
072    void setEventDate(Date eventDate);
073
074    /**
075     * Returns the doc UUID related to the log entry.
076     * <p>
077     * It might be null if the event that originated the event is noe bound to any document.
078     *
079     * @return the doc UUID related to the log entry.
080     */
081    String getDocUUID();
082
083    void setDocUUID(String docUUID);
084
085    void setDocUUID(DocumentRef docRef);
086
087    /**
088     * Returns the doc path related to the log entry.
089     * <p>
090     * It might be null if the event that originated the event is noe bound to any document.
091     *
092     * @return the doc path related to the log entry.
093     */
094    String getDocPath();
095
096    void setDocPath(String docPath);
097
098    /**
099     * Returns the doc type related to the log entry.
100     * <p>
101     * It might be null if the event that originated the event is not bound to any document.
102     *
103     * @return the doc type related to the log entry.
104     */
105    String getDocType();
106
107    void setDocType(String docType);
108
109    /**
110     * Returns the category for this log entry.
111     * <p>
112     * This is defined at client level. Categories are not restricted in any ways.
113     *
114     * @return the category for this log entry.
115     */
116    String getCategory();
117
118    void setCategory(String category);
119
120    /**
121     * Returns the associated comment for this log entry.
122     *
123     * @return the associated comment for this log entry
124     */
125    String getComment();
126
127    void setComment(String comment);
128
129    /**
130     * Return the life cycle if the document related to the log entry.
131     * <p>
132     * It might be null if the event that originated the event is noe bound to any document.
133     *
134     * @return the life cycle if the document related to the log entry.
135     */
136    String getDocLifeCycle();
137
138    void setDocLifeCycle(String docLifeCycle);
139
140    /**
141     * Returns the repository id related to the log entry.
142     *
143     * @return the repository id
144     */
145    String getRepositoryId();
146
147    void setRepositoryId(String repositoryId);
148
149    Map<String, ExtendedInfo> getExtendedInfos();
150
151    void setExtendedInfos(Map<String, ExtendedInfo> infos);
152
153    /**
154     * Return the comment preprocessed to be ready for display. (extract info about linked documents) Only available
155     * when accessed via the entry is fetched via the {@link AuditPageProvider}
156     *
157     * @return
158     */
159    UIAuditComment getPreprocessedComment();
160
161    void setPreprocessedComment(UIAuditComment uiComment);
162}