<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to store Java process variables as JSON? in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/how-to-store-java-process-variables-as-json/m-p/212087#M165217</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am using Java classes as process variables.&amp;nbsp; Rather than use the default java serialization/deserialization mechanism, I wish to instead store the process variables as JSON.&amp;nbsp; To achieve JSON serialization of Java classes, is extending the org.activiti.engine.impl.variable.JsonType class the only requirement?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Nov 2015 23:23:28 GMT</pubDate>
    <dc:creator>tone</dc:creator>
    <dc:date>2015-11-18T23:23:28Z</dc:date>
    <item>
      <title>How to store Java process variables as JSON?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/how-to-store-java-process-variables-as-json/m-p/212087#M165217</link>
      <description>I am using Java classes as process variables.&amp;nbsp; Rather than use the default java serialization/deserialization mechanism, I wish to instead store the process variables as JSON.&amp;nbsp; To achieve JSON serialization of Java classes, is extending the org.activiti.engine.impl.variable.JsonType class the only r</description>
      <pubDate>Wed, 18 Nov 2015 23:23:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/how-to-store-java-process-variables-as-json/m-p/212087#M165217</guid>
      <dc:creator>tone</dc:creator>
      <dc:date>2015-11-18T23:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to store Java process variables as JSON?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/how-to-store-java-process-variables-as-json/m-p/212088#M165218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No, the JsonType class is used for saving process variable values that are instances of com.fasterxml.jackson.databind.JsonNode.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;What you want to do instead is create a custom VariableType and register it to the engine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See the following class for an example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/test/java/org/activiti/examples/variables/VariablesTest.java" rel="nofollow noopener noreferrer"&gt;https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/test/java/org/activiti/examples/variables/VariablesTest.java&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See how the CustomType can be used as a a process variable using the CustomVariableType class which is registered to the engine in the beginning. In that example the variable is created/saved using a byte array and the ValueFields.getBytes and valueFields.setBytes methods.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In your example you will of course have to take the instance that shall be saved and create some json from it first (using the jackson library) and then take that json and store it using valueFields.setBytes (or valueFields.setTextValue) and then do the opposite when the variable shall be brought back to life. You can take a look at the JsonType class for inspiration on how:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/main/java/org/activiti/engine/impl/variable/JsonType.java" rel="nofollow noopener noreferrer"&gt;https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/main/java/org/activiti/engine/impl/variable/JsonType.java&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Dec 2015 15:39:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/how-to-store-java-process-variables-as-json/m-p/212088#M165218</guid>
      <dc:creator>erikwinlof</dc:creator>
      <dc:date>2015-12-02T15:39:10Z</dc:date>
    </item>
  </channel>
</rss>

