From a1f0ecbb6a2bea6aa214322c412af2f3c5ce124b Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Wed, 7 May 2014 17:33:13 +0200 Subject: Agent now extends Item, so they can have workflows. All traces of the old 'Entity' superclasses should be removed, including proxies and paths. Very large change, breaks API compatibility with CRISTAL 2.x. Fixes #135 --- src/main/java/com/c2kernel/lookup/NextKeyManager.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/main/java/com/c2kernel/lookup/NextKeyManager.java') diff --git a/src/main/java/com/c2kernel/lookup/NextKeyManager.java b/src/main/java/com/c2kernel/lookup/NextKeyManager.java index a4ead4b..9aea50d 100644 --- a/src/main/java/com/c2kernel/lookup/NextKeyManager.java +++ b/src/main/java/com/c2kernel/lookup/NextKeyManager.java @@ -28,14 +28,14 @@ public class NextKeyManager { this.lastKeyPath = lastKeyPath; } - public synchronized EntityPath generateNextEntityKey() + public synchronized ItemPath generateNextEntityKey() throws ObjectCannotBeUpdated, ObjectNotFoundException { - EntityPath lastKey = getLastEntityPath(); + ItemPath lastKey = getLastEntityPath(); try { lastKey.setSysKey(lastKey.getSysKey()+1); - } catch (InvalidEntityPathException ex) { + } catch (InvalidItemPathException ex) { throw new ObjectCannotBeUpdated("Invalid syskey "+(lastKey.getSysKey()+1)+". Maybe centre is full."); } //test that storage is empty for that key @@ -56,7 +56,7 @@ public class NextKeyManager { public synchronized AgentPath generateNextAgentKey() throws ObjectCannotBeUpdated, ObjectNotFoundException { - EntityPath newEntity = generateNextEntityKey(); + ItemPath newEntity = generateNextEntityKey(); return new AgentPath(newEntity); } @@ -65,15 +65,15 @@ public class NextKeyManager { LDAPLookupUtils.setAttributeValue(ldap.getConnection(), lastKeyEntry,"intsyskey",Integer.toString(sysKey)); } - public EntityPath getLastEntityPath() throws ObjectNotFoundException + public ItemPath getLastEntityPath() throws ObjectNotFoundException { LDAPEntry lastKeyEntry = LDAPLookupUtils.getEntry(ldap.getConnection(),lastKeyPath); String lastKey = LDAPLookupUtils.getFirstAttributeValue(lastKeyEntry,"intsyskey"); try { int sysKey = Integer.parseInt(lastKey); - EntityPath sysPath = new EntityPath(sysKey); + ItemPath sysPath = new ItemPath(sysKey); return sysPath; - } catch (InvalidEntityPathException ex) { + } catch (InvalidItemPathException ex) { throw new ObjectNotFoundException("Invalid syskey. Maybe centre is full."); } catch (NumberFormatException ex) { throw new ObjectNotFoundException("Invalid syskey in lastkey."); -- cgit v1.2.3