package com.c2kernel.lifecycle; import java.util.Vector; import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.lifecycle.instance.Activity; import com.c2kernel.lifecycle.instance.WfVertex; import com.c2kernel.lifecycle.instance.stateMachine.StateMachine; import com.c2kernel.utils.FileStringUtility; /** * @version $Revision: 1.45 $ $Date: 2005/10/05 07:39:36 $ * @author $Author: abranson $ */ public class ActivityDef extends WfVertexDef implements C2KLocalObject { private int mId = -1; private String mName = ""; private String mVersion = ""; public boolean changed = false; /** * @see java.lang.Object#Object() */ public ActivityDef() { mErrors = new Vector(0, 1); setProperties(new WfCastorHashMap()); setIsLayoutable(false); getProperties().put(StateMachine.SKIPPABLE, new Boolean(false)); getProperties().put(StateMachine.REPEATABLE, new Boolean(false)); getProperties().put(StateMachine.IGNORABLE, new Boolean(false)); } /** * @see com.c2kernel.graph.model.Vertex#setID(int) */ public void setID(int id) { mId = id; if (mName.equals("")) setName(String.valueOf(id)); } /** * @see com.c2kernel.graph.model.Vertex#getID() */ public int getID() { return mId; } /** * @see com.c2kernel.graph.model.Vertex#setName(java.lang.String) */ public void setName(String n) { mName = n; } /** * @see com.c2kernel.graph.model.Vertex#getName() */ public String getName() { return mName; } public void setVersion(String v) { mVersion = v; } /** * @see com.c2kernel.graph.model.Vertex#getName() */ public String getVersion() { return mVersion; } /** * @see com.c2kernel.lifecycle.WfVertexDef#getErrors() */ public String getErrors() { return super.getErrors(); } /** * Method linkToSlot. * * @param actSl * @param name */ public void linkToSlot(ActivitySlotDef actSl, String name, String name2) { actSl.setActivityDef(FileStringUtility.convert(name)); actSl.getProperties().put("Name", name2.replace('/', '_')); actSl.setName(name+" slot"); setName(FileStringUtility.convert(name)); } /** * @see com.c2kernel.lifecycle.WfVertexDef#verify() */ public boolean verify() { return true; } /** * @see com.c2kernel.entity.C2KLocalObject#getClusterType() */ public String getClusterType() { return null; } public String getActName() { return getName(); } /* * (non-Javadoc) * * @see com.c2kernel.lifecycle.commonInterface.ActType#getDescName() */ public String getDescName() { return getName(); } public WfVertex instantiate() throws ObjectNotFoundException, InvalidDataException{ return instantiate(getName()); } public WfVertex instantiate(String name) throws ObjectNotFoundException, InvalidDataException { Activity act = new Activity(); configureInstance(act); act.setName(name); act.setType(getName()); return act; } }