001: /*
002: * Copyright (c) 2002-2003 by OpenSymphony
003: * All rights reserved.
004: */
005: /*
006: * Created by IntelliJ IDEA.
007: * User: plightbo
008: * Date: May 22, 2002
009: * Time: 12:04:32 PM
010: */
011: package com.opensymphony.workflow.soap;
012:
013: import com.opensymphony.module.propertyset.PropertySet;
014:
015: import com.opensymphony.workflow.*;
016: import com.opensymphony.workflow.basic.BasicWorkflow;
017: import com.opensymphony.workflow.config.Configuration;
018: import com.opensymphony.workflow.loader.WorkflowDescriptor;
019: import com.opensymphony.workflow.query.WorkflowExpressionQuery;
020: import com.opensymphony.workflow.query.WorkflowQuery;
021:
022: import electric.util.Context;
023:
024: import java.util.List;
025: import java.util.Map;
026:
027: import javax.servlet.http.HttpServletRequest;
028:
029: /**
030: * Soap enabled Wrapper around a BasicWorkflow
031: */
032: public class BasicSOAPWorkflow implements Workflow {
033: //~ Methods ////////////////////////////////////////////////////////////////
034:
035: public int[] getAvailableActions(long id) {
036: return new BasicWorkflow(getRemoteUser())
037: .getAvailableActions(id);
038: }
039:
040: public int[] getAvailableActions(long id, Map inputs) {
041: return new BasicWorkflow(getRemoteUser()).getAvailableActions(
042: id, inputs);
043: }
044:
045: public void setConfiguration(Configuration configuration) {
046: new BasicWorkflow(getRemoteUser())
047: .setConfiguration(configuration);
048: }
049:
050: public List getCurrentSteps(long id) {
051: return new BasicWorkflow(getRemoteUser()).getCurrentSteps(id);
052: }
053:
054: public int getEntryState(long id) {
055: return new BasicWorkflow(getRemoteUser()).getEntryState(id);
056: }
057:
058: public List getHistorySteps(long id) {
059: return new BasicWorkflow(getRemoteUser()).getHistorySteps(id);
060: }
061:
062: public PropertySet getPropertySet(long id) {
063: return new BasicWorkflow(getRemoteUser()).getPropertySet(id);
064: }
065:
066: public List getSecurityPermissions(long id) {
067: return new BasicWorkflow(getRemoteUser())
068: .getSecurityPermissions(id, null);
069: }
070:
071: public List getSecurityPermissions(long id, Map inputs) {
072: return new BasicWorkflow(getRemoteUser())
073: .getSecurityPermissions(id, inputs);
074: }
075:
076: public WorkflowDescriptor getWorkflowDescriptor(String workflowName) {
077: return new BasicWorkflow(getRemoteUser())
078: .getWorkflowDescriptor(workflowName);
079: }
080:
081: public String getWorkflowName(long id) {
082: return new BasicWorkflow(getRemoteUser()).getWorkflowName(id);
083: }
084:
085: public String[] getWorkflowNames() {
086: return new BasicWorkflow(getRemoteUser()).getWorkflowNames();
087: }
088:
089: public boolean canInitialize(String workflowName, int initialState) {
090: return new BasicWorkflow(getRemoteUser()).canInitialize(
091: workflowName, initialState);
092: }
093:
094: public boolean canInitialize(String workflowName,
095: int initialAction, Map inputs) {
096: return new BasicWorkflow(getRemoteUser()).canInitialize(
097: workflowName, initialAction, inputs);
098: }
099:
100: public boolean canModifyEntryState(long id, int newState) {
101: return new BasicWorkflow(getRemoteUser()).canModifyEntryState(
102: id, newState);
103: }
104:
105: public void changeEntryState(long id, int newState)
106: throws WorkflowException {
107: new BasicWorkflow(getRemoteUser()).changeEntryState(id,
108: newState);
109: }
110:
111: public void doAction(long id, int actionId, Map inputs)
112: throws WorkflowException {
113: new BasicWorkflow(getRemoteUser()).doAction(id, actionId,
114: inputs);
115: }
116:
117: public void executeTriggerFunction(long id, int triggerId)
118: throws WorkflowException {
119: new BasicWorkflow(getRemoteUser()).executeTriggerFunction(id,
120: triggerId);
121: }
122:
123: public long initialize(String workflowName, int initialState,
124: Map inputs) throws WorkflowException {
125: return new BasicWorkflow(getRemoteUser()).initialize(
126: workflowName, initialState, inputs);
127: }
128:
129: public List query(WorkflowQuery query) throws StoreException {
130: return new BasicWorkflow(getRemoteUser()).query(query);
131: }
132:
133: public List query(WorkflowExpressionQuery query)
134: throws WorkflowException {
135: return new BasicWorkflow(getRemoteUser()).query(query);
136: }
137:
138: public boolean removeWorkflowDescriptor(String workflowName)
139: throws FactoryException {
140: return new BasicWorkflow(getRemoteUser())
141: .removeWorkflowDescriptor(workflowName);
142: }
143:
144: public boolean saveWorkflowDescriptor(String workflowName,
145: WorkflowDescriptor descriptor, boolean replace)
146: throws FactoryException {
147: return new BasicWorkflow(getRemoteUser())
148: .saveWorkflowDescriptor(workflowName, descriptor,
149: replace);
150: }
151:
152: protected String getRemoteUser() {
153: HttpServletRequest request = (HttpServletRequest) Context
154: .thread().getProperty("httpRequest");
155:
156: return request.getRemoteUser();
157: }
158: }
|