AnsweredAssumed Answered

Getting IllegalArgumentException when submitting an AIKAU form

Question asked by satheeshkumar on Apr 6, 2015
Latest reply on May 4, 2015 by satheeshkumar
Hi All,

I have a custom AIKAU form, which contains few text boxes and a dynamic list(created by SimplePicker widget), when I submit this form I am getting IllegalArgumentException.

//My Custom Model defintion
<type name="hccm:productTypeFolder">
         <title>Product Type Folder</title>
         <parent>cm:folder</parent>
         <properties>
            <property name="hccm:prefix">
               <type>d:text</type>
               <mandatory>true</mandatory>               
            </property>
            <property name="hccm:imageLibraryList">
               <type>d:text</type>
               <mandatory>false</mandatory>
               <multiple>true</multiple>
            </property>                        
         </properties>         
      </type>


//My AIKAU Form
//I have not given the complete form here, just have shown the required widgets alone,
//imageLibraryPicker widget configuration
var imageLibraryPicker = {
   name : "alfresco/forms/controls/SimplePicker",
   config : {
      label : "Pick Image Libraries",
      description : "This is a simple picker publishes a request to get data to display",
      visibilityConfig : {
         initialValue : false,
         rules : [ {
            targetId : "SHOW_OTHER_FIELDS",
            is : [ true ]
         } ]
      },
      name : "prop_hccm_imageLibraryList",
      noItemsMessage: "No Libraries Available!",
      loadDataPublishTopic : "ALF_CRUD_GET_ALL",
      loadDataPublishPayload : {
         url : "retrieve-library-list?retrieve=Image%20Library"
      },
      itemsProperty : "imagesLibraryList",
      itemKey : "prop_cm_name",
      propertyToRender : "prop_cm_name",
      availableItemsLabel : "Available",
      pickedItemsLabel : "Currently Selected"
   }
};

//showOrHideCheckBox  widgets configuration
var showOrHideCheckBox = {
   name : "alfresco/forms/controls/CheckBox",
   config : {
      fieldId : "SHOW_OTHER_FIELDS",
      label : "Want to Associate Image Libraries?",
      description : "Check this box to associate Image Libraries to this Product Type",
      name : "extra_info",
      value : false
   }
};
// Create the form here
var addNewProductForm = {
   name : "alfresco/forms/Form",
   config : {
      showOkButton : true,
      okButtonLabel : "Create",
      showCancelButton : false,
      cancelButtonLabel : "Cancel",
      // Specify the TOPIC here
      okButtonPublishTopic : "ALF_CRUD_CREATE",
      okButtonPublishGlobal : true,
      okButtonPublishPayload : {
         // Specify the URL here to POST the data
         // Dereived based on the URI
         // "/api/{item_kind}/{item_id}/formprocessor"
         url : "api/type/hccm%3AproductTypeFolder/formprocessor",
         // To create the folder under product Library of document library,
         // we need the productLibrary nodeRer,So POST that too.
         alf_destination : alfDestination,
         alfResponseTopic : "HC_PRODUCT_CREATE"
      },
      widgets : [
            {
               name : "alfresco/forms/ControlRow",
               config : {
                  title : "",
                  description : "Mandatory Details.",
                  widgets : [ productName, productPrefix ]
               }
            },
            {
               name : "alfresco/forms/ControlRow",
               config : {
                  title : "",
                  description : "If you want to associate Image Libraries for this Product Type, you can do here.",
                  widgets : [ showOrHideCheckBox ]
               }
            },imageLibraryPicker]
   }
};

model.jsonModel = {
   services : [ "alfresco/services/CrudService",
         "alfresco/services/DialogService",
         "hc/widgets/response/ProductCreateListen" ],
   widgets : [ {
      name : "alfresco/layout/VerticalWidgets",
      config : {
         widgetMarginTop : "10",
         widgetMarginBottom : "10",
         widgets : [{

                  name : "alfresco/layout/HorizontalWidgets",
                  config : {
                     widgetMarginLeft : "10",
                     widgetMarginRight : "10",
                     widgets : [ {
                        name : "alfresco/layout/ClassicWindow",
                        widthPx : "550",
                        config : {
                           title : "Add New Product Type Page",
                           widgets : [ {
                              name : "alfresco/layout/TitleDescriptionAndContent",
                              config : {
                                 title : "Create Product Type",
                                 description : "This is the Page for Creating New Product Types.",
                                 widgets : [ addNewProductForm ]
                              }
                           } ]
                        }
                     } ]
                  }

               } ]
      }
   } ]

};


//Error I see in the logs when I submit this form

2015-04-06 00:06:51,760 [DEBUG] org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:437) form.post.json.js Start
2015-04-06 00:06:51,762 [DEBUG] org.alfresco.repo.jscript.ScriptLogger.debug(ScriptLogger.java:50) json form submission for item:
2015-04-06 00:06:51,762 [DEBUG] org.alfresco.repo.jscript.ScriptLogger.debug(ScriptLogger.java:50)      kind = type
2015-04-06 00:06:51,763 [DEBUG] org.alfresco.repo.jscript.ScriptLogger.debug(ScriptLogger.java:50)      id = hccm:productTypeFolder
2015-04-06 00:06:51,860 [DEBUG] org.alfresco.repo.jscript.ScriptLogger.debug(ScriptLogger.java:50) java.lang.IllegalArgumentException: Node properties must be fully serializable, including values contained in collections.
   Property: Name: {http://www.mycompany.com/model/content/1.0}imageLibraryList
Title: null
Description: null
Default Value: null
DataType Name: {http://www.alfresco.org/model/dictionary/1.0}text
ContainerClass Name: {http://www.mycompany.com/model/content/1.0}productTypeFolder
isMultiValued: true
isMandatory: false
isMandatoryEnforced: false
isProtected: false
isIndexed: true
isStoredInIndex: false
isIndexedAtomically: true
indexTokenisationMode: TRUE

   Index:    0
   Value:    {"index":0,"prop_cm_name":"Images1","alfTopic":"4137d6fa-4ee5-4673-8657-5e707916c89aALF_ITEM_SELECTED","isLastItem":false}
2015-04-06 00:06:51,861 [DEBUG] org.alfresco.repo.jscript.ScriptLogger.debug(ScriptLogger.java:50) Returning 500 status code
2015-04-06 00:06:51,861 [DEBUG] org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:535) form.post.json.js End 101 ms



It looks like the values in the collections should be serializable, but I am not sure how to make this dynamic list to be serializable, can you please help me on this.

Outcomes