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