001: /*
002: * This file is part of the WfMOpen project.
003: * Copyright (C) 2001-2003 Danet GmbH (www.danet.de), GS-AN.
004: * All rights reserved.
005: *
006: * This program is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU General Public License as published by
008: * the Free Software Foundation; either version 2 of the License, or
009: * (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * $Id: WrappedProcessDefinitionDirectory.java,v 1.2 2006/09/29 12:32:08 drmlipp Exp $
021: *
022: * $Log: WrappedProcessDefinitionDirectory.java,v $
023: * Revision 1.2 2006/09/29 12:32:08 drmlipp
024: * Consistently using WfMOpen as projct name now.
025: *
026: * Revision 1.1.1.1 2003/12/19 13:01:46 drmlipp
027: * Updated to 1.1rc1
028: *
029: * Revision 1.2 2003/10/28 14:06:13 huaiyang
030: * refactor it.
031: *
032: * Revision 1.1 2003/10/27 15:32:20 huaiyang
033: * initial.
034: *
035: *
036: *
037: */
038: package common;
039:
040: import java.util.ArrayList;
041: import java.util.Collection;
042: import java.util.Iterator;
043: import java.util.List;
044:
045: import java.rmi.RemoteException;
046:
047: import de.danet.an.workflow.omgcore.CannotCompleteException;
048: import de.danet.an.workflow.omgcore.InvalidStateException;
049: import de.danet.an.workflow.omgcore.TransitionNotAllowedException;
050: import de.danet.an.workflow.omgcore.WfActivity;
051: import de.danet.an.workflow.omgcore.WfProcess;
052:
053: import de.danet.an.workflow.api.ProcessDefinitionDirectory;
054: import de.danet.an.workflow.api.Activity;
055: import de.danet.an.workflow.api.InvalidKeyException;
056: import de.danet.an.workflow.api.ImportException;
057: import de.danet.an.workflow.api.ProcessMgr;
058:
059: /**
060: * Describe class <code>WrappedProcessDefinitionDirectory</code> here.
061: *
062: * @author <a href="mailto:weidauer@danet.de">Christian Weidauer</a>
063: * @version 1.0
064: */
065: public class WrappedProcessDefinitionDirectory {
066: private ProcessDefinitionDirectory defDir = null;
067:
068: /**
069: * Creates a new <code>WrappedProcessDefinitionDirectory</code> instance.
070: *
071: * @param a <code>ProcessDefinitionDirectory</code> value
072: */
073: public WrappedProcessDefinitionDirectory(
074: ProcessDefinitionDirectory defDir) {
075: this .defDir = defDir;
076: }
077:
078: /**
079: * This operation method removes a process definition with the
080: * given ids from the database. If called for a definition that
081: * does not exist, it does nothing.
082: *
083: * @param packageId Id attribute of the process package.
084: * @param processId Id attribute of the process.
085: * @throws RemoteException if a system-level error occurs.
086: * @throws InvalidKeyException if packageId or processId are
087: * (formally) invalid ids.
088: */
089: public void removeProcessDefinition(String packageId,
090: String processId) throws InvalidKeyException {
091: while (true) {
092: try {
093: defDir.removeProcessDefinition(packageId, processId);
094: break;
095: } catch (RemoteException re) {
096: }
097: }
098: }
099:
100: /**
101: * This operation method import new process definitions from an
102: * XPDL description. <P>
103: *
104: * Note that importing an XPDL description automatically removes
105: * any existing process definitions that have the same package id
106: * as the imported package.
107: *
108: * @param processDefinitions document describing the process definitions.
109: * @return list of prioritized message
110: * {@link de.danet.an.workflow.api.PrioritizedMessage
111: * <code>PrioritizedMessage</code>}. This list only includes
112: * messages of priority INFO or WARN. If any (fatal) error has occured, an
113: * {@link de.danet.an.workflow.api.ImportException
114: * <code>ImportException</code>}will be thrown and the error
115: * message can be taken from there.
116: * @throws RemoteException if a system-level error occurs. The
117: * import has been aborted.
118: * @throws ImportException if the input is not a correct.
119: */
120: public List importProcessDefinitions(String processDefinitions)
121: throws ImportException {
122: while (true) {
123: try {
124: return defDir
125: .importProcessDefinitions(processDefinitions);
126: } catch (RemoteException re) {
127: // try again
128: }
129: }
130: }
131:
132: /**
133: * This method delivers the process manager for the process
134: * definition with the given ids.
135: *
136: * @param packageId Id attribute of the process package.
137: * @param processId Id attribute of the process.
138: * @return the process manager for the process type.
139: * @throws InvalidKeyException if not process definition with
140: * the given ids exists.
141: * @throws RemoteException if a system-level error occurs.
142: */
143: public ProcessMgr processMgr(String packageId, String processId)
144: throws InvalidKeyException, RemoteException {
145: return defDir.processMgr(packageId, processId);
146: }
147:
148: /**
149: * This operation method returns true if the process definition
150: * with the given ids is enabled.
151: *
152: * @param packageId Id attribute of the process package.
153: * @param processId Id attribute of the process.
154: * @return if the process definition is enabled.
155: * @throws InvalidKeyException if no process definition with
156: * the given ids exists.
157: * @throws RemoteException if a system-level error occurs.
158: */
159: public boolean isEnabled(String packageId, String processId)
160: throws RemoteException, InvalidKeyException {
161: return defDir.isEnabled(packageId, processId);
162: }
163:
164: /**
165: * This operation method set the process definition with the given
166: * ids as enabled or disabled.
167: *
168: * @param packageId Id attribute of the process package.
169: * @param processId Id attribute of the process.
170: * @param enabled enable the process definition or not.
171: * @throws InvalidKeyException if no process definition with
172: * the given ids exists.
173: * @throws RemoteException if a system-level error occurs.
174: */
175: public void setEnabled(String packageId, String processId,
176: boolean enabled) throws RemoteException,
177: InvalidKeyException {
178: defDir.setEnabled(packageId, processId, enabled);
179: }
180:
181: }
|