cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

JAVA SDK: Delete Data Shape Dynamically

Regular Member

JAVA SDK: Delete Data Shape Dynamically

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

6 REPLIES 6

Re: JAVA SDK: Delete Data Shape Dynamically

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.

Re: JAVA SDK: Delete Data Shape Dynamically

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?

 

 

Re: JAVA SDK: Delete Data Shape Dynamically

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?

Re: JAVA SDK: Delete Data Shape Dynamically

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.

 

Re: JAVA SDK: Delete Data Shape Dynamically

I already have a feature request pending for DataShape deletion Snippet... There's almost a Delete Snippet for any kind of entity, but not for DataShapes :(

Re: JAVA SDK: Delete Data Shape Dynamically

Thanks Carles for highlighting. I found that enhancement request, adding link to the article here for reference https://www.ptc.com/en/support/article?n=CS231106 

 

Guy, I'll have an internal case open for you on this topic and will have that added to the enhancement request.

Announcements

Thingworx Navigate content has a new home! Click here to access the new Thingworx Navigate forum! ______________________________