001/*
002 * (C) Copyright 2012 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 *     Arnaud Kervern
018 */
019package org.nuxeo.ecm.agenda;
020
021import java.io.Serializable;
022import java.util.Date;
023import java.util.Map;
024
025import org.nuxeo.ecm.core.api.CoreSession;
026import org.nuxeo.ecm.core.api.DocumentModel;
027import org.nuxeo.ecm.core.api.DocumentModelList;
028
029/**
030 * @author <a href="mailto:akervern@nuxeo.com">Arnaud Kervern</a>
031 * @since 5.6
032 */
033public interface AgendaService {
034    /**
035     * List user readable agendum between both date
036     *
037     * @param path
038     * @param dtStart the start date
039     * @param dtEnd the end date (included)
040     * @return matching Event as a DocumentModelList object
041     */
042    DocumentModelList listEvents(CoreSession session, String path, Date dtStart, Date dtEnd);
043
044    /**
045     * List incoming user readable agendum with a limit
046     *
047     * @param path
048     * @param limit the number of events returned must be greater than 0 otherwise NuxeoException is thrown
049     * @return matching Event as a DocumentModelList object
050     */
051    DocumentModelList listEvents(CoreSession session, String path, int limit);
052
053    /**
054     * Create a new Event document to the specific path. If the path is blank or "/", the new event will be created into
055     * the UserWorkspace
056     *
057     * @param sesion CoreSession used to create the new doc
058     * @param path base path, if it is blank or "/"; the new event will be created into the UserWorkspace
059     * @param properties corresponding metadata
060     * @return a new Event created
061     */
062    DocumentModel createEvent(CoreSession session, String path, Map<String, Serializable> properties);
063
064}