001/*
002 * (C) Copyright 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 GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl-2.1.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Thomas Roger <troger@nuxeo.com>
016 */
017
018package org.nuxeo.ecm.activity;
019
020import java.io.Serializable;
021import java.util.List;
022import java.util.Locale;
023
024import org.nuxeo.ecm.core.api.CoreSession;
025
026/**
027 * A list of Activities with useful methods to filter it or transform it.
028 *
029 * @author <a href="mailto:troger@nuxeo.com">Thomas Roger</a>
030 * @since 5.5
031 */
032public interface ActivitiesList extends List<Activity> {
033
034    /**
035     * Returns a filtered {@code ActivitiesList} based on the given {@code session}.
036     * <p>
037     * All the activities related to documents the user has no read access will be filter out.
038     */
039    ActivitiesList filterActivities(CoreSession session);
040
041    /**
042     * Transforms this {@code ActivitiesList} into a list of {@code ActivityMessage}, internationalized with the given
043     * {@code locale}.
044     */
045    List<ActivityMessage> toActivityMessages(Locale locale);
046
047    /**
048     * Transforms this {@code ActivitiesList} into a list of {@code ActivityMessage}, internationalized with the given
049     * {@code locale}.
050     * <p>
051     * Use the {@link ActivityLinkBuilder} of name {@code activityLinkBuilderName} to generate the links.
052     *
053     * @since 5.6
054     */
055    List<ActivityMessage> toActivityMessages(Locale locale, String activityLinkBuilderName);
056
057    /**
058     * Transforms this {@code ActivitiesList} into a list of Activity ids.
059     *
060     * @since 5.6
061     */
062    List<Serializable> toActivityIds();
063
064}