diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-09-09 12:13:21 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-09-09 12:13:21 +0200 |
| commit | da731d2bb81666b9c697d9099da632e7dfcdc0f7 (patch) | |
| tree | 567693c3c48f3d15ecbb2dac4f9db03bb6e58c72 /src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java | |
| parent | ae1e79e33fd30e3d8bcedbef8891a14a048276d7 (diff) | |
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.
Diffstat (limited to 'src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java')
| -rw-r--r-- | src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java | 25 |
1 files changed, 12 insertions, 13 deletions
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);
}
}
}
|
