cancel
Showing results for 
Search instead for 
Did you mean: 

Getting IllegalArgumentException when submitting an AIKAU form

satheeshkumar
Champ in-the-making
Champ in-the-making
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 configurationvar 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 configurationvar 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 herevar 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 form2015-04-06 00:06:51,760 [DEBUG] org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:437) form.post.json.js Start2015-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 = type2015-04-06 00:06:51,763 [DEBUG] org.alfresco.repo.jscript.ScriptLogger.debug(ScriptLogger.java:50)      id = hccm:productTypeFolder2015-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}imageLibraryListTitle: nullDescription: nullDefault Value: nullDataType Name: {http://www.alfresco.org/model/dictionary/1.0}textContainerClass Name: {http://www.mycompany.com/model/content/1.0}productTypeFolderisMultiValued: trueisMandatory: falseisMandatoryEnforced: falseisProtected: falseisIndexed: trueisStoredInIndex: falseisIndexedAtomically: trueindexTokenisationMode: 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 code2015-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.
4 REPLIES 4

ddraper
World-Class Innovator
World-Class Innovator
This isn't really a specific Aikau issue, but rather how you're using Aikau to construct your form POST. It's quite tricky to follow because you're using a custom model so we'd need to know what your model can accept.

Hi Dave,

I just used my own custom PublishTopic instead of "ALF_CRUD_CREATE", and used custom post webscript to post the data, now I am able to submit the data without any issues.

muralidharand
Star Contributor
Star Contributor
Hi Satheesh,
Have you made any specific changes in the custom topic when comparing with ALF_CRUD_CREATE?
Can you please post your custom topic details here? I am very much interested to find out the details. 🙂

Hi Murali,

I Have created a custom web-script to handle the post request and created a custom service to subscribe the custom topic.

//My custom Servicedefine([ "dojo/_base/declare", "alfresco/core/Core", "dojo/_base/lang",      "alfresco/core/CoreXhr", "service/constants/Default","alfresco/dialogs/AlfDialog","hc/widgets/topics/_TopicsMixin" ], function(      declare, Core, lang, CoreXhr, AlfConstants, AlfDialog, _TopicsMixin) {   return declare([ Core, CoreXhr, _TopicsMixin ], {      constructor : function hc_widgets__constructor(args) {         lang.mixin(this, args);         this.alfSubscribe(this.ProductCreateTopic, lang.hitch(this,               this.createProductType)); //ProductCreateTopic has been mapped to the custom topic that I publish               },createProductType : function hc_widgets__createProductType(payload) {                  this.serviceXhr({            url : AlfConstants.PROXY_URI + "manage-product-library/" +payload.prop_cm_name+"?action=create",            method : "POST",            data : {               prop_cm_name : payload.prop_cm_name,               prop_hccm_prefix : payload.prop_hccm_prefix,               prop_cm_title : payload.prop_cm_title,               prop_cm_description : payload.prop_cm_description,               prop_hccm_imageLibraryList : payload.prop_hccm_imageLibraryList,               prop_hccm_backgroundImageLibraryList : payload.prop_hccm_backgroundImageLibraryList,               prop_hccm_stockImageLibraryList : payload.prop_hccm_stockImageLibraryList,               prop_hccm_photoImageLibraryList : payload.prop_hccm_photoImageLibraryList,               prop_hccm_graphicsImageLibraryList : payload.prop_hccm_graphicsImageLibraryList               },            successCallback: this.onSuccessCreate,            failureCallback: this.onFailureCreate,             callbackScope: this         });      }   });});//My Custom JavaBacked Webscript,Portion of logic to post the data,if(action != null && action.equalsIgnoreCase("create")){   logger.warn("Going to "+action+" the product type : "+ productType);      //This actually generates the JSON Object.   jsonObject = HCCommonUtils.generateJSONObject(req);         try {            //This Generates the productMap.      Map<QName, Serializable> productMap = generateProductMap();                     try {            if (productMap != null) {            //Creating the Actual Node. //QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "name") is no way related here, but still it is mandatory so giving a dummy name.            nodeService.createNode(productLibraryNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "name"), HCCustomModel.QNAME_PRODUCT_TYPE_FOLDER, productMap);         }         else{            throw new AlfrescoRuntimeException("productMap can not be null");         }                        } catch (InvalidTypeException | InvalidQNameException e) {         logger.error("Exceptio Occurred while creating new Node"+ e.getMessage());      }         } catch (InvalidNodeRefException | JSONException e) {      logger.error("Error occured while Creating properties from Json Object."            + e.getMessage());   }}//generateProductMap() has the custom logic to convert the generated JSONData into productMap of (Map<QName, Serialisable>)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍