001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/content/tags/sakai_2-4-1/content-util/util/src/java/org/sakaiproject/content/util/BaseInteractionAction.java $
003: * $Id: BaseInteractionAction.java 20976 2007-02-03 13:21:51Z jimeng@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2006, 2007 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.content.util;
021:
022: import org.sakaiproject.content.api.InteractionAction;
023: import org.sakaiproject.entity.api.Reference;
024:
025: import java.util.List;
026:
027: /**
028: * Created by IntelliJ IDEA.
029: * User: johnellis
030: * Date: Jan 26, 2007
031: * Time: 10:33:57 AM
032: * To change this template use File | Settings | File Templates.
033: */
034: public class BaseInteractionAction extends BaseResourceAction implements
035: InteractionAction {
036:
037: private String helperId;
038: private List requiredPropertyKeys;
039:
040: public BaseInteractionAction(String id, ActionType actionType,
041: String typeId, String helperId, List requiredPropertyKeys) {
042: super (id, actionType, typeId);
043: this .helperId = helperId;
044: this .requiredPropertyKeys = requiredPropertyKeys;
045: }
046:
047: /**
048: * Access the unique identifier for the tool that will handle this action.
049: * This is the identifier by which the helper is registered with the
050: * ToolManager.
051: *
052: * @return
053: */
054: public String getHelperId() {
055: return helperId;
056: }
057:
058: /**
059: * Access a list of properties that should be provided to the helper if they are defined.
060: * Returning null or empty list indicates no properties are needed by the helper.
061: *
062: * @return a List of Strings if property values are required.
063: */
064: public List getRequiredPropertyKeys() {
065: return requiredPropertyKeys;
066: }
067:
068: /**
069: * ResourcesAction calls this method before starting the helper. This is intended to give
070: * the registrant a chance to do any preparation needed before the helper starts with respect
071: * to this action and the reference specified in the parameter. The method returns a String
072: * (possibly null) which will be provided as the "initializationId" parameter to other
073: * methods and in
074: *
075: * @param reference
076: * @return
077: */
078: public String initializeAction(Reference reference) {
079: return null;
080: }
081:
082: /**
083: * ResourcesAction calls this method after completion of its portion of the action.
084: *
085: * @param reference The
086: * @param initializationId
087: */
088: public void finalizeAction(Reference reference,
089: String initializationId) {
090: }
091:
092: /**
093: * ResourcesAction calls this method if the user cancels out of the action or some error
094: * occurs preventing completion of the action after the helper completes its part of the
095: * action.
096: *
097: * @param reference
098: * @param initializationId
099: */
100: public void cancelAction(Reference reference,
101: String initializationId) {
102: }
103:
104: }
|