Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
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.
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.
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
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; } }