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

ConfigurationTable in ThingShapes / Where does it show up?

Gravel

ConfigurationTable in ThingShapes / Where does it show up?

Hello,

 

I started to develop some Java-Extensions to solve some issues, that we where not able to solve with pure javascript. For some of these functional modules it would be interesting to have them as ThingShape to enable reuse on different Things.

The Eclipse-Plugin allows me to add a ConfigurationTable to the ThingShape and everything compiles properly.

But when I use this ThingShape, I can not see my ConfigurationTable entries anywhere?

 

Ok my first use example, we would like to have a TimerShape that behaves similar like TimerTemplate:

@ThingworxConfigurationTableDefinitions(tables = {
		@ThingworxConfigurationTableDefinition(name = "Settings", description = "General Settings", isMultiRow = false, ordinal = 0, dataShape = @ThingworxDataShapeDefinition( fields = {
				@com.thingworx.metadata.annotations.ThingworxFieldDefinition(name="updateRate", description="Update rate", baseType="NUMBER", aspects={"defaultValue:60000"}), 
				@com.thingworx.metadata.annotations.ThingworxFieldDefinition(name="enabled", description="Automatically enable timer on startup", baseType="BOOLEAN", aspects={"defaultValue:true"}), 
				@com.thingworx.metadata.annotations.ThingworxFieldDefinition(name="runAsUser", description="User context in which to run event handlers", baseType="USERNAME") 
			}))
		})
public class TimerTS {

//	private static Logger _logger = LogUtilities.getInstance().getApplicationLogger(TimerTS.class);

	public TimerTS() {
		// TODO Auto-generated constructor stub
	}

	@ThingworxServiceDefinition(name = "OnTimerTick", description = "Called by timer each time the it is triggered ...", category = "Timer", isAllowOverride = true )
	@ThingworxServiceResult(name = "Result", description = "", baseType = "NOTHING", aspects = {})
	public void OnTimerTick(
			@ThingworxServiceParameter(name = "Timestamp", description = "\t", baseType = "DATETIME") DateTime Timestamp) {
	}

}

 

 

 

Tags (2)
9 REPLIES 9

Re: ConfigurationTable in ThingShapes / Where does it show up?

Hi @atondorf.

 

Which version of ThingWorx are you running?  It appears this issue was corrected in ThingWorx 8.4.4.

 

Regards.

 

--Sharon

Re: ConfigurationTable in ThingShapes / Where does it show up?

Hi Sharon,

 

we have 8.4.4 and after your comment I tested it with a ThingShape created in the Composer .. it's working.

But still not with my shape created as a JavaExtension in Eclipse. So there must be something wrong with the source code. But it is just blank code created by the eclipse thingworx assistant. 

Re: ConfigurationTable in ThingShapes / Where does it show up?

Hi @atondorf.

 

These guides may help in determining the cause of your issue:

 

Create a Mashup Widget Extension

Create an Extension

 

Regards.

 

--Sharon

 

Re: ConfigurationTable in ThingShapes / Where does it show up?

Hi Sharon,

 

thanks a lot, but I already know these tutorials and I followed them. That's how I get this far, but like most documentation on thingworx, these are on a very basic level. If you go deeper into some details you will mostly hit the wall.

In my special case I want to add the ConfigurationTable to a ThingShape and I already did it in Eclipse, but it does not show up in Thingworx. So there must be something missing in code or the Eclipse Plugin does not do the job correclty.

 

Greetings

 

Andreas

Re: ConfigurationTable in ThingShapes / Where does it show up?

Hello,

 

Just a thought -- what if you try to inherit from Thing or ThingShape class?

 

/ Constantine

Highlighted

Re: ConfigurationTable in ThingShapes / Where does it show up?

Dear Constantine,

 

is there a Java ThingShape Class??
The eclipse plugin implements ThingShapes as Baseclass without any base class.

 

Greetings

 

Andreas

Re: ConfigurationTable in ThingShapes / Where does it show up?

Hello Andreas,

 

There are com.thingworx.thingshape.ThingShape and com.thingworx.things.Thing classes. Without a better solution I just suggested doing a quick check to see if inheriting one of those might help in your situation.

 

/ Constantine

Re: ConfigurationTable in ThingShapes / Where does it show up?

Dear Constantine,

 

sorry was quite busy with other stuff, but right now back to my issue...
I tried your suggestion and 
I created an Test Project in Eclipse that has two classes:

1) a shape:

package test.extension;
import com.thingworx.metadata.annotations.ThingworxConfigurationTableDefinition;
import com.thingworx.metadata.annotations.ThingworxConfigurationTableDefinitions;
import com.thingworx.metadata.annotations.ThingworxDataShapeDefinition;
import com.thingworx.metadata.annotations.ThingworxFieldDefinition;
import com.thingworx.thingshape.ThingShape;
@ThingworxConfigurationTableDefinitions(tables = {
		@ThingworxConfigurationTableDefinition(name = "Settings", description = "General Settings", isMultiRow = false, ordinal = 0, dataShape = @ThingworxDataShapeDefinition(fields = {
				@ThingworxFieldDefinition(name = "name", description = "", baseType = "STRING", ordinal = 0),
				@ThingworxFieldDefinition(name = "enabled", description = "", baseType = "BOOLEAN", ordinal = 1, aspects = {"defaultValue:false" })})) })
public class TestJavaConfigThingTS extends ThingShape {
	public TestJavaConfigThingTS() {
		// TODO Auto-generated constructor stub
	}
}

2) a template:

package test.extension;

import com.thingworx.metadata.annotations.ThingworxBaseTemplateDefinition;
import com.thingworx.metadata.annotations.ThingworxConfigurationTableDefinition;
import com.thingworx.metadata.annotations.ThingworxConfigurationTableDefinitions;
import com.thingworx.metadata.annotations.ThingworxDataShapeDefinition;
import com.thingworx.metadata.annotations.ThingworxFieldDefinition;
import com.thingworx.things.Thing;

@ThingworxBaseTemplateDefinition(name = "GenericThing")
@ThingworxConfigurationTableDefinitions(tables = {
		@ThingworxConfigurationTableDefinition(name = "Settings", description = "General Settings", isMultiRow = false, ordinal = 0, dataShape = @ThingworxDataShapeDefinition(fields = {
				@ThingworxFieldDefinition(name = "name", description = "\t\t", baseType = "STRING", ordinal = 0),
				@ThingworxFieldDefinition(name = "enabled", description = "", baseType = "BOOLEAN", ordinal = 1, aspects = {"defaultValue:false" }) })) })
public class TestJavaConfigThingTT extends Thing {

	public TestJavaConfigThingTT() {
		// TODO Auto-generated constructor stub
	}

}

Both should have the same Configuration settings and I created them using the Eclipse-Plugin. This plugin does not add the base class ThingShape for ThingShapes and so I added this manually.

 

Everything compiles well and also the import was without any issu, but ...

The Configuration of the Template shows up in Thingworx as expected. The config of the ThingShape does not!

 

So there must be something wrong or missing in the code created by the eclipse wizards.

 

Greetings

 

Andreas

 

 

Re: ConfigurationTable in ThingShapes / Where does it show up?

Hello Andreas,

 

I'm sorry it didn't help. To me it looks like it's time to contact tech support.

 

Regards,
Constantine