Skip to main content
5-Regular Member
February 20, 2018
Question

JAVA SDK: Delete Data Shape Dynamically

  • February 20, 2018
  • 2 replies
  • 3475 views

I am using Java SDK to create a Data Table dynamically.

During the creation process, I create a Data Shape dynamically.

I would like, in case of failure (exception thrown or other reasons), to delete the recently created Data Shape.

 

Is there a way to do that?

 

Thanks,

Guy Hecht

2 replies

5-Regular Member
February 21, 2018

Hi Guy, i'm checking for this. I can see there is a service to list them out, but couldn't locate any delete service for DataShape specifically. 

 

Assuming you are using Java Extension SDK, please do correct me if you are working with Java Edge SDK.

5-Regular Member
February 22, 2018

Unfortunately there is no straight forward service to simply delete the DataShape so you'll have to surround the creation of DataTable with the try/catch block to handle any error/exception occurring during creation process. 

 

Would it be possible for you to share a short snippet of how you are handling it currently in your code?

 

 

ghecht5-Regular MemberAuthor
5-Regular Member
February 22, 2018

Are you sure that surrounding the creation of the data table with a try and catch block would work?

If the Data Shape was already created in thingworx by my code how will it be deleted?

I am currently using the try and catch mechanism but I was planning on calling the deletion service on the catch block.

 

Is there no way of deleting a general entity maybe, regardless of it's type?

5-Regular Member
February 22, 2018

Try/catch should handle any exception occurring during the creation process of the entity. For deleting any DataShape independent of the DataTable you are trying to create, i believe dispose() can be used - it'll need to be overridden in your template.

 

 

@Override
public void dispose() throws Exception { // TODO Auto-generated method stub super.dispose(); }

I haven't yet seen any "delete any entity" service, despite a service existing for listing any type of entity. I'll discuss about it and see if it can be taken up as enhancement request if there really isn't any available.