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 *     Thomas Roger <troger@nuxeo.com>
018 */
019
020package org.nuxeo.ecm.activity;
021
022import java.io.Serializable;
023import java.util.List;
024import java.util.Locale;
025
026import org.nuxeo.ecm.core.api.CoreSession;
027
028/**
029 * A list of Activities with useful methods to filter it or transform it.
030 *
031 * @author <a href="mailto:troger@nuxeo.com">Thomas Roger</a>
032 * @since 5.5
033 */
034public interface ActivitiesList extends List<Activity> {
035
036    /**
037     * Returns a filtered {@code ActivitiesList} based on the given {@code session}.
038     * <p>
039     * All the activities related to documents the user has no read access will be filter out.
040     */
041    ActivitiesList filterActivities(CoreSession session);
042
043    /**
044     * Transforms this {@code ActivitiesList} into a list of {@code ActivityMessage}, internationalized with the given
045     * {@code locale}.
046     */
047    List<ActivityMessage> toActivityMessages(Locale locale);
048
049    /**
050     * Transforms this {@code ActivitiesList} into a list of {@code ActivityMessage}, internationalized with the given
051     * {@code locale}.
052     * <p>
053     * Use the {@link ActivityLinkBuilder} of name {@code activityLinkBuilderName} to generate the links.
054     *
055     * @since 5.6
056     */
057    List<ActivityMessage> toActivityMessages(Locale locale, String activityLinkBuilderName);
058
059    /**
060     * Transforms this {@code ActivitiesList} into a list of Activity ids.
061     *
062     * @since 5.6
063     */
064    List<Serializable> toActivityIds();
065
066}