Import Data Using A Java Plugin Issue

If you think that something doesn't work in Aware IM post your message here
Post Reply
obt123
Posts: 1
Joined: Mon Apr 04, 2022 3:35 am

Import Data Using A Java Plugin Issue

Post by obt123 »

I am wanting to use the importData() method inside a Java Plugin, I have set up a functioning Class that implements IProcess, I have compiled it to a JAR and works as expected up to the line where I want to use the importData() method.

Inside the developers documentation it says the importData() method has 5 parameters, below is a snippet from the documentation:

public Collection importData (IProcess parent, String entityName, String importFileName, Integer batchSize, Boolean validate)

However, when using the importData(), method in java, the interface IExecutionEngine which has the definition of the method requires there to be 10 parameters! There is no indication of what value those parameters should be other than their type (boolean, string etc).

Can the documentation please be updated to include these other parameters?

Am running Aware IM 8.7 and looking at the developer documentation for Aware IM 8.7 so I must be missing something.

After alot of trial and error managed to guess what most of the parameters could be, as follows the 10 parameters I used on the method (ignore the json keys, the values are what matter) i put descriptions next to the values what i think each of the parameters represent.
{
"s" : "Contact", (name of the Business object)
"s2" : "C:\\Users\\Administrator\\Downloads\\Imports\\Contact.csv", (this looks like the location of the import file)
"s3" : "null", (this looks where you'd put the location of the template file, however i dont want to use one, don't ask me why its in a string haha)
"s4" : "C:\\Users\\Administrator\\Downloads\\Imports\\Contact.csv", (not sure what this is, so just put file name again)
"n" : 100, (batch size)
"b" : false, (not sure what this is)
"b2" : true, (not sure what this is)
"b3" : true, (not sure what this is)
"b4" : false, (I believe this has something to do with importing an xml, because if I set this to true, then i get an xml parse error)
"b5" : true (not sure what this is, one of these booleans must be the boolean for 'validate' mentioned in the developer documentation)
}

For clarity, my method call looks like this:
engine.importData("Contact", "C:\\Users\\Administrator\\Downloads\\Imports\\Contact.csv", "null", "C:\\Users\\Administrator\\Downloads\\Imports\\Contact.csv", 100, false, true, true, false, true)

With the above parameters I get the error saying file C:\\Users\\Administrator\\Downloads\\Imports\\Contact.csv was not found, by the way I've tried every iteration of writing the absolute path of a file, settled with using \\ to identify next directorys. I've also tried storing the file in other locations such as C://Contact.csv

Interestingly if I use a xml file it works fine. However, I need to use the import csv functionality.

Can anyone steer me in the right direction for what my parameters should be for the importData method inside an Awareim Process Plugin written in Java?
BobK
Posts: 544
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: Import Data Using A Java Plugin Issue

Post by BobK »

obt123,

Are you still looking for an answer to this? Whether you are or not, here is my answer.

I think the error you are getting
C:\\Users\\Administrator\\Downloads\\Imports\\Contact.csv was not found
is coming from your s4 parameter. Try putting null in that parameter.

For you s2 parameter, you should be able to use

Code: Select all

"C:\Users\Administrator\Downloads\Imports\Contact.csv"
You do not mention it, but do you have a parameter for the process that is calling the plug-in?
The first parameter, before your "Contact" parameter, should be the word "this" without the quotes.

I am curious, why are you using a plug-in for this instead of using the IMPORT action in a normal process?
Bob
Post Reply