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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

How can we read the thingname of thing from a thingshape which is attached to it using eclipse?

Sugumar_5656
14-Alexandrite

How can we read the thingname of thing from a thingshape which is attached to it using eclipse?

I want to get the thingname for a thing through a thingshape attached to it. using eclipse I can't fetch the particular thing name for getting the properties of the thing.

 for example in thingworx we use "me.name"  to fetch the thingname, what will be the suitable alternative for that in java eclipse.

 

thanks in advance.

 

5 REPLIES 5
vxavier
13-Aquamarine
(To:Sugumar_5656)

Hi Sugmar,

 

In thingworx for ThingShapes and templates a use the services:

 

- GetIncomingDependencies

- GetOutgoingDependencies

 

To list the child and the parents.

 

I believe is just call this services in eclipse.

 

Thanks,

Vinicius.

Sugumar_5656
14-Alexandrite
(To:vxavier)

Hai Xavier.

                  I tried this one, it is listing the parent and child relationships as you mentioned. but my requirement is to read the thingname through the thingshape service which is attached to it. 

 

generally in javascript we use "me.name". i just need the equivalent code of this one in java .

 

thanks and regards

Sugumar  

vxavier
13-Aquamarine
(To:Sugumar_5656)

StringPrimitive name =
(StringPrimitive)this.getPropertyValue("name");

 

Does this work?

Thanks @vxavier for your response. It is throwing an error like "com.thingworx.common.exceptions.InvalidRequestException: Property [name] not found in []"

 

Thanks & Regards,

Sathishkumar C.

public class MyShape extends Thing {
	private static Logger _logger = LogUtilities.getInstance().getApplicationLogger(MyShape.class);

	public MyShape() {
		// TODO Auto-generated constructor stub
	}
	@ThingworxServiceDefinition(name = "myName", description = "", category = "", isAllowOverride = false, aspects = {
			"isAsync:false" })
	@ThingworxServiceResult(name = "result", description = "", baseType = "STRING", aspects = {})
	public String myName() {
		_logger.trace("Entering Service: myName");
		String s = "SSS";
		try 
{ StringPrimitive name = (StringPrimitive) this.getPropertyValue("name"); s = name.toString(); }
catch(Exception e)
{ s = e.toString(); } _logger.trace("Exiting Service: myName"); return s; } }

 

 
Top Tags