From da731d2bb81666b9c697d9099da632e7dfcdc0f7 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 9 Sep 2014 12:13:21 +0200 Subject: Replaced int sysKey Item identifier with UUID, which is now portable. ItemPath objects are now used to identify Items throughout the kernel, replacing ints and Integers. --- .../predefined/agent/CreateAgentFromDescription.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java') diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java index a7971f3..520f70f 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java @@ -19,6 +19,7 @@ import com.c2kernel.entity.CorbaServer; import com.c2kernel.entity.agent.ActiveEntity; import com.c2kernel.lifecycle.instance.predefined.item.CreateItemFromDescription; import com.c2kernel.lookup.AgentPath; +import com.c2kernel.lookup.ItemPath; import com.c2kernel.lookup.RolePath; import com.c2kernel.process.Gateway; import com.c2kernel.utils.Logger; @@ -42,7 +43,7 @@ public class CreateAgentFromDescription extends CreateItemFromDescription * @see com.c2kernel.lifecycle.instance.predefined.item.CreateItemFromDescription#runActivityLogic(com.c2kernel.lookup.AgentPath, int, int, java.lang.String) */ @Override - protected String runActivityLogic(AgentPath agent, int itemSysKey, + protected String runActivityLogic(AgentPath agent, ItemPath itemPath, int transitionID, String requestData) throws InvalidDataException { String[] input = getDataList(requestData); @@ -67,8 +68,8 @@ public class CreateAgentFromDescription extends CreateItemFromDescription } catch (ObjectNotFoundException ex) { } // generate new entity key - Logger.msg(6, "CreateItemFromDescription - Requesting new sysKey"); - AgentPath newAgentPath = Gateway.getNextKeyManager().generateNextAgentKey(); + Logger.msg(6, "CreateItemFromDescription - Requesting new agent path"); + AgentPath newAgentPath = new AgentPath(newName); // resolve the item factory Logger.msg(6, "CreateItemFromDescription - Resolving item factory"); @@ -77,7 +78,7 @@ public class CreateAgentFromDescription extends CreateItemFromDescription Logger.msg(3, "CreateItemFromDescription - Creating Item"); CorbaServer factory = Gateway.getCorbaServer(); if (factory == null) throw new AccessRightsException("This process cannot create new Items", ""); - ActiveEntity newAgent = (ActiveEntity)factory.createEntity(newAgentPath); + ActiveEntity newAgent = factory.createAgent(newAgentPath); Gateway.getLookupManager().add(newAgentPath); // initialise it with its properties and workflow @@ -85,10 +86,10 @@ public class CreateAgentFromDescription extends CreateItemFromDescription Logger.msg(3, "CreateItemFromDescription - Initializing Item"); newAgent.initialise( - agent.getSysKey(), - Gateway.getMarshaller().marshall(getNewProperties(itemSysKey, newName, agent)), - Gateway.getMarshaller().marshall(getNewWorkflow(itemSysKey)), - Gateway.getMarshaller().marshall(getNewCollections(itemSysKey)) + agent.getSystemKey(), + Gateway.getMarshaller().marshall(getNewProperties(itemPath, newName, agent)), + Gateway.getMarshaller().marshall(getNewWorkflow(itemPath)), + Gateway.getMarshaller().marshall(getNewCollections(itemPath)) ); // add roles if given -- cgit v1.2.3