summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Clayton <alex.clayton@isode.com>2014-08-19 12:54:52 (GMT)
committerAlex Clayton <alex.clayton@isode.com>2014-08-19 14:23:15 (GMT)
commit768ec40ad0229804ca1dcc06dc9cdc7c8dab9769 (patch)
treea8b6acd5d0527066700c23b0e7a10dfd643c371b /src/com/isode
parentc0293fade7b437e5687e7121c9f6b9de7344ad47 (diff)
downloadstroke-768ec40ad0229804ca1dcc06dc9cdc7c8dab9769.zip
stroke-768ec40ad0229804ca1dcc06dc9cdc7c8dab9769.tar.bz2
Add SubjectSerializer
Add a SubjectSerializer to Stroke. Test-information: Created a Message object and set its subject. Subject field now turns up in the XMMP telemetry. Change-Id: I7b310d6dc52852e5704696e5e3762bed6a4d53ad
Diffstat (limited to 'src/com/isode')
-rw-r--r--src/com/isode/stroke/serializer/payloadserializers/FullPayloadSerializerCollection.java2
-rw-r--r--src/com/isode/stroke/serializer/payloadserializers/SubjectSerializer.java22
2 files changed, 23 insertions, 1 deletions
diff --git a/src/com/isode/stroke/serializer/payloadserializers/FullPayloadSerializerCollection.java b/src/com/isode/stroke/serializer/payloadserializers/FullPayloadSerializerCollection.java
index 9cb3646..ee8ad05 100644
--- a/src/com/isode/stroke/serializer/payloadserializers/FullPayloadSerializerCollection.java
+++ b/src/com/isode/stroke/serializer/payloadserializers/FullPayloadSerializerCollection.java
@@ -22,7 +22,7 @@ public class FullPayloadSerializerCollection extends PayloadSerializerCollection
/*FIXME: Implement what's needed. */
//addSerializer(new IBBSerializer());
addSerializer(new BodySerializer());
- //addSerializer(new SubjectSerializer());
+ addSerializer(new SubjectSerializer());
//addSerializer(new ChatStateSerializer());
//addSerializer(new PrioritySerializer());
addSerializer(new ErrorSerializer());
diff --git a/src/com/isode/stroke/serializer/payloadserializers/SubjectSerializer.java b/src/com/isode/stroke/serializer/payloadserializers/SubjectSerializer.java
new file mode 100644
index 0000000..885d86c
--- /dev/null
+++ b/src/com/isode/stroke/serializer/payloadserializers/SubjectSerializer.java
@@ -0,0 +1,22 @@
+package com.isode.stroke.serializer.payloadserializers;
+
+import com.isode.stroke.elements.Subject;
+import com.isode.stroke.serializer.GenericPayloadSerializer;
+import com.isode.stroke.serializer.xml.XMLTextNode;
+
+/**
+ * Subject to String
+ */
+public class SubjectSerializer extends GenericPayloadSerializer<Subject> {
+
+ public SubjectSerializer() {
+ super(Subject.class);
+ }
+
+ @Override
+ protected String serializePayload(Subject payload) {
+ XMLTextNode textNode = new XMLTextNode(payload.getText());
+ return "<subject>"+textNode.serialize()+"</subject>";
+ }
+
+}