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. --- .../instance/predefined/RemoveDomainPath.java | 25 +++++++++++----------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java') diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java index df1c44e..4aabd6b 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java @@ -10,10 +10,13 @@ package com.c2kernel.lifecycle.instance.predefined; +import java.util.Arrays; + import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.DomainPath; +import com.c2kernel.lookup.ItemPath; import com.c2kernel.lookup.LookupManager; import com.c2kernel.process.Gateway; import com.c2kernel.utils.Logger; @@ -27,34 +30,30 @@ public class RemoveDomainPath extends PredefinedStep //requestdata is xmlstring @Override - protected String runActivityLogic(AgentPath agent, int itemSysKey, + protected String runActivityLogic(AgentPath agent, ItemPath item, int transitionID, String requestData) throws InvalidDataException { - Logger.msg(8,"RemoveDomainPath::request()"); - - - Logger.msg(1,"RemoveDomainPath::request() - Starting."); + String[] params = getDataList(requestData); + if (Logger.doLog(3)) Logger.msg(3, "RemoveDomainPath: called by "+agent+" on "+item+" with parameters "+Arrays.toString(params)); - DomainPath domainPath = new DomainPath(getDataList(requestData)[0]); + DomainPath domainPath = new DomainPath(params[0]); if (!domainPath.exists()) - throw new InvalidDataException("Domain path "+domainPath.toString()+" does not exist.", ""); + throw new InvalidDataException("RemoveDomainPath: Domain path "+domainPath.toString()+" does not exist.", ""); if (domainPath.getType()!=DomainPath.ENTITY) try { - if (domainPath.getEntity().getSysKey() != itemSysKey) - throw new InvalidDataException("Domain path "+domainPath.toString()+" is not an alias of the current Item "+itemSysKey, ""); + if (!domainPath.getItemPath().equals(item)) + throw new InvalidDataException("RemoveDomainPath: Domain path "+domainPath.toString()+" is not an alias of the current Item "+item, ""); } catch (ObjectNotFoundException ex) { - throw new InvalidDataException("Domain path "+domainPath.toString()+" is a context.", ""); + throw new InvalidDataException("RemoveDomainPath: Domain path "+domainPath.toString()+" is a context.", ""); } try { LookupManager lookupManager = Gateway.getLookupManager(); lookupManager.delete(domainPath); - Logger.msg(8,"AddAlias::request() - context:" + domainPath.toString() + " DONE."); return requestData; } catch (Exception ex) { - Logger.error(ex); - throw new InvalidDataException("Problem updating directory", ""); + throw unknownException(ex); } } } -- cgit v1.2.3