Function to read an Image file, edit it and return it

Hi,

I am trying to create a plug-in which reads an image file, process it by putting a text on the center of the image and then returns the image file that gets stored in a particular location in Appian. When I am try to test it locally, the java code works fine but when I use Appian functions to achieve the requirement, I get an error message - java.lang.Object cannot be cast to java.lang.Long.

This is the first time I am creating a function in Appian so not sure where I am going wrong in the code.

Java code attached. Would really appreciate if somebody can help me with this.

Thanks,
Varnika

OriginalPostID-244915


JavaCode.txt

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    While reading the file version please do the null check.I suspect that the version you are passing and existing file versions are not matching.
    In getInternalFilename() method type cast the input to Long and try again.
  • 0
    Certified Lead Developer
    Please check the below line as well.The property you are reading might not contain any long data.

    return (Long) image.UndefinedProperty;
  • Can you tell me how can I return the Image as long type?
  • I've made some more changes in my code but still not working. Would really appreciate if anyone can help me with correcting my code.

    JavaCode.txt

  • Also this is what being recorded in application server logs -

    2016-11-05 01:50:31,711 [http-/0.0.0.0:80-1] ERROR com.appiancorp.util.BundleUtils - Cannot retrieve the value for key "function.imagewithtext.description" from the bundle.
    2016-11-05 01:50:31,711 [http-/0.0.0.0:80-1] ERROR com.appiancorp.util.BundleUtils - Cannot retrieve the value for key "function.imagewithtext.param.InputText.description" from the bundle.
    2016-11-05 01:50:31,711 [http-/0.0.0.0:80-1] ERROR com.appiancorp.util.BundleUtils - Cannot retrieve the value for key "function.imagewithtext.param.InputFile.description" from the bundle.
    2016-11-05 01:50:31,712 [http-/0.0.0.0:80-1] ERROR com.appiancorp.util.BundleUtils - Cannot retrieve the value for key "function.imagewithtext.param.FileLoc.description" from the bundle.
    2016-11-05 01:50:31,712 [http-/0.0.0.0:80-1] ERROR com.appiancorp.util.BundleUtils - Cannot retrieve the value for key "function.executeportalreportforsail.param.filters.description" from the bundle.
    2016-11-05 01:50:31,713 [http-/0.0.0.0:80-1] ERROR com.appiancorp.util.BundleUtils - Cannot retrieve the value for key "function.getprocessmodeldetailsbyuuid.param.processModelUUIDOrId.description" from the bundle.
    2016-11-05 01:50:31,714 [http-/0.0.0.0:80-1] ERROR com.appiancorp.util.BundleUtils - Cannot retrieve the value for key "function.readcsvlog.param.headers.description" from the bundle.
    2016-11-05 01:50:31,715 [http-/0.0.0.0:80-1] ERROR com.appiancorp.util.BundleUtils - Cannot retrieve the value for key "function.tovalue.param.value.description" from the bundle.
    2016-11-05 01:50:31,715 [http-/0.0.0.0:80-1] ERROR com.appiancorp.util.BundleUtils - Cannot retrieve the value for key "function.touser.param.value.description" from the bundle.
    2016-11-05 01:50:31,717 [http-/0.0.0.0:80-1] ERROR com.appiancorp.util.BundleUtils - Cannot retrieve the value for key "function.getlistfromindices.description" from the bundle.
    2016-11-05 01:50:31,717 [http-/0.0.0.0:80-1] ERROR com.appiancorp.util.BundleUtils - Cannot retrieve the value for key "function.getlistfromindices.param.list.description" from the bundle.
    2016-11-05 01:50:31,717 [http-/0.0.0.0:80-1] ERROR com.appiancorp.util.BundleUtils - Cannot retrieve the value for key "function.getlistfromindices.param.indices.description" from the bundle.