diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2014-09-19 15:40:50 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2014-09-19 15:40:50 +0200 |
| commit | 482b98e869d07802310e249d09d784c63f9a86b6 (patch) | |
| tree | bd6c55d5d5ebf967fb22b5cf1ceb9f3f6a7bbdd9 /src/main/java/com/c2kernel/events | |
| parent | 3743d182d99dbed9d2be84dc357f6839ffe4d2ec (diff) | |
Introduced static method ItemPath.fromUUIDString and made the UUID
constructor protected to better handle ItemPath and AgentPath
construction with String UUIDs, throwing the right exceptions.
Diffstat (limited to 'src/main/java/com/c2kernel/events')
| -rw-r--r-- | src/main/java/com/c2kernel/events/Event.java | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/main/java/com/c2kernel/events/Event.java b/src/main/java/com/c2kernel/events/Event.java index 267f135..bf9be68 100644 --- a/src/main/java/com/c2kernel/events/Event.java +++ b/src/main/java/com/c2kernel/events/Event.java @@ -10,16 +10,14 @@ package com.c2kernel.events;
import java.util.Calendar;
-import java.util.UUID;
import com.c2kernel.common.GTimeStamp;
import com.c2kernel.common.InvalidDataException;
import com.c2kernel.entity.C2KLocalObject;
import com.c2kernel.lookup.AgentPath;
-import com.c2kernel.lookup.InvalidAgentPathException;
+import com.c2kernel.lookup.InvalidItemPathException;
import com.c2kernel.lookup.ItemPath;
import com.c2kernel.persistency.ClusterStorage;
-import com.c2kernel.utils.Logger;
/**
@@ -82,24 +80,21 @@ public class Event implements C2KLocalObject mItemPath = itemPath;
}
- public void setItemUUID( String uuid )
+ public void setItemUUID( String uuid ) throws InvalidItemPathException
{
- setItemPath(new ItemPath(UUID.fromString(uuid)));
+ setItemPath(ItemPath.fromUUIDString(uuid));
}
public String getItemUUID() {
return getItemPath().getUUID().toString();
}
- public void setAgentUUID( String uuid )
+ public void setAgentUUID( String uuid ) throws InvalidItemPathException
{
- if (uuid == null) mAgentPath = null;
+ if (uuid == null || uuid.length() == 0)
+ mAgentPath = null;
else
- try {
- setAgentPath(new AgentPath(UUID.fromString(uuid)));
- } catch (InvalidAgentPathException e) {
- Logger.error("Invalid agent path in Event: "+uuid);
- }
+ setAgentPath(AgentPath.fromUUIDString(uuid));
}
public String getAgentUUID() {
|
