001: /*
002: * This file is part of PFIXCORE.
003: *
004: * PFIXCORE is free software; you can redistribute it and/or modify
005: * it under the terms of the GNU Lesser General Public License as published by
006: * the Free Software Foundation; either version 2 of the License, or
007: * (at your option) any later version.
008: *
009: * PFIXCORE 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
012: * GNU Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public License
015: * along with PFIXCORE; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: *
018: */
019:
020: package de.schlund.pfixcore.workflow;
021:
022: import org.apache.log4j.Logger;
023:
024: import de.schlund.pfixcore.util.StateUtil;
025: import de.schlund.pfixxml.PfixServletRequest;
026: import de.schlund.pfixxml.ResultDocument;
027:
028: /**
029: * @author jtl
030: */
031:
032: public abstract class StateImpl implements State {
033:
034: protected final Logger CAT = Logger.getLogger(this .getClass());
035:
036: public static final String PROP_INSERTCR = "insertcr";
037:
038: /**
039: * @see de.schlund.pfixcore.util.StateUtil#isDirectTrigger(Context, PfixServletRequest)
040: */
041: public final boolean isDirectTrigger(Context context,
042: PfixServletRequest preq) {
043: return StateUtil.isDirectTrigger(context, preq);
044: }
045:
046: /**
047: * @see de.schlund.pfixcore.util.StateUtil#isSubmitTrigger(Context, PfixServletRequest)
048: */
049: public final boolean isSubmitTrigger(Context context,
050: PfixServletRequest preq) {
051: return StateUtil.isSubmitTrigger(context, preq);
052: }
053:
054: /**
055: * @see de.schlund.pfixcore.util.StateUtil#isSubmitAuthTrigger(Context, PfixServletRequest)
056: */
057: public final boolean isSubmitAuthTrigger(Context context,
058: PfixServletRequest preq) {
059: return StateUtil.isSubmitAuthTrigger(context, preq);
060: }
061:
062: /**
063: * @see de.schlund.pfixcore.util.StateUtil#createDefaultResultDocument(Context)
064: */
065: protected ResultDocument createDefaultResultDocument(Context context)
066: throws Exception {
067: return StateUtil.createDefaultResultDocument(context);
068: }
069:
070: /**
071: * @see de.schlund.pfixcore.util.StateUtil#renderContextResources(Context, ResultDocument)
072: */
073: protected void renderContextResources(Context context,
074: ResultDocument resdoc) throws Exception {
075: StateUtil.renderContextResources(context, resdoc);
076: }
077:
078: /**
079: * @see de.schlund.pfixcore.util.StateUtil#addResponseHeadersAndType(Context, ResultDocument)
080: */
081: protected void addResponseHeadersAndType(Context context,
082: ResultDocument resdoc) {
083: StateUtil.addResponseHeadersAndType(context, resdoc);
084: }
085:
086: /**
087: * This default implementation returns <code>true</code>. You may want to override this.
088: *
089: * @param context The Context of the current session/user.
090: *
091: * @param preq The current PfixServletRequest object, representing the request
092: * being processed
093: *
094: * @exception Exception if anything goes wrong in the process.
095: */
096: public boolean isAccessible(Context context, PfixServletRequest preq)
097: throws Exception {
098: return true;
099: }
100:
101: /**
102: * This default implementation returns <code>true</code>. You may want to override this.
103: *
104: * @param context The Context of the current session/user.
105: *
106: * @param preq The current PfixServletRequest object, representing the request
107: * being processed
108: *
109: * @exception Exception if anything goes wrong in the process.
110: */
111: public boolean needsData(Context context, PfixServletRequest preq)
112: throws Exception {
113: return true;
114: }
115:
116: /**
117: * You need to implement the state logic (aka business logic) in this method.
118: *
119: * @param context The Context of the current session/user.
120: *
121: * @param preq The current PfixServletRequest object, representing the request
122: * being processed
123: *
124: * @exception Exception if anything goes wrong in the process.
125: */
126: public abstract ResultDocument getDocument(Context context,
127: PfixServletRequest preq) throws Exception;
128:
129: }
|