001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
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 */
016package org.kuali.rice.krad.service;
017
018import java.sql.Timestamp;
019
020import org.kuali.rice.kew.api.WorkflowDocument;
021import org.kuali.rice.krad.UserSession;
022import org.kuali.rice.krad.web.form.DocumentFormBase;
023
024/**
025 * Service API for persisting <code>Document</code> form content and
026 * retrieving back
027 *
028 * <p>
029 * Used as an extension to session support. If a session times out, the doucment contents
030 * can be retrieved from the persistence storage and work resumed
031 * </p>
032 *
033 * @author Kuali Rice Team (rice.collab@kuali.org)
034 */
035public interface SessionDocumentService {
036
037    /**
038     * Retrieves a document from the user session for the given document id
039     */
040    public WorkflowDocument getDocumentFromSession(UserSession userSession, String docId);
041
042    /**
043     * This method places a document into the user session.
044     */
045    public void addDocumentToUserSession(UserSession userSession, WorkflowDocument document);
046        
047     /**
048     * Delete DocumentFormBase from session and database.
049     *
050     * @param documentNumber
051     * @param docFormKey
052     * @param userSession
053     * @throws
054     */
055    public void purgeDocumentForm(String documentNumber, String docFormKey, UserSession userSession, String ipAddress);
056    
057        /**
058     * Delete KualiDocumentFormBase from session and database.
059     *
060     * @param documentNumber
061     * @throws
062     */
063    public void purgeAllSessionDocuments(Timestamp expirationDate);
064
065    /**
066     * This method stores a UifFormBase into session and database
067     *
068     * @param form
069     * @param userSession
070     * @param ipAddress
071     */
072    public void setDocumentForm(DocumentFormBase form, UserSession userSession, String ipAddress);
073
074    /**
075     * Returns DocumentFormBase object from the db
076     *
077     * @param documentNumber
078     * @param docFormKey
079     * @param userSession
080     * @param ipAddress
081     * @return
082     */
083    public DocumentFormBase getDocumentForm(String documentNumber, String docFormKey, UserSession userSession,
084            String ipAddress);
085}