How to create List and Map variables types using REST

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2014 08:02 AM
Hi,
have one of the requriement where I need to create a variable on existing task using following rest URL.
POST http://hostname
ort/activiti-rest/service/runtime/tasks/taskId/variables
In the body,
[
{
"name" : "listNames",
"scope" : "local",
"type" : "list",
"value" : "ok"
}
]
This is not working, somebody please advice me on how to create a variable types like List & Map using above rest calls.
have one of the requriement where I need to create a variable on existing task using following rest URL.
POST http://hostname

In the body,
[
{
"name" : "listNames",
"scope" : "local",
"type" : "list",
"value" : "ok"
}
]
This is not working, somebody please advice me on how to create a variable types like List & Map using above rest calls.
Labels:
- Labels:
-
Archive
7 REPLIES 7

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2014 02:10 AM
Any idea on this please ??

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2014 10:56 AM
You can read this blog post for information about custom variable types:
http://stacktrace.be/blog/2013/09/
Best regards,
http://stacktrace.be/blog/2013/09/
Best regards,

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2014 01:19 AM
HI Tijs Rademakers,
Have read the above blog post. I think the post demonstrating the example at high level. I am bit new to Activiti so not able to abstract where & how to make these changes. Any simple example is appreciated.
Have read the above blog post. I think the post demonstrating the example at high level. I am bit new to Activiti so not able to abstract where & how to make these changes. Any simple example is appreciated.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2014 04:12 AM
Now I have understood that I need to create CustomRestResponseFactory by extending RestResponseFactory in that need to override the method initializeVariableConverters method to accomodate my new RestVariableConverter to support List and Map.
I am not sure where should I keep CustomRestResponseFactory class so that all of my rest calls should use this class.
I am not sure where should I keep CustomRestResponseFactory class so that all of my rest calls should use this class.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2014 05:58 AM
You add it to the classpath, and inject it into the Rest classes, as in the article:
ActivitiRestServicesApplication application = new ActivitiRestServicesApplication();
application.setRestResponseFactory(new CustomRestResponseFactory());
ActivitiRestServicesApplication application = new ActivitiRestServicesApplication();
application.setRestResponseFactory(new CustomRestResponseFactory());

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2014 01:53 PM
I tried to get this working and so far have not succeeded. It looks like how the rest webapp initializes has now changed. Here's what I did. I put a activiti.cfg.xml in the rest webapp WEB-INF/classes like this:
<code>
<beans>
<bean id="restResponseFactory" class="my.activiti.rest.CustomRestResponseFactory" />
</beans>
</code>
I've got the jar with my CustomRestResponseFactory (which extends RestResponseFactory) in the rest webapp's WEB-INF/lib
When I startup tomcat it doesn't look like my class is being injected. Is there a better way to customize the rest api webapp that I'm missing?
I should add that I'm using the 5.16.4 release which changed the rest api from restlet's to Spring which may have an affect on what is going on here.
<code>
<beans>
<bean id="restResponseFactory" class="my.activiti.rest.CustomRestResponseFactory" />
</beans>
</code>
I've got the jar with my CustomRestResponseFactory (which extends RestResponseFactory) in the rest webapp's WEB-INF/lib
When I startup tomcat it doesn't look like my class is being injected. Is there a better way to customize the rest api webapp that I'm missing?
I should add that I'm using the 5.16.4 release which changed the rest api from restlet's to Spring which may have an affect on what is going on here.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2014 12:06 PM
If you want to customise RestResponseFactory the best way is too clone the REST application and change the RestConfiguration class:
https://github.com/Activiti/Activiti/blob/master/modules/activiti-webapp-rest2/src/main/java/org/act...
Best regards,
https://github.com/Activiti/Activiti/blob/master/modules/activiti-webapp-rest2/src/main/java/org/act...
Best regards,
