diff options
| author | ogattaz <olivier@gattaz.com> | 2014-06-05 16:51:07 +0200 |
|---|---|---|
| committer | ogattaz <olivier@gattaz.com> | 2014-06-05 16:51:07 +0200 |
| commit | 2fd193d7936084de91eae46e8c2763914d87ab71 (patch) | |
| tree | b136ed97e535f11d4b3433d16c26570c89430ce4 /src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java | |
| parent | 1225792532f77e6e8f4a9addfc0c0a6cf56e89b8 (diff) | |
| parent | e73468fd08cc27aa31f76a27c916e45d5987c628 (diff) | |
Merge branch 'master' of ssh://dev.cccs.uwe.ac.uk:22/var/git/cristal-kernel
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 | 36 |
1 files changed, 22 insertions, 14 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 642cf64..1ee5e8c 100644 --- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java +++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/RemoveDomainPath.java @@ -11,9 +11,11 @@ package com.c2kernel.lifecycle.instance.predefined; import com.c2kernel.common.InvalidDataException;
+import com.c2kernel.common.ObjectCannotBeUpdated;
+import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.DomainPath;
-import com.c2kernel.lookup.LDAPLookup;
+import com.c2kernel.lookup.Lookup;
import com.c2kernel.process.Gateway;
import com.c2kernel.utils.Logger;
@@ -30,23 +32,29 @@ public class RemoveDomainPath extends PredefinedStep int transitionID, String requestData) throws InvalidDataException {
Logger.msg(8,"RemoveDomainPath::request()");
- LDAPLookup lookupManager = Gateway.getLDAPLookup();
+ Lookup lookupManager = Gateway.getLookup();
Logger.msg(1,"RemoveDomainPath::request() - Starting.");
- try
- {
- DomainPath domainPath = new DomainPath(getDataList(requestData)[0]);
- lookupManager.delete(domainPath);
- Logger.msg(8,"AddAlias::request() - context:" + domainPath.toString() + " DONE.");
- return requestData;
+ DomainPath domainPath = new DomainPath(getDataList(requestData)[0]);
+ if (!domainPath.exists())
+ throw new InvalidDataException("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, "");
+ } catch (ObjectNotFoundException ex) {
+ throw new InvalidDataException("Domain path "+domainPath.toString()+" is a context.", "");
}
- catch( Exception ex )
- {
- Logger.error("AddAlias::request() - during anyHelper.extract.");
- Logger.error(ex);
- throw new InvalidDataException(ex.toString(), "");
+ try {
+ lookupManager.delete(domainPath);
+ Logger.msg(8,"AddAlias::request() - context:" + domainPath.toString() + " DONE.");
+ return requestData;
+ } catch (ObjectCannotBeUpdated ex) {
+ Logger.error(ex);
+ throw new InvalidDataException("Problem updating directory", "");
}
-
}
}
|
