cancel
Showing results for 
Search instead for 
Did you mean: 

Rest API Get form data forn new type option-group

butik
Champ in-the-making
Champ in-the-making
Hello,

I have added new form type option-gorup, it is very simmilar to enum, but displays group of options instead of select.
It is correctly rendered for Activiti Explorer, but for rest api I didn't received enum values for this new type.
I figured out that I have to override createFormDataResponse method from RestResponseFactory class, since "enum" is hardcoded there, so I have to add "option-group" also:

if ("enum".equals(restFormProp.getType()) || "option-group".equals(restFormProp.getType())) {
          Object values = formProp.getType().getInformation("values");
          if (values != null) {
            @SuppressWarnings("unchecked")
            Map<String, String> enumValues = (Map<String, String>) values;
            for (String enumId : enumValues.keySet()) {
              RestEnumFormProperty enumProperty = new RestEnumFormProperty();
              enumProperty.setId(enumId);
              enumProperty.setName(enumValues.get(enumId));
              restFormProp.addEnumValue(enumProperty);
            }
          }
        }


Would it be better to remove if condition if ("enum".equals(restFormProp.getType())) from core code?
In that case user will not need to extend RestResponseFactory  and override createFormDataResponse .

BR,
Paul
1 REPLY 1

trademak
Star Contributor
Star Contributor
Hi Paul,

If you have an improvement for this you can create a pull request and if it's an improvement it will be certainly accepted. From your post I don't understand yet how you would improve this specific logic.

Best regards,
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.