From 0ed2c1124cf1b9e49a2ec1fa0126a8df09f9e758 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 7 Oct 2014 09:18:11 +0200 Subject: Repackage to org.cristalise --- .../com/c2kernel/lifecycle/instance/Workflow.java | 265 --------------------- 1 file changed, 265 deletions(-) delete mode 100644 src/main/java/com/c2kernel/lifecycle/instance/Workflow.java (limited to 'src/main/java/com/c2kernel/lifecycle/instance/Workflow.java') diff --git a/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java b/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java deleted file mode 100644 index f152adc..0000000 --- a/src/main/java/com/c2kernel/lifecycle/instance/Workflow.java +++ /dev/null @@ -1,265 +0,0 @@ -/** - * This file is part of the CRISTAL-iSE kernel. - * Copyright (c) 2001-2014 The CRISTAL Consortium. All rights reserved. - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 3 of the License, or (at - * your option) any later version. - * - * This library is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * http://www.fsf.org/licensing/licenses/lgpl.html - */ -package com.c2kernel.lifecycle.instance; -import java.util.ArrayList; - -import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.CannotManageException; -import com.c2kernel.common.InvalidCollectionModification; -import com.c2kernel.common.InvalidDataException; -import com.c2kernel.common.InvalidTransitionException; -import com.c2kernel.common.ObjectAlreadyExistsException; -import com.c2kernel.common.ObjectCannotBeUpdated; -import com.c2kernel.common.ObjectNotFoundException; -import com.c2kernel.common.PersistencyException; -import com.c2kernel.entity.C2KLocalObject; -import com.c2kernel.entity.agent.Job; -import com.c2kernel.events.History; -import com.c2kernel.graph.model.GraphPoint; -import com.c2kernel.graph.model.TypeNameAndConstructionInfo; -import com.c2kernel.lifecycle.instance.predefined.PredefinedStepContainer; -import com.c2kernel.lookup.AgentPath; -import com.c2kernel.lookup.InvalidAgentPathException; -import com.c2kernel.lookup.InvalidItemPathException; -import com.c2kernel.lookup.ItemPath; -import com.c2kernel.persistency.ClusterStorage; -import com.c2kernel.utils.Language; -import com.c2kernel.utils.Logger; -/** - * @version $Revision: 1.64 $ $Date: 2005/09/30 07:09:48 $ - * @author $Author: abranson $ - */ -public class Workflow extends CompositeActivity implements C2KLocalObject -{ - public History history; - private ItemPath itemPath = null; - - /** TypeNameAndConstructionInfo[] variables added by Steve */ - private final TypeNameAndConstructionInfo[] mVertexTypeNameAndConstructionInfo = - { - new TypeNameAndConstructionInfo(Language.translate("AND Split"), "AndSplit"), - new TypeNameAndConstructionInfo(Language.translate("OR Split"), "OrSplit"), - new TypeNameAndConstructionInfo(Language.translate("XOR Split"), "XOrSplit"), - new TypeNameAndConstructionInfo(Language.translate("Join"), "Join"), - new TypeNameAndConstructionInfo(Language.translate("Loop"), "LoopSplit"), - new TypeNameAndConstructionInfo(Language.translate("Activity"), "Atomic"), - new TypeNameAndConstructionInfo(Language.translate("Composite"), "Composite") - }; - private final TypeNameAndConstructionInfo[] mEdgeTypeNameAndConstructionInfo = - { - new TypeNameAndConstructionInfo(Language.translate("Next"), "Next") - }; - /** - * @see java.lang.Object#Object() - */ - public Workflow() - { - } - - public Workflow(CompositeActivity domain, PredefinedStepContainer predef) { - this(); - domain.setName("domain"); - initChild(domain, true, new GraphPoint(150, 100)); - addChild(predef, new GraphPoint(300, 100)); - } - - public History getHistory() throws InvalidDataException { - if (history == null) { - if (itemPath == null) - throw new InvalidDataException("Workflow not initialized."); - history = new History(itemPath, this); - } - return history; - } - - /** - * Method getVertexTypeNameAndConstructionInfo. - * - * @return TypeNameAndConstructionInfo[] - */ - /** getVertexTypeNameAndConstructionInfo() added by Steve */ - public TypeNameAndConstructionInfo[] getVertexTypeNameAndConstructionInfo() - { - return mVertexTypeNameAndConstructionInfo; - } - /** - * Method getEdgeTypeNameAndConstructionInfo. - * - * @return TypeNameAndConstructionInfo[] - */ - /** getVertexTypeNameAndConstructionInfo() added by Steve */ - public TypeNameAndConstructionInfo[] getEdgeTypeNameAndConstructionInfo() - { - return mEdgeTypeNameAndConstructionInfo; - } - /** - * Method requestAction. - * - * @param agentInfo - * @param stepPath - * @param transitionID - * @param reguestData - * @throws ObjectNotFoundException - * @throws AccessRightsException - * @throws InvalidTransitionException - * @throws InvalidDataException - * @throws PersistencyException - * @throws ObjectCannotBeUpdated - * @throws CannotManageException - * @throws InvalidCollectionModification - */ - //requestData is xmlstring - public String requestAction(AgentPath agent, String stepPath, ItemPath itemPath, int transitionID, String requestData) - throws ObjectNotFoundException, AccessRightsException, InvalidTransitionException, InvalidDataException, ObjectAlreadyExistsException, PersistencyException, ObjectCannotBeUpdated, CannotManageException, InvalidCollectionModification - { - Logger.msg(3, "Action: " + transitionID + " " + stepPath + " by " + agent); - if (search(stepPath) != null) - return ((Activity) search(stepPath)).request(agent, itemPath, transitionID, requestData); - else - throw new ObjectNotFoundException(stepPath + " not found"); - } - - /** - * @see com.c2kernel.graph.model.GraphableVertex#getPath() - */ - @Override - public String getPath() - { - return "workflow"; - } - /** - * @see com.c2kernel.graph.model.Vertex#getName() - */ - @Override - public String getName() - { - return "workflow"; - } - /** - * @see com.c2kernel.lifecycle.instance.Activity#getType() - */ - @Override - public String getType() - { - return "workflow"; - } - /** - * @see com.c2kernel.graph.model.Vertex#setName(java.lang.String) - */ - @Override - public void setName(String name) - { - } - /** - * @see com.c2kernel.lifecycle.instance.WfVertex#verify() - */ - @Override - public boolean verify() - { - for (int i = 0; i < getChildren().length; i++) - { - if (!((WfVertex) getChildren()[i]).verify()) - { - mErrors.add("error in children"); - return false; - } - } - return true; - } - /** - * @see com.c2kernel.lifecycle.instance.Activity#getWf() - */ - @Override - public Workflow getWf() - { - return this; - } - /** - * Method initialise. - * - * @param systemKey - * @throws InvalidDataException - * @throws ObjectNotFoundException - * @throws AccessRightsException - * @throws InvalidTransitionException - * @throws ObjectAlreadyExistsException - * @throws ObjectCannotBeUpdated - */ - public void initialise(ItemPath itemPath, AgentPath agent) throws InvalidDataException - { - setItemPath(itemPath); - runFirst(agent, itemPath); - } - - public ItemPath getItemPath() { - return itemPath; - } - - public void setItemPath(ItemPath itemPath) { - this.itemPath = itemPath; - } - - public void setItemUUID( String uuid ) throws InvalidItemPathException - { - setItemPath(new ItemPath(uuid)); - } - - public String getItemUUID() { - return getItemPath().getUUID().toString(); - } - - /** - * if type = 0 only domain steps will be queried if type = 1 only predefined steps will be queried else both will be queried - * @param agent - * @param itemSysKey - * @param type - * @return - * @throws ObjectNotFoundException - * @throws InvalidDataException - * @throws InvalidAgentPathException - */ - public ArrayList calculateJobs(AgentPath agent, ItemPath itemPath, int type) throws InvalidAgentPathException, ObjectNotFoundException, InvalidDataException - { - ArrayList jobs = new ArrayList(); - if (type != 1) - jobs.addAll(((CompositeActivity) search("workflow/domain")).calculateJobs(agent, itemPath, true)); - if (type != 0) - jobs.addAll(((CompositeActivity) search("workflow/predefined")).calculateJobs(agent, itemPath, true)); - return jobs; - } - /** - * @see com.c2kernel.lifecycle.instance.CompositeActivity#hasGoodNumberOfActivity() - */ - @Override - public boolean hasGoodNumberOfActivity() - { - return true; - } - /** - * @see com.c2kernel.entity.C2KLocalObject#getClusterType() - */ - @Override - public String getClusterType() - { - return ClusterStorage.LIFECYCLE; - } - -} -- cgit v1.2.3