summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/persistency/outcome/Outcome.java
diff options
context:
space:
mode:
Diffstat (limited to 'source/com/c2kernel/persistency/outcome/Outcome.java')
-rw-r--r--[-rwxr-xr-x]source/com/c2kernel/persistency/outcome/Outcome.java45
1 files changed, 24 insertions, 21 deletions
diff --git a/source/com/c2kernel/persistency/outcome/Outcome.java b/source/com/c2kernel/persistency/outcome/Outcome.java
index f919230..a5ecb29 100755..100644
--- a/source/com/c2kernel/persistency/outcome/Outcome.java
+++ b/source/com/c2kernel/persistency/outcome/Outcome.java
@@ -24,18 +24,18 @@ public class Outcome implements C2KLocalObject {
String mSchemaType;
int mSchemaVersion;
static DocumentBuilder parser;
-
+
static {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(false);
- dbf.setNamespaceAware(false);
+ dbf.setNamespaceAware(false);
try {
parser = dbf.newDocumentBuilder();
} catch (ParserConfigurationException e) {
Logger.error(e);
- }
+ }
}
-
+
//id is the eventID
public Outcome(int id, String data, String schemaType, int schemaVersion) {
mID = id;
@@ -43,23 +43,23 @@ public class Outcome implements C2KLocalObject {
mSchemaType = schemaType;
mSchemaVersion = schemaVersion;
}
-
+
public Outcome(String path, String data) throws PersistencyException {
// derive all the meta data from the path
StringTokenizer tok = new StringTokenizer(path,"/");
- if (tok.countTokens() != 3 && !(tok.nextToken().equals("Outcome")))
+ if (tok.countTokens() != 3 && !(tok.nextToken().equals("Outcome")))
throw new PersistencyException("Outcome() - Outcome path must have three components: "+path, null);
mSchemaType = tok.nextToken();
String verstring = tok.nextToken();
String objId = tok.nextToken();
try {
mSchemaVersion = Integer.parseInt(verstring);
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException ex) {
throw new PersistencyException("Outcome() - Outcome version was an invalid number: "+verstring, null);
}
try {
mID = Integer.parseInt(objId);
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException ex) {
mID = -1;
}
mData = data;
@@ -73,7 +73,8 @@ public class Outcome implements C2KLocalObject {
return mID;
}
- public void setName(String name) {
+ @Override
+ public void setName(String name) {
try {
mID = Integer.parseInt(name);
} catch (NumberFormatException e) {
@@ -81,14 +82,15 @@ public class Outcome implements C2KLocalObject {
}
}
- public String getName() {
+ @Override
+ public String getName() {
return String.valueOf(mID);
}
public void setData(String data) {
mData = data;
}
-
+
public void setData(Document data) {
mData = serialize(data, false);
}
@@ -96,11 +98,11 @@ public class Outcome implements C2KLocalObject {
public String getData() {
return mData;
}
-
+
public void setSchemaType(String schemaType) {
mSchemaType = schemaType;
}
-
+
public String getSchemaType() {
return mSchemaType;
}
@@ -108,24 +110,25 @@ public class Outcome implements C2KLocalObject {
public void setSchemaURL(int schemaVersion) {
mSchemaVersion = schemaVersion;
}
-
+
public int getSchemaVersion() {
return mSchemaVersion;
- }
-
+ }
+
public void setSchemaVersion(int schVer) {
mSchemaVersion = schVer;
- }
-
+ }
+
+ @Override
public String getClusterType() {
return ClusterStorage.OUTCOME;
}
-
+
// special script API methods
/**
* Parses the outcome into a DOM tree
- * @return a DOM Document
+ * @return a DOM Document
*/
public Document getDOM() {
try {
@@ -137,7 +140,7 @@ public class Outcome implements C2KLocalObject {
return null;
}
}
-
+
static public String serialize(Document doc, boolean prettyPrint)
{
String serializedDoc = null;