How to load data into entity table from file or 3rd party publisher

I have to load data from diff publisher into Cuba app. Diff data publisher could be Java api or dd table or a file from ftp server
Could you advise how to achieve this?
I was thinking reading file using regular Java io api and insert into entity table ,so have 2 question

  • how to connect app server using standalone class so that I can set up cron or schedule task
    -how to insert into entity table using api

We have just uploaded a new sample application to GitHub: You can open it right from the Studio Samples tab.

Please look at the clients/rest-client project. It is an example of creating entities through the REST API which is available when you add a portal module to your project.

If you create a service in your project and want to invoke it through the REST API, do the following:

  • Enable the service method invocation: create modules/portal/src/app-rest-services.xml file and register it in modules/portal/src/ in the cuba.restServicesConfig property (see the sample project).
  • There is an issue in the current version of Studio: it does not register middleware services automatically to be available from portal (hence through REST API). So you have to register it manually in modules/portal/src/portal-spring.xml - see PortalRemoteProxyBeanCreator bean definition as an example. The issue will be fixed in the next Studio release.

We are going to add more examples of programmatic data manipulation in the near future.

By the way, as an alternative to connect to the application from outside by cron, consider using CUBA Scheduled Tasks. This mechanism allows you to run an arbitrary bean method defined on your middleware. It is often used to import data from external sources.

I need to connect to a 3rd party accounting product ( to pass through work data for invoicing in that system. Xero has an API for this purpose. Is there anything already in CUBA, like the very simple Jelastic connection I was referred to (and was able to implement in minutes), that might assist me here?

Great product!

Hi Michael,

i just had a look at the API. Since it’s just a normal HTTP based API, you should be ready to go with a standard Java HTTP library (i’m not aware of anything special that CUBA would provide here - they basically just have a HTTP lib bundled into cuba. The only “gotcha” here is that it uses oAuth 1 as the authentication mechanism, so you can use a lib like google-oauth-java-client.

As an alternative to couple both application directly, you could also use some kind of ETL tool that acts as a mediator. An example of this would be something like Talend Open Studio for Data Integration where you would basically extract the data from and import it into CUBA both via their HTTP apis.


Thank you