Hi,
The YAML serializer is implemented only for usage with the workflow data object. You can use it simply by setting the serializer for your DB storage like so:
sqlDialect.setSerializer(new YamlSerializer());where sqlDialect could be something like a PostgreSQLDialect. I think, it is handy to have my data in a human readable format but I don't need this for the serialization of the workflow object itself. (That is, serialization of workflow and of workflow-data are distinguished in SerializedWorkflow POJO). If you want the workflow object to be serialized by YAML as well, you should write your own Serializer class (or extend StandardJavaSerializer if you want Responses to be still serialized with that) and just override the public SerializedWorkflow serializeWorkflow(Workflow<?> o) throws Exception as well as accordingly the derserializeWorkflow method. The implementation of these methods should be straight forward as a mix out of the original methods in StandardJavaSerializer [Create SerializeWorkflow, call setter of it and return) and the methods from the YamlSerializer. (Create the serialization string). Remember that the SerializedWorkflow class is just a POJO holding two data strings which are then stored to the database.. Best regards
-- You received this message because you are subscribed to the Google Groups "COPPER Engine" group. To unsubscribe from this group and stop receiving emails from it, send an email to copper-engin...@googlegroups.com. To post to this group, send email to copper...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/copper-engine/7d49fd9d-1378-4f6a-ab83-aead69cd8dc1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
-- SCOOP Software GmbH - Gut Maarhausen - Eiler Straße 3 P - D-51107 Köln Theo Diefenthal T +49 221 801916-196 - F +49 221 801916-17 theo.di...@scoop-software.de - www.scoop-software.de Sitz der Gesellschaft: Köln, Handelsregister: Köln, Handelsregisternummer: HRB 36625 Geschäftsführung: Dr. Oleg Balovnev, Frank Heinen, Dr. Wolfgang Reddig, Roland Scheel
Hi Howie,
I tried to reproduce your issue but for me, it seems to work just fine with enums. Can you give me a working example of the problem?
You can check my response to the created issue and see how I
failed in reproduction:
https://github.com/copper-engine/copper-engine/issues/75
Best regards
Theo
To view this discussion on the web visit https://groups.google.com/d/msgid/copper-engine/901752840.15420775.1488351999131.JavaMail.zimbra%40scoop-software.de.
For more options, visit https://groups.google.com/d/optout.
Hi Howie,
I tried to reproduce your issue but for me, it seems to work just fine with enums. Can you give me a working example of the problem?
You can check my response to the created issue and see how I failed in reproduction:
https://github.com/copper-engine/copper-engine/issues/75
Best regards
Theo
Am 01.03.2017 um 08:06 schrieb Michael Austermann:
You are right - this is ugly and dangerous.I opened an issue for this:
Thanks for reporting...
Von: "Howie" <ck...@gmail.com>
public class TestData
{
private int aNumber;
private final int finalNumber = 42; //this also won't show up
private final TimeUnit timeUnit = TimeUnit.SECONDS; //or put in default constructor
private String someString;
...setters & getters
}
public static void main(String[] args) throws Exception {
TestData data = new TestData();
data.setaNumber(1111);
data.setSomeString("aaaaa");
Yaml yaml = new Yaml();
String s = yaml.dump(data);
System.out.println(s);
}
public class TestData
{
private int aNumber;
private final TimeUnit timeUnit ;
private String someString;
public TestData(TimeUnit timeUnit)
{
this.timeUnit = timeUnit;
}
...setters & getters
}
TestData data = new TestData(TimeUnit.SECONDS);
data.setaNumber(1111);
data.setSomeString("aaaaa");
Yaml yaml = new Yaml();
String s = yaml.dump(data);
System.out.println(s);
TestData data2 = (TestData) yaml.load(s); -> Caused by: org.yaml.snakeyaml.error.YAMLException: java.lang.NoSuchMethodException: com.test.TestData.<init>()